New submission from Giampaolo Rodola' g.rodola@gmail.com:
http://docs.python.org/library/os.html#os.getuid os.getuid() documentation just states:
Return the current process’s user id.
It is not clear, however, whether "user id" refers to real, effective or saved user id.
As per: http://linux.about.com/library/cmd/blcmdl2_getuid.htm ...it should refer to _real_ user id.
---------- assignee: docs@python components: Documentation messages: 122117 nosy: docs@python, giampaolo.rodola priority: normal severity: normal status: open title: os.getuid() documentation should be clear on what kind of uid it is referring versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue10503 _______________________________________
Giampaolo Rodola' g.rodola@gmail.com added the comment:
Update: I think also os.getlogin() doc is wrong. This is what it states (2.7 doc):
Return the name of the user logged in on the controlling terminal of the process. For most purposes, it is more useful to use the environment variable LOGNAME to find out who the user is, or pwd.getpwuid(os.getuid())[0] to get the login name of the currently effective user id.
Since os.getuid() refers to _real_ uid the last sentence should be changed as such:
- ... to get the login name of the currently effective user id. + ... to get the login name of the currently real user id.
----------
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue10503 _______________________________________
R. David Murray rdmurray@bitdance.com added the comment:
These are wrappers around the posix functions. As such the unix man pages are a better authority than the Python docs :) Still, we could certainly improve the docs.
The getlogin error is probably a miscopy from the man page: the man page on my system shows the example as getpwuid(geteuid()), but it is actually showing a replacement for 'cuserid', not 'getlogin'.
---------- nosy: +r.david.murray stage: -> needs patch type: -> behavior versions: -Python 2.6
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue10503 _______________________________________
Giampaolo Rodola' g.rodola@gmail.com added the comment:
Indeed, now that I google for "getlogin", it's not easy to figure out what kind of user it is supposed to return exactly.
For getuid() it seems pretty clear that we're talking about _real_ uid, though. http://www.manpagez.com/man/2/getuid/ http://linux.die.net/man/2/getuid
----------
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue10503 _______________________________________
Changes by Adam Woodbeck adam.woodbeck@gmail.com:
---------- nosy: +adam.woodbeck
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue10503 _______________________________________
Greg added the comment:
Here's a wording change in the documentation to clarify this.
---------- keywords: +patch nosy: +εσχατοκυριος Added file: http://bugs.python.org/file35514/mywork.patch
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue10503 _______________________________________
Roundup Robot added the comment:
New changeset 19172062e5c0 by Benjamin Peterson in branch '3.4': specify that getuid() returns the real uid (closes #10503) http://hg.python.org/cpython/rev/19172062e5c0
New changeset 6dfbe504f659 by Benjamin Peterson in branch '2.7': specify that getuid() returns the real uid (closes #10503) http://hg.python.org/cpython/rev/6dfbe504f659
New changeset 8866ac6f2269 by Benjamin Peterson in branch 'default': merge 3.4 (#10503) http://hg.python.org/cpython/rev/8866ac6f2269
---------- nosy: +python-dev resolution: -> fixed stage: needs patch -> resolved status: open -> closed
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue10503 _______________________________________