[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-19 Thread Roundup Robot
Roundup Robot added the comment: New changeset 05d6ddf2b7c2 by Martin Panter in branch '3.4': Issue #25583: Avoid incorrect errors raised by os.makedirs(exist_ok=True) https://hg.python.org/cpython/rev/05d6ddf2b7c2 New changeset 515f76bf1254 by Martin Panter in branch '3.5': Issue #25583: Merge

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-19 Thread Martin Panter
Martin Panter added the comment: None of the Windows buildbots are failing my particular test. There are other failures, but they look unrelated, so I am calling this fixed. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-14 Thread Daniel Plachotich
Daniel Plachotich added the comment: Looks good to me. Without the fix, the test fails on Windows 7 as expected. -- ___ Python tracker ___

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-13 Thread Martin Panter
Martin Panter added the comment: New patch with simpler test case and revised NEWS entry -- Added file: http://bugs.python.org/file41036/makedirs-exist.2.patch ___ Python tracker

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-10 Thread Daniel Plachotich
Daniel Plachotich added the comment: Yes, it's probably a better solution. If had been more careful, I wouldn't have scribbled so much text here :) . But is there any sense in adding Windows-specific test with EACCES since the problem with errno may affect other platforms as well (at least in

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-10 Thread Martin Panter
Martin Panter added the comment: It is good to add a regression test for any bug if it’s not too hard. Yes this is not a Windows-only issue, but I understand it is much simpler to produce with Windows. Otherwise you need a special file system setup and a more obscure OS. Please review my

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-09 Thread Daniel Plachotich
Daniel Plachotich added the comment: You mean msg254341? As I mentioned recently, it still will raise an exception in case of EROFS, ENOSPC and possibly other values, which, as in the case with Windows, can be quite unexpected depending on platform and circumstances. Of course there is no

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-09 Thread Martin Panter
Martin Panter added the comment: Yes that looks like an improvement, though I wonder what’s wrong with your original proposal (performance maybe?). In any case, it definitely needs a comment explaining the first isdir() avoids competing failures that mask EEXIST, and the exception handling

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-09 Thread Daniel Plachotich
Daniel Plachotich added the comment: Maybe the solution is to leave OSError catching after the conditional (probably with some additional comments): if not (exist_ok and path.isdir(name)): try: mkdir(name, mode) except OSError as e: if not exist_ok or e.errno

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-08 Thread Daniel Plachotich
New submission from Daniel Plachotich: Since Windows 7 (or even Vista), Windows gives permission error(5, ERROR_ACCESS_DENIED if you try to create a directory in a drive root with the same name as a drive itself, even if you have administrative permissions. This behavior is not mentioned in

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-08 Thread Daniel Plachotich
Daniel Plachotich added the comment: Probably better solution: if not (exist_ok and path.isdir(name) and e.errno in (errno.EEXIST, errno.EACCES)): -- ___ Python tracker

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-08 Thread Daniel Plachotich
Daniel Plachotich added the comment: Of course in examples I create '.' by hand, but in real code such things are mostly automatic. Assume, for example, that you have a function for downloading files: def download_file(url, save_as): ... # Before saving, you must ensure that path exists:

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-08 Thread Daniel Plachotich
Daniel Plachotich added the comment: I meant x1.3 times faster on Linux :) -- ___ Python tracker ___ ___

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-08 Thread Daniel Plachotich
Daniel Plachotich added the comment: Of course, exist_ok must be taken into account: if not (exist_ok and path.isdir(name)): mkdir(name, mode) -- ___ Python tracker

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-08 Thread R. David Murray
R. David Murray added the comment: If you are trying to create a directory named '.' your code will not do anything useful, you might as well skip the call. What's the use case? That said, the fix looks reasonable. -- nosy: +r.david.murray ___

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-08 Thread Martin Panter
Martin Panter added the comment: Daniel: your latest suggestions look like they introduce a race condition. What happens if another thread or process, perhaps also calling makedirs(), creates the directory just after isdir() says it doesn’t exist? Similar to Issue 1608579. Perhaps the