mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Merged revisions 65235 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r65235 | antoine.pitrou | 2008-07-25 21:42:26 +0200 (ven., 25 juil. 2008) | 3 lines #3394: zipfile.writestr doesn't set external attributes, so files are extracted mode 000 on Unix ........
This commit is contained in:
parent
c2542e986d
commit
6e1df8d0d4
3 changed files with 29 additions and 2 deletions
|
@ -365,6 +365,19 @@ class TestsWithSourceFile(unittest.TestCase):
|
||||||
# remove the test file subdirectories
|
# remove the test file subdirectories
|
||||||
shutil.rmtree(os.path.join(os.getcwd(), 'ziptest2dir'))
|
shutil.rmtree(os.path.join(os.getcwd(), 'ziptest2dir'))
|
||||||
|
|
||||||
|
def zip_test_writestr_permissions(self, f, compression):
|
||||||
|
# Make sure that writestr creates files with mode 0600,
|
||||||
|
# when it is passed a name rather than a ZipInfo instance.
|
||||||
|
|
||||||
|
self.makeTestArchive(f, compression)
|
||||||
|
zipfp = zipfile.ZipFile(f, "r")
|
||||||
|
zinfo = zipfp.getinfo('strfile')
|
||||||
|
self.assertEqual(zinfo.external_attr, 0o600 << 16)
|
||||||
|
|
||||||
|
def test_writestr_permissions(self):
|
||||||
|
for f in (TESTFN2, TemporaryFile(), io.BytesIO()):
|
||||||
|
self.zip_test_writestr_permissions(f, zipfile.ZIP_STORED)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
os.remove(TESTFN)
|
os.remove(TESTFN)
|
||||||
os.remove(TESTFN2)
|
os.remove(TESTFN2)
|
||||||
|
|
|
@ -1075,6 +1075,7 @@ class ZipFile:
|
||||||
zinfo = ZipInfo(filename=zinfo_or_arcname,
|
zinfo = ZipInfo(filename=zinfo_or_arcname,
|
||||||
date_time=time.localtime(time.time())[:6])
|
date_time=time.localtime(time.time())[:6])
|
||||||
zinfo.compress_type = self.compression
|
zinfo.compress_type = self.compression
|
||||||
|
zinfo.external_attr = 0o600 << 16
|
||||||
else:
|
else:
|
||||||
zinfo = zinfo_or_arcname
|
zinfo = zinfo_or_arcname
|
||||||
|
|
||||||
|
|
13
Misc/NEWS
13
Misc/NEWS
|
@ -4,6 +4,19 @@ Python News
|
||||||
|
|
||||||
(editors: check NEWS.help for information about editing NEWS using ReST.)
|
(editors: check NEWS.help for information about editing NEWS using ReST.)
|
||||||
|
|
||||||
|
What's new in Python 3.0b3?
|
||||||
|
===========================
|
||||||
|
|
||||||
|
*Release date: XX-XXX-2008*
|
||||||
|
|
||||||
|
Library
|
||||||
|
-------
|
||||||
|
|
||||||
|
- Issue #3394: zipfile.writestr sets external attributes when passed a
|
||||||
|
file name rather than a ZipInfo instance, so files are extracted with
|
||||||
|
mode 0600 rather than 000 under Unix.
|
||||||
|
|
||||||
|
|
||||||
What's new in Python 3.0b2?
|
What's new in Python 3.0b2?
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue