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 swarren
Recipients swarren
Date 2008-07-17.19:01:31
SpamBayes Score 0.00087565446
Marked as misclassified No
Message-id <1216321293.73.0.655472661841.issue3394@psf.upfronthosting.co.za>
In-reply-to
Content
Run the following Python script, on Unix/Linux:

==========
import zipfile

z = zipfile.ZipFile('zipbad.zip', 'w')
z.writestr('filebad.txt', 'Some content')
z.close()

z = zipfile.ZipFile('zipgood.zip', 'w')
zi = zipfile.ZipInfo('filegood.txt')
zi.external_attr = 0660 << 16L
z.writestr(zi, 'Some content')
z.close()
==========

Like this:

python testzip.py  && unzip zipbad.zip && unzip zipgood.zip && ls -l
file*.txt

You'll see:

----------  1 swarren swarren   12 2008-07-17 12:54 filebad.txt
-rw-rw----  1 swarren swarren   12 1980-01-01 00:00 filegood.txt

Note that filebad.txt is extracted with mode 000.

The WAR (used for filegood.txt) is to pass writestr a ZipInfo class with
external_attr pre-initialized. However, writestr should perform this
assignment itself, to be consistent with write. I haven't checked, but
there's probably a bunch of other stuff in write that writestr should do
too.
History
Date User Action Args
2008-07-17 19:01:34swarrensetspambayes_score: 0.000875654 -> 0.00087565446
recipients: + swarren
2008-07-17 19:01:33swarrensetspambayes_score: 0.000875654 -> 0.000875654
messageid: <1216321293.73.0.655472661841.issue3394@psf.upfronthosting.co.za>
2008-07-17 19:01:32swarrenlinkissue3394 messages
2008-07-17 19:01:31swarrencreate