summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tarfile.py
diff options
context:
space:
mode:
authorLars Gustäbel <lars@gustaebel.de>2010-04-29 15:37:02 (GMT)
committerLars Gustäbel <lars@gustaebel.de>2010-04-29 15:37:02 (GMT)
commitd6eb70b7b4569cfd16f5deb42c748c439c63a008 (patch)
tree8caf490097ef53dd23205feb5bb047f0fd488b05 /Lib/test/test_tarfile.py
parentffa155ad83ac40c3eeb55cbe8fe16a304a23cfe1 (diff)
downloadcpython-d6eb70b7b4569cfd16f5deb42c748c439c63a008.zip
cpython-d6eb70b7b4569cfd16f5deb42c748c439c63a008.tar.gz
cpython-d6eb70b7b4569cfd16f5deb42c748c439c63a008.tar.bz2
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. ........
Diffstat (limited to 'Lib/test/test_tarfile.py')
-rw-r--r--Lib/test/test_tarfile.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
index ff04ef8..43527ef 100644
--- a/Lib/test/test_tarfile.py
+++ b/Lib/test/test_tarfile.py
@@ -846,6 +846,24 @@ class StreamWriteTest(WriteTestBase):
self.assertTrue(data.count(b"\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(0o022)
+ try:
+ tar = tarfile.open(tmpname, self.mode)
+ tar.close()
+ mode = os.stat(tmpname).st_mode & 0o777
+ self.assertEqual(mode, 0o644, "wrong file permissions")
+ finally:
+ os.umask(original_umask)
+
class GNUWriteTest(unittest.TestCase):
# This testcase checks for correct creation of GNU Longname