classification
Title: os.getuid() documentation should be clear on what kind of uid it is referring
Type: behavior Stage: needs patch
Components: Documentation Versions: Python 3.2, Python 3.1, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: adam.woodbeck, docs@python, giampaolo.rodola, r.david.murray
Priority: normal Keywords:

Created on 2010-11-22 13:01 by giampaolo.rodola, last changed 2011-07-21 17:04 by adam.woodbeck.

Messages (4)
msg122117 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) (Python committer) Date: 2010-11-22 13:01
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.
msg122123 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) (Python committer) Date: 2010-11-22 13:42
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.
msg122161 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-11-22 20:17
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'.
msg122165 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) (Python committer) Date: 2010-11-22 20:37
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
History
Date User Action Args
2011-07-21 17:04:57adam.woodbecksetnosy: + adam.woodbeck
2010-11-22 20:37:40giampaolo.rodolasetmessages: + msg122165
2010-11-22 20:17:13r.david.murraysetversions: - Python 2.6
nosy: + r.david.murray

messages: + msg122161

type: behavior
stage: needs patch
2010-11-22 13:42:40giampaolo.rodolasetmessages: + msg122123
2010-11-22 13:01:10giampaolo.rodolacreate