-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Description
[*] Starting module at 2019-02-13-17.09.09
Host: linux-mint-19-2
OS: Linux, #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018
Kernel: 4.15.0-20-generic
Traceback (most recent call last):
File "./uptux.py", line 748, in <module>
main()
File "./uptux.py", line 741, in main
check_handler(check, check_name, check_desc)
File "./uptux.py", line 114, in check_handler
check()
File "./uptux.py", line 406, in uptux_check_sysinfo
tee("Current user: {} (UID {} GID {})".format(os.getlogin(),
OSError: [Errno 2] No such file or directory
See: https://bugs.python.org/issue584566
Fix:
diff --git a/uptux.py b/uptux.py
index 70e39c4..41efa8d 100755
--- a/uptux.py
+++ b/uptux.py
@@ -12,6 +12,7 @@ in restricted shells is a pain.
import os
+import pwd
import sys
import argparse
import datetime
@@ -403,7 +404,7 @@ def uptux_check_sysinfo():
tee("Host: {}".format(uname[1]))
tee("OS: {}, {}".format(uname[0], uname[3]))
tee("Kernel: {}".format(uname[2]))
- tee("Current user: {} (UID {} GID {})".format(os.getlogin(),
+ tee("Current user: {} (UID {} GID {})".format(pwd.getpwuid(os.geteuid())[0],
os.getuid(),
os.getgid()))
tee("Member of following groups:\n {}".format(shell_exec('groups')))
Metadata
Metadata
Assignees
Labels
No labels