Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hangs on some zip files #10

Closed
satazor opened this issue Feb 2, 2013 · 18 comments
Closed

Hangs on some zip files #10

satazor opened this issue Feb 2, 2013 · 18 comments

Comments

@satazor
Copy link

satazor commented Feb 2, 2013

Here's an example: http://jqueryui.com/resources/download/jquery-ui-1.10.0.custom.zip
CPU is at 100%.

Please note that in older versions, it was giving me signature error. But after upgrading, I'm getting this behaviour.

This bug has been reported in twitter/bower: bower/bower#225

I dunno if this is related to #8, probably is.

@EvanOxfeld
Copy link
Owner

In Node v0.9.6 CPU usage stays under 10%. Unfortunately unzip still hangs after writing AUTHORS.txt from the jquery zip.

@satazor
Copy link
Author

satazor commented Feb 2, 2013

Yes, in node v0.8.1.18 it also extracts AUTHORS.txt, though the CPU usage seems to be higher than the v0.9.8.

@EvanOxfeld
Copy link
Owner

I've tracked down the problem and am working on a fix for unzip to support more zip formats.

Right now unzip only handles zip files that store the compressed / uncompressed file size in the local file header immediately prior to a given file's data. The example jquery zip file stores the compressed and uncompressed file size values after the compressed data rather than in the local file headers.

@satazor
Copy link
Author

satazor commented Feb 3, 2013

Hmm does it still conform to the Zip spec or is it an invalid zip per say?

@EvanOxfeld
Copy link
Owner

It definitely conforms; the Zip spec is just wacky. There's a bit in the file header to signify whether or not the file size will be known at the start of inflation versus following.

@satazor
Copy link
Author

satazor commented Feb 3, 2013

Alright, looking forward to the fix!

@EvanOxfeld
Copy link
Owner

I have a fix that still needs cleanup. I'm targeting getting it published to npm tonight.

@ralphholzmann
Copy link
Contributor

Thanks for the work on this @EvanOxfeld!

@anacronw
Copy link

anacronw commented Feb 5, 2013

thanks!

EvanOxfeld pushed a commit that referenced this issue Feb 6, 2013
Node unzip now handles zips that do not provide
file size information prior to the compressed
data. Current implementation streams through the
compressed data until reaching the 4 byte data
descriptor signature.
@EvanOxfeld
Copy link
Owner

This improvement is in unzip 0.1.3 and works in both Node 0.8 and 0.9. Unzip 0.1.3 should land in NPM shortly if it isn't there already.

In the meantime, please let me know if you run into any issues.

@EvanOxfeld
Copy link
Owner

If you installed unzip 0.1.3 from NPM within the last five hours, please delete it and install it again. You received a much larger archive than you should have - see #11.

@satazor
Copy link
Author

satazor commented Feb 6, 2013

@EvanOxfeld I'm not getting the end or error event when extracting. :(

@satazor
Copy link
Author

satazor commented Feb 6, 2013

In 0.0.4:

  writer.on('close', function() {
    self.emit("end");
    self.emit("close");
  });

In 0.1.x end was removed. Was this intentional?

@EvanOxfeld
Copy link
Owner

@satazor Checking the unzip.Extract stream for the 'close' event is correct. I removed unzip.Extract's 'end' event intentionally to conform to the Writable Stream spec. My understanding is that only streams that are readable should emit 'end' whereas streams that are writable should emit 'finish' and may emit 'close'.

Sorry for the confusion I probably caused, but I'm glad the issue has been resolved in Bower.

@satazor
Copy link
Author

satazor commented Feb 7, 2013

Alright, thank you!

@amakhrov
Copy link

Still hangs on some files (xlsx files produced by MS Office) :
https://dl.dropboxusercontent.com/u/39725868/xlsx.zip

It starts reading the file - 'entry' callback triggers a couple of times. And then hangs, producing 100% cpu load.
Strange enough that the old 0.0.4 version parses this file well.

Thanks

@lazdmx
Copy link

lazdmx commented Aug 18, 2014

Still hangs on some files...

@RonWang
Copy link

RonWang commented Apr 2, 2017

Data point: also still hangs on some files...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants