[Python-Dev] Strange umask(?)/st_mode issue

Steve Dower steve.dower at python.org
Fri Mar 29 19:26:24 EDT 2019


Hi

I'm trying to track down the cause of the failed Linux tests on this 
build (it's also been happening on random PR builds for the last day or 
two, but this is the first I've seen it happen on already merged code):

https://dev.azure.com/Python/cpython/_build/results?buildId=40189

One of the failed tests is this one from test_tarfile.py (and I think 
this is representative of the others):

def test_file_mode(self):
     # Test for issue #8464: Create files with correct
     # permissions.
     if os.path.exists(tmpname):
         support.unlink(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)

It's failing because the mode of the new TAR file is 0o666 rather than 
0o644. I'd guess that this means the umask() call is not having effect? 
But honestly this is beyond me - I don't have any idea what would cause 
Python to ignore that, and I don't see anything in the commit history 
that could be at fault.

I'm hoping someone can tell me that it's definitely a platform 
configuration issue or it's definitely interference between two of our 
tests (which run in random order, which would explain the intermittent 
nature of this, but I haven't spotted any tests that seem likely either).

To see the other failed PR builds, the full list is at 
https://dev.azure.com/Python/cpython/_build?definitionId=9 and most of 
the ones from today have failed because of whatever is causing it.

Any help?

Thanks,
Steve


More information about the Python-Dev mailing list