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.
........
This commit is contained in:
Lars Gustäbel 2010-04-29 15:37:02 +00:00
parent ffa155ad83
commit d6eb70b7b4
3 changed files with 22 additions and 1 deletions

View file

@ -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