mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	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.
  ........
................
			
			
This commit is contained in:
		
							parent
							
								
									7007d4665f
								
							
						
					
					
						commit
						f7317f9efc
					
				
					 3 changed files with 22 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -349,7 +349,7 @@ def __init__(self, name, mode):
 | 
			
		|||
        }[mode]
 | 
			
		||||
        if hasattr(os, "O_BINARY"):
 | 
			
		||||
            mode |= os.O_BINARY
 | 
			
		||||
        self.fd = os.open(name, mode)
 | 
			
		||||
        self.fd = os.open(name, mode, 0o666)
 | 
			
		||||
 | 
			
		||||
    def close(self):
 | 
			
		||||
        os.close(self.fd)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -702,6 +702,24 @@ def test_stream_padding(self):
 | 
			
		|||
        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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,6 +40,9 @@ Core and Builtins
 | 
			
		|||
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.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue