-
Notifications
You must be signed in to change notification settings - Fork 221
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
Zip file permissions obtained from stat incorrect/inconsistent on Windows #136
Comments
thanks for the research on this. will do some testing this weekend. |
Any progress on this issue? Line 200:
This way, directories get all rights (notice that 777 is unsafe, but you can change it to any number you want). |
Thanks for the tip as hotfix this works for me: lotterfriends@a250395 |
You can find another possible workaround here: https://github.com/Tim-B/grunt-aws-lambda/blob/master/tasks/lambda_package.js#L77 It doesn't require you to maintain a separate copy of node-archiver that way, although you'd probably still want to lock your version. |
is there a reason that something like: 493 (0755) wouldnt work here. it seems like a safer default. |
ive been going back and forth on how to best handle this which on top of a busy schedule delayed any fix in 0.15.0. ive put in a temporary fix in 0.15.1 which will force mode to 0755 (saner than 0777 imho) for directory modes that are provided by stat. this was after spending an hour trying to come up with a bitwise to enforce minimum of 0755 but its easier said than done compared to 0777. if someone comes up with a reliable bitwise statement, im happy to try it out but otherwise i think this solution will address the issue and prevent the need for hacking archiver for an oddity in cross platform stat. |
Thanks for your fix and feedback. I'm glad to use your version again :) |
There was an issue in the archiver module fixed in v0.15.1, which can cause file permissions issues on windows: archiverjs/node-archiver#136 archiverjs/node-archiver#137
I've been investigating an issue on one of my own projects reported by Windows users, which I've been testing in a Windows VM and I think I've narrowed down the issue.
If you use .bulk() it obtains file permissions via stat, but on Windows these values seem incorrect.
Here's the output of a very simple example zip run through zipinfo:
When generated from Ubuntu:
When generated from Windows:
Note that the directories on Windows don't have the execute bit set, which causes problems on some systems which extract them.
I did some further debugging and printed some debugging information around the stat code and noticed the following:
For a directory:
Which is what you'd expect seeing as
16822 & 0777
is 438 which is110110110
in binary, ie. 666 in octal.Here's some files to help you replicate the issue:
The text was updated successfully, but these errors were encountered: