[Python-checkins] r80617 - in python/branches/release26-maint: Lib/tarfile.py Lib/test/test_tarfile.py Misc/NEWS
lars.gustaebel
python-checkins at python.org
Thu Apr 29 17:35:30 CEST 2010
Author: lars.gustaebel
Date: Thu Apr 29 17:35:30 2010
New Revision: 80617
Log:
Merged revisions 80616 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r80616 | lars.gustaebel | 2010-04-29 17:23:38 +0200 (Thu, 29 Apr 2010) | 4 lines
Issue #8464: tarfile.open(name, mode="w|") no longer creates
files with execute permissions set.
........
Modified:
python/branches/release26-maint/ (props changed)
python/branches/release26-maint/Lib/tarfile.py
python/branches/release26-maint/Lib/test/test_tarfile.py
python/branches/release26-maint/Misc/NEWS
Modified: python/branches/release26-maint/Lib/tarfile.py
==============================================================================
--- python/branches/release26-maint/Lib/tarfile.py (original)
+++ python/branches/release26-maint/Lib/tarfile.py Thu Apr 29 17:35:30 2010
@@ -370,7 +370,7 @@
}[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)
Modified: python/branches/release26-maint/Lib/test/test_tarfile.py
==============================================================================
--- python/branches/release26-maint/Lib/test/test_tarfile.py (original)
+++ python/branches/release26-maint/Lib/test/test_tarfile.py Thu Apr 29 17:35:30 2010
@@ -703,6 +703,24 @@
self.assert_(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
Modified: python/branches/release26-maint/Misc/NEWS
==============================================================================
--- python/branches/release26-maint/Misc/NEWS (original)
+++ python/branches/release26-maint/Misc/NEWS Thu Apr 29 17:35:30 2010
@@ -33,6 +33,9 @@
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.
More information about the Python-checkins
mailing list