guzba / zippy

Pure Nim implementation of deflate, zlib, gzip and zip.
MIT License
246 stars 29 forks source link

Preserve permissions when untarring and unzipping #32

Closed iffy closed 2 years ago

iffy commented 2 years ago
guzba commented 2 years ago

Thanks for PR! Looks good. I will confirm Windows locally too and also look into default permissions when composing a new zip / tar programmatically.

guzba commented 2 years ago

Currently, all files extracted from some of my test zips on Windows end up as read only (setPermissions with no fpUserWrite). Zip file permissions also generally appear to be absent or ignored by Windows even if present (only work on Unix). This complicates the behavior needed by Zippy when extracting a .zip from Windows on Mac or Linux for since it will currently appear to have no permissions.

guzba commented 2 years ago

On the tarball front, my Nim-1.4.2.tar.gz which I've used for testing only has {fpGroupWrite, fpGroupRead, fpOthersWrite, fpOthersRead} on many (all?) files, whcih does not include the fpUserWrite permission. This results in Windows making all the files read only.

On Windows, only the readonly flag is changed, depending on fpUserWrite permission. https://nim-lang.org/docs/os.html#setFilePermissions%2Cstring%2Cset%5BFilePermission%5D

guzba commented 2 years ago

I think https://github.com/guzba/zippy/commit/4d1fb10f7a2ffe00b3c245ac0087c6a4886af3a8 resolves the .zip side.

guzba commented 2 years ago

I think #head now has zip and tar ok on Windows.

guzba commented 2 years ago

Changes released in zippy 0.7.1

iffy commented 2 years ago

Thanks for the quick turnaround!