Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Catch 404 not found case and quit stream before passing zlib empty file - #360

Merged
kevinsawicki merged 2 commits into
atom:masterfrom
pusateri:master
May 7, 2015
Merged

kevinsawicki merged 2 commits into
atom:masterfrom
pusateri:master

Conversation

@pusateri

@pusateri pusateri commented May 7, 2015

Copy link
Copy Markdown
Contributor

Currently, if you try to download node for unsupported architecture/operating system, you get an exception because it passes a null stream to zlib to decompress.

events.js:72
throw er; // Unhandled 'error' event
^
Error: incorrect header check
at Zlib._binding.onerror (zlib.js:296:17)

This change results in and error being printed:
download not found: http://nodejs.org/dist/v0.10.35/node-v0.10.35-freebsd-x64.tar.gz

@kevinsawicki

Copy link
Copy Markdown
Contributor

I believe this would fix #282

@pusateri

pusateri commented May 7, 2015

Copy link
Copy Markdown
Contributor Author

Yes, and it should make the problem obvious for the Linux arm guys too. I’m not sure if the coffeescript version of request is used vs. the library version of request if this will act differently and I’m not sure how to test that.

What are your thoughts on something like:

If no download is available and the node used to run script/download-node.js is the same major version as specified in the call to downloadNode(), then fall back to copying it?
    cp -p `which node` bin/node

In fact, it seems like the cp could be done first if the version matches and it if doesn’t, then do the download. I’m still figuring out how all of this works but the fact that node is running the script to download node seems like there could be a shortcut here under some circumstances.

Thanks!
Tom

On May 7, 2015, at 11:54 AM, Kevin Sawicki [email protected] wrote:

I believe this would fix #282 #282
—
Reply to this email directly or view it on GitHub #360 (comment).

Comment thread script/download-node.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind keeping the variable name as requestStream, having both res and resp variables is a little confusing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I will redo it. Is there a better way to get feedback on a patch without doing a pull request?

Thanks,
Tom

On May 7, 2015, at 1:14 PM, Kevin Sawicki [email protected] wrote:
Mind keeping the variable as requestStream, having both res and resp variables is a little confusing.

—
Reply to this email directly or view it on GitHub https://github.com/atom/apm/pull/360/files#r29873471.

@kevinsawicki

Copy link
Copy Markdown
Contributor

I’m not sure if the coffeescript version of request is used vs. the library version of request if this will act differently and I’m not sure how to test that.

There shouldn't be any differences and I don't think you need to test that.

If no download is available and the node used to run script/download-node.js is the same major version as specified in the call to downloadNode(), then fall back to copying it?

Yeah, that might be something work exploring, but it would be nice to just get downloads working on all platforms where Atom works.

I’m still figuring out how all of this works but the fact that node is running the script to download node seems like there could be a shortcut here under some circumstances.

apm ships with Atom where node can't be assumed to be installed so this is really just a tool to bundle node with Atom and apm so that apm works from the terminal.

It isn't intended that someone ever runs npm install atom-package-manager directly.

kevinsawicki added a commit that referenced this pull request May 7, 2015
Catch 404 not found case and quit stream before passing zlib empty file
@kevinsawicki
kevinsawicki merged commit 260ec91 into atom:master May 7, 2015
@kevinsawicki

Copy link
Copy Markdown
Contributor

Thanks for fixing this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants