summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tarfile.py
diff options
context:
space:
mode:
authorLars Gustäbel <lars@gustaebel.de>2010-04-29 15:42:25 (GMT)
committerLars Gustäbel <lars@gustaebel.de>2010-04-29 15:42:25 (GMT)
commitf7317f9efcc6a109e702984b595fbf61895285e3 (patch)
treedfb7f03518060c4e13c78f6f793fc188ecb91823 /Lib/test/test_tarfile.py
parent7007d4665f2630c16625c980f82a6aff3364decc (diff)
downloadcpython-f7317f9efcc6a109e702984b595fbf61895285e3.zip
cpython-f7317f9efcc6a109e702984b595fbf61895285e3.tar.gz
cpython-f7317f9efcc6a109e702984b595fbf61895285e3.tar.bz2
Merged revisions 80618 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r80618 | lars.gustaebel | 2010-04-29 17:37:02 +0200 (Thu, 29 Apr 2010) | 10 lines 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 2746448..1a556eb 100644
--- a/Lib/test/test_tarfile.py
+++ b/Lib/test/test_tarfile.py
@@ -702,6 +702,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