This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gregory.p.smith
Recipients gregory.p.smith
Date 2012-06-03.19:16:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1338750994.84.0.984038556909.issue14992@psf.upfronthosting.co.za>
In-reply-to
Content
======================================================================
ERROR: test_exist_ok_existing_directory (__main__.MakedirTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_os.py", line 842, in test_exist_ok_existing_directory
    os.makedirs(path, mode=mode, exist_ok=True)
  File "/home/greg/sandbox/python/cpython/default/Lib/os.py", line 161, in makedirs
    mkdir(name, mode)
FileExistsError: [Errno 17] File exists (mode 0o2755 != desired mode 0o755): '@test_4027_tmp/dir1'

(I modified os.makedirs to add the info on the mode differences above to highlight the source of the problem)

0o2000 is the S_ISGID bit on a directory which is a "contagious" bit that is automatically copied onto subdirectories.  os.makedirs is not expecting to find it so exist_ok does not work as desired.

Workaround: Don't run the Python test suite from a directory with that bit set.

I think the os.makedirs() behavior should be to ignore bits that can appear regardless of the umask as it makes exist_ok=True useless in that situation.
History
Date User Action Args
2012-06-03 19:16:34gregory.p.smithsetrecipients: + gregory.p.smith
2012-06-03 19:16:34gregory.p.smithsetmessageid: <1338750994.84.0.984038556909.issue14992@psf.upfronthosting.co.za>
2012-06-03 19:16:34gregory.p.smithlinkissue14992 messages
2012-06-03 19:16:33gregory.p.smithcreate