[issue38822] Inconsistent os.stat behavior for directory with Access Denied

2021-02-21 Thread Eryk Sun
Eryk Sun added the comment: Here's an implementation of attributes_from_dir() that strips trailing slashes (e.g. "C:/spam///" -> "C:/spam"), which entails copying the const string up to the last character that's not a slash. Rooted paths and drive paths that reference a root directory, such

[issue38822] Inconsistent os.stat behavior for directory with Access Denied

2021-02-21 Thread CrouZ
CrouZ added the comment: The problem exists in Python 3.9 as well, and it behaves the same as Python 3.8. Tested with Python 3.9.1. -- versions: +Python 3.9 ___ Python tracker __

[issue38822] Inconsistent os.stat behavior for directory with Access Denied

2021-02-18 Thread Nicholas Sim
Change by Nicholas Sim : -- nosy: +nw0 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.or

[issue38822] Inconsistent os.stat behavior for directory with Access Denied

2021-01-09 Thread CrouZ
CrouZ added the comment: The problem exists in Python 3.8 as well, with the difference that ``os.path.isdir("D:\\System Volume Information\\")`` also returns False. Tested with Python 3.8.2 and 3.8.7. -- versions: +Python 3.8 ___ Python tracker <

[issue38822] Inconsistent os.stat behavior for directory with Access Denied

2019-11-18 Thread Eryk Sun
Eryk Sun added the comment: In attributes_from_dir() in Modules/posixmodule.c, a trailing backslash or slash should be stripped from the lpFileName parameter of FindFirstFileW. Otherwise the call opens the directory via NtOpenFile, instead of opening its parent directory. Even if opening the

[issue38822] Inconsistent os.stat behavior for directory with Access Denied

2019-11-18 Thread Steve Dower
Steve Dower added the comment: I haven't debugged it, but I'm guessing we're not handling the trailing slash properly when falling back to asking the parent directory for information. Looking at the actual stat result for "C:\System Volume Information" vs. "C:\Windows", most of the informati

[issue38822] Inconsistent os.stat behavior for directory with Access Denied

2019-11-16 Thread CrouZ
New submission from CrouZ : After upgrading some scripts from Python 2.7 to 3.7 in Windows 10, I got different behavior that seems to be caused by inconsistent behavior for os.stat in Python 3.7. Python 2.7: >>> os.stat("D:\\System Volume Information") nt.stat_result ... >>> os.stat("D:\\Syst