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.getlogin should use the DISPLAY and not the tty #45159
Comments
Hi, I have the following with gramps on kubuntu ( KDE ). In these case, os.getlogin() return : I think getlogin should use the DISPLAY instead of the tty when we get this error. to correct this problem I use : try: but I'm not sure os.environ.get return the good value on every OSes ... I have tested too : What is the best solution to this problem. I looked at all bugs about getlogin and I saw we should avoid this function. |
os.getlogin is a wrapper around the getlogin(3) POSIX function. It is important that Python exposes the function as-is, rather than trying to be more clever than the operating system designers. getlogin(3) is specified as "getlogin() returns a pointer to a string containing the name of the user logged in on the controlling terminal of the process, or a null pointer if this information cannot be determined." See the man page for the precise list of error conditions; ENOENT is returned if there is no utmp entry. Whether konsole is correct in not listing the controlling terminal in utmp, I don't know. Notice that xterm (which should be considered an authority in such matters) *does* create an utmp entry. It's not clear to me how DISPLAY could be used at all, but even if it could, using it here would be incorrect. Closing as invalid. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: