New submission from Gregory P. Smith <g...@krypto.org>:

======================================================================
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.

----------
messages: 162228
nosy: gregory.p.smith
priority: normal
severity: normal
status: open
title: os.makedirs expect_ok=True test_os failure when directory has S_ISGID 
bit set
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14992>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to