Amos S <amos.shap...@gmail.com> added the comment:

The use of environment variables like USER and LOGNAME instead of getuid() etc 
is done in order to try to get "who really initiated this process?" rather than 
"who this process belongs to?". This is hidden today when SUDO_USER is ignored.

This also fits my interpretation of the function's documentation: 'Return the 
"login name" of the user.'

For instance, in a system I use I have to sudo to a system user other than root 
in order to execute certain scripts and this patch would reveal the original 
user who executed the sudo command.

I updated the test case already in the existing PR.

I update to the documentation to list SUDO_USER.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34709>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to