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
5c4c4619
Commit
5c4c4619
authored
Apr 29, 2010
by
Lars Gustäbel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #8464: tarfile.open(name, mode="w|") no longer creates
files with execute permissions set.
parent
f56a288b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
Lib/tarfile.py
Lib/tarfile.py
+1
-1
Lib/test/test_tarfile.py
Lib/test/test_tarfile.py
+18
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/tarfile.py
View file @
5c4c4619
...
...
@@ -380,7 +380,7 @@ class _LowLevelFile:
}[
mode
]
if
hasattr
(
os
,
"O_BINARY"
):
mode
|=
os
.
O_BINARY
self
.
fd
=
os
.
open
(
name
,
mode
)
self
.
fd
=
os
.
open
(
name
,
mode
,
0666
)
def
close
(
self
):
os
.
close
(
self
.
fd
)
...
...
Lib/test/test_tarfile.py
View file @
5c4c4619
...
...
@@ -847,6 +847,24 @@ class StreamWriteTest(WriteTestBase):
self
.
assertTrue
(
data
.
count
(
"
\
0
"
)
==
tarfile
.
RECORDSIZE
,
"incorrect zero padding"
)
def
test_file_mode
(
self
):
# Test for issue #8464: Create files with correct
# permissions.
if
sys
.
platform
==
"win32"
or
not
hasattr
(
os
,
"umask"
):
return
if
os
.
path
.
exists
(
tmpname
):
os
.
remove
(
tmpname
)
original_umask
=
os
.
umask
(
0022
)
try
:
tar
=
tarfile
.
open
(
tmpname
,
self
.
mode
)
tar
.
close
()
mode
=
os
.
stat
(
tmpname
).
st_mode
&
0777
self
.
assertEqual
(
mode
,
0644
,
"wrong file permissions"
)
finally
:
os
.
umask
(
original_umask
)
class
GNUWriteTest
(
unittest
.
TestCase
):
# This testcase checks for correct creation of GNU Longname
...
...
Misc/NEWS
View file @
5c4c4619
...
...
@@ -31,6 +31,9 @@ Core and Builtins
Library
-------
- Issue #8464: tarfile no longer creates files with execute permissions set
when mode="w|" is used.
- Issue #7834: Fix connect() of Bluetooth L2CAP sockets with recent versions
of the Linux kernel. Patch by Yaniv Aknin.
...
...
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