-
-
Notifications
You must be signed in to change notification settings - Fork 29.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
os.stat()’s follow_symlinks is a bit ambigously described #96402
Comments
Usually it's taken for granted that symbolic links in the parent path are followed. Otherwise, path parsing would stop on the first symbolic link in the path, but how would one know where it stopped without manually parsing the path? |
FYI, Windows uses filesystem reparse points, which integrate with generalized support for path reparsing in the kernel object namespace. A filesystem reparse point contains reparse data that's identified by a 32-bit tag such as For That said, the At a low level, Windows supports an Footnotes
|
Well in principle yes, but still, I think it wouldn't harm to have it described as precisely as possible. Also one could e.g. imagine some weird behaviour to happen like: Assume
whereas as root:
The (POSIX)
|
Oh and thanks for the elaborate description about the situation on Windows. I personally don't use it, but maybe it would be interesting for others to have that in the description? |
Documentation
There are numerous functions which take a pathname and and argument like
follow_symlinks
.For most of these, the argument
follow_symlinks
is not further explained in the function itself, but people will rather have to resort to https://docs.python.org/3/library/os.html#files-and-directories where things are rather exactly described.However, the description of
os.stat()
has:Which is however only half correct, because what it actually means is:
When the last component of the path is a symbolic link, the function normally follows it. Symbolic links in the path that are not the last component, are always followed.
Similar, the paragraph below for windows, also uses wording that implies any name-surrogate reparse points, i.e. not only if the last pathname component is one.
No idea what Windows does, but if that's also wrong, it should be corrected accordingly. Also in the "Changed in" entry for that.
AFAICS, the other functions of
os
have it correctly described (by simply not describing it).Thanks,
Chris.
The text was updated successfully, but these errors were encountered: