chcat is using getlogin() function that sometimes returns null/empty string
Hi,
So apparently gnome-terminal developers have decided to stop updating utmp[0] file and this is breaking chcat -Ll with the following error:
Traceback (most recent call last):
File "/usr/bin/chcat", line 409, in <module>
sys.exit(listusercats(cmds))
File "/usr/bin/chcat", line 352, in listusercats
users.append(os.getlogin())
OSError: [Errno 2] No such file or directory
getlogin(3) manpage suggest to rely on the LOGNAME environment variable, so maybe chcat should fallback to this if getlogin() is not returning anything?
Cheers,
Laurent Bigonville
Quoted 16 lines · Laurent Bigonville
Hi,
So apparently gnome-terminal developers have decided to stop updating utmp[0] file and this is breaking chcat -Ll with the following error:
Traceback (most recent call last):
File "/usr/bin/chcat", line 409, in <module>
sys.exit(listusercats(cmds))
File "/usr/bin/chcat", line 352, in listusercats
users.append(os.getlogin())
OSError: [Errno 2] No such file or directorygetlogin(3) manpage suggest to rely on the LOGNAME environment variable, so maybe chcat should fallback to this if
getlogin()is not returning anything?
Quoted 5 lines
Cheers,
Laurent Bigonville
Maybe just use:
pwd.getpwuid(os.getuid()).pw_name