[issue3394] zipfile.writestr doesn't set external attributes, so files are extracted mode 000 on Unix
report at bugs.python.org
Fri Jul 18 08:15:59 CEST 2008
Christopher Brannon <cmbrannon at cox.net> added the comment:
Here is a patch containing code and a unit test. I set external_attr
to 0600, for the following reason.
When I extract with Infozip, my umask is ignored when setting permissions of
extracted entries. They have the permissions assigned to them when archived.
tar does respect umask, but it's not pertinent.
The following shell script demonstrates Infozip's behavior:
echo hello > ziptest_dir/foo.txt
chmod 666 ziptest_dir/foo.txt
zip -r ziptest_file.zip ziptest_dir/
rm -rf ziptest_dir
Setting permissions to 0600 seems like the safest course.
I'm not sure if this patch should be accompanied by some documentation,
since the zipfile docs don't say much about external_attr or permissions.
PS. My earlier comments about timestamps were incorrect and spurious!
Added file: http://bugs.python.org/file10933/writestr_usable_permissions.diff
Python tracker <report at bugs.python.org>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the Python-bugs-list