This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author cbrannon
Recipients cbrannon, swarren
Date 2008-07-18.06:15:58
SpamBayes Score 0.010951703
Marked as misclassified No
Message-id <878wvzraia.fsf@cox.net>
In-reply-to <1216353457.17.0.719403197404.issue3394@psf.upfronthosting.co.za> (Stephen Warren's message of "Fri\, 18 Jul 2008 03\:57\:37 +0000")
Content
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:

=====begin=====
#!/bin/sh
mkdir ziptest_dir
echo hello > ziptest_dir/foo.txt
chmod 666 ziptest_dir/foo.txt
zip -r ziptest_file.zip ziptest_dir/
rm -rf ziptest_dir
umask 077
unzip ziptest_file.zip
=====end=====

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!
Files
File name Uploaded
writestr_usable_permissions.diff cbrannon, 2008-07-18.06:15:56
History
Date User Action Args
2008-07-18 06:16:00cbrannonsetspambayes_score: 0.0109517 -> 0.010951703
recipients: + cbrannon, swarren
2008-07-18 06:15:58cbrannonlinkissue3394 messages
2008-07-18 06:15:58cbrannoncreate