diff options
author | Lars Gustäbel <lars@gustaebel.de> | 2010-04-29 15:23:38 (GMT) |
---|---|---|
committer | Lars Gustäbel <lars@gustaebel.de> | 2010-04-29 15:23:38 (GMT) |
commit | 5c4c4619b0144684a1309de746809879b04848fa (patch) | |
tree | 08f2fcf3ff8663c649f142b71382a5e0620b8d52 /Lib/test/test_tarfile.py | |
parent | f56a288b1e59cc260372f32665a209d381be404b (diff) | |
download | cpython-5c4c4619b0144684a1309de746809879b04848fa.zip cpython-5c4c4619b0144684a1309de746809879b04848fa.tar.gz cpython-5c4c4619b0144684a1309de746809879b04848fa.tar.bz2 |
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.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index eb368cf..52d6ab3 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -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 |