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.

classification
Title: os.stat() does not mention that it follow symlinks by default
Type: behavior Stage: resolved
Components: Documentation Versions:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: r.david.murray Nosy List: docs@python, godfryd, r.david.murray, socketpair
Priority: normal Keywords: patch

Created on 2011-01-20 17:28 by socketpair, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
improved-lstat-doc-patch.diff godfryd, 2011-01-23 07:54
improved-lstat-doc-patch-v2.diff godfryd, 2011-01-23 21:14
Messages (7)
msg126631 - (view) Author: Марк Коренберг (socketpair) * Date: 2011-01-20 17:28
Documentation should say about 'following symlink' in this function. Documentation should advice to use os.lstat() in case when it needed.
msg126789 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-01-21 22:08
I almost closed this as invalid, since the name is, after all 'os.stat' and the docs clearly say that it calls the 'stat' system call.  However, I see that our docs do not contain the more explicit language used by the 'stat' system call docs: "stats the file pointed to by path".  Although even that isn't crystal clear unless you also read the definition of 'lstat' right below it.  If you read our docs for lstat it does become clear even as things stand, but lstat isn't right below stat in our docs.

So on reflection I think the docs could use improvement in this area.
msg126826 - (view) Author: Марк Коренберг (socketpair) * Date: 2011-01-22 09:50
Yes, os.stat and os.lstat should be one after next in docs. Also IMHO, they should have cross-references. See excellent php docs for example.
msg126878 - (view) Author: Michal Nowikowski (godfryd) Date: 2011-01-23 07:54
I improved a little bit lstat function description and added note to stat function. 

I see that links :func:`stat` do not lead to stat function but to stat module. Is it Sphinx bug? In my changes I made explicit link to os.stat function.
msg126892 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-01-23 16:02
I don't think Georg considers it a bug in Sphinx, it's just how the disambiguation machinery works.  You can write :func:`~os.stat` if you want the link text to just be 'stat' but the link to be to 'os.stat'.

I don't think the addition to lstat is either helpful or needed.  The addition to stat, which is needed, I don't think should be a note, but rather an inline comment early in the documentation paragraph.

Thanks for working on this.
msg126899 - (view) Author: Michal Nowikowski (godfryd) Date: 2011-01-23 21:14
The patch v2:
- in description of os.stat function added information about following symlinks,
- made list of returned attributes by os.stat function more readable,
- fixed links to os.stat function in whole document.
msg126946 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-01-24 19:38
Thanks.

Committed a modified version of the patch in r88164.  I extended your breakout of the attributes to the other paragraphs, and reorganized the order of the paragraphs in the stat docs to put things into a more logical order (I hope).  I decided to change the existing wording about the stat system call to reflect the fact that we aren't making a stat system call on Windows, and did something similar in the lstat entry.

This will get backported to the 2.7 docs (and 3.1) presently, but not right away.
History
Date User Action Args
2022-04-11 14:57:11adminsetgithub: 55169
2011-01-24 19:38:32r.david.murraysetstatus: open -> closed

messages: + msg126946
nosy: r.david.murray, docs@python, socketpair, godfryd
stage: needs patch -> resolved
2011-01-24 19:09:37r.david.murraysetassignee: docs@python -> r.david.murray
nosy: r.david.murray, docs@python, socketpair, godfryd
2011-01-23 21:14:04godfrydsetfiles: + improved-lstat-doc-patch-v2.diff
nosy: r.david.murray, docs@python, socketpair, godfryd
messages: + msg126899
2011-01-23 16:02:19r.david.murraysetnosy: r.david.murray, docs@python, socketpair, godfryd
messages: + msg126892
2011-01-23 07:54:32godfrydsetfiles: + improved-lstat-doc-patch.diff

nosy: + godfryd
messages: + msg126878

keywords: + patch
2011-01-22 09:50:22socketpairsetnosy: r.david.murray, docs@python, socketpair
messages: + msg126826
2011-01-21 22:08:41r.david.murraysetnosy: + r.david.murray

messages: + msg126789
stage: needs patch
2011-01-20 17:28:04socketpaircreate