Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
5fdfa3e3
Commit
5fdfa3e3
authored
Jul 25, 2008
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#3394: zipfile.writestr doesn't set external attributes, so files are extracted mode 000 on Unix
parent
8c664e86
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
0 deletions
+18
-0
Lib/test/test_zipfile.py
Lib/test/test_zipfile.py
+13
-0
Lib/zipfile.py
Lib/zipfile.py
+1
-0
Misc/NEWS
Misc/NEWS
+4
-0
No files found.
Lib/test/test_zipfile.py
View file @
5fdfa3e3
...
...
@@ -372,6 +372,19 @@ class TestsWithSourceFile(unittest.TestCase):
# remove the test file subdirectories
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
,
0600
<<
16
)
def
test_writestr_permissions
(
self
):
for
f
in
(
TESTFN2
,
TemporaryFile
(),
StringIO
()):
self
.
zip_test_writestr_permissions
(
f
,
zipfile
.
ZIP_STORED
)
def
tearDown
(
self
):
os
.
remove
(
TESTFN
)
os
.
remove
(
TESTFN2
)
...
...
Lib/zipfile.py
View file @
5fdfa3e3
...
...
@@ -1064,6 +1064,7 @@ class ZipFile:
zinfo
=
ZipInfo
(
filename
=
zinfo_or_arcname
,
date_time
=
time
.
localtime
(
time
.
time
())[:
6
])
zinfo
.
compress_type
=
self
.
compression
zinfo
.
external_attr
=
0600
<<
16
else
:
zinfo
=
zinfo_or_arcname
...
...
Misc/NEWS
View file @
5fdfa3e3
...
...
@@ -44,6 +44,10 @@ Library
- Deprecate the sunaudio module for removal in Python 3.0.
- 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 2.6 beta 2?
================================
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment