gh-59999: Add option to preserve permissions in ZipFile.extract#32289
gh-59999: Add option to preserve permissions in ZipFile.extract#32289dignissimus wants to merge 40 commits into
Conversation
|
Thanks for making this. I didn't really get back to my PR after it look a year to be reviewed. What I did differently is that I made preserving the permissions the default. The reason for this is that the unzip command which comes with any Linux distribution, MacOS or BSD system will preserve permissions by default as well. So the user will probably expect that to be the default. |
Sorry, something went wrong.
It's no problem
On the BPO issue (#59999) I proposed not doing this to maintain backwards compatibility |
Sorry, something went wrong.
|
Makes some sense, thanks for clarifying. Keep up the good work! |
Sorry, something went wrong.
|
Running test_zipfile I get two errors: Traceback (most recent call last): FAIL: test_extractall_preserve_none (test.test_zipfile.TestsPermissionExtraction.test_extractall_preserve_none) Ran 274 tests in 94.070s |
Sorry, something went wrong.
|
Ok, interesting. What OS and file system are you running this on? And, do the other test_extract tests pass, or were some of them skipped? And, do tests still fail on 6470201? |
Sorry, something went wrong.
|
I am running Fedora 35. I did a clean start (compiling python from scratch just in case) and ran the test again and got the same result. Other test_extract tests are ok ( except I don't know what you mean by 6470201, I didn't see any tests there. |
Sorry, something went wrong.
Oh of course, they didn't exist in that revision. I've just checked and the default mode for created files differs on Fedora. On CI and my system it's 644 on Fedora it seems to be 664. I'll write the test so it checks against what the default for the system is instead of the 0o644 constant. |
Sorry, something went wrong.
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Éric <merwok@netwok.org>
jaraco
left a comment
There was a problem hiding this comment.
Looks great. I just have a few suggestions, mostly nitpicks.
Sorry, something went wrong.
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
|
(Please follow the devguide: avoid force pushes, they create notifications with broken links for reviewers, and make it harder to see changes compared to previous time. Thanks!) |
Sorry, something went wrong.
|
Seems another look is needed from a reviewer? |
Sorry, something went wrong.
lordmauve
left a comment
There was a problem hiding this comment.
I suggested some improvements, but if we follow @thatch's guidance and only support x bits then &-ing bitfields is not correct; what we would want to do instead is exactly what pip does here and
is_executable = mode and stat.S_ISREG(mode) and mode & 0o111
mode = 0o777 if is_executable else 0o666so that any x bit in u/g/o is extended to 0o111 then ANDed with umask
Sorry, something went wrong.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
Co-authored by Alexey Boriskin
https://bugs.python.org/issue15795
TODO