diff options
author | Victor Stinner <vstinner@python.org> | 2020-01-27 17:06:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-27 17:06:42 (GMT) |
commit | 4a46adc7746930c4589ee483cad88d3f8504c045 (patch) | |
tree | e4ab604b79272bcb787ade852c3948bf5549d78d /Lib/test/pythoninfo.py | |
parent | 9e1ed518a576897f914227bf538bac426a02a081 (diff) | |
download | cpython-4a46adc7746930c4589ee483cad88d3f8504c045.zip cpython-4a46adc7746930c4589ee483cad88d3f8504c045.tar.gz cpython-4a46adc7746930c4589ee483cad88d3f8504c045.tar.bz2 |
bpo-39459: test.pythoninfo logs effective uid/gid (GH-18203)
Fix also umask formatting: use octal prefix.
Diffstat (limited to 'Lib/test/pythoninfo.py')
-rw-r--r-- | Lib/test/pythoninfo.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py index eab82c3..cc230dd 100644 --- a/Lib/test/pythoninfo.py +++ b/Lib/test/pythoninfo.py @@ -199,11 +199,19 @@ def collect_os(info_add): ) copy_attributes(info_add, os, 'os.%s', attributes, formatter=format_attr) - call_func(info_add, 'os.getcwd', os, 'getcwd') - - call_func(info_add, 'os.getuid', os, 'getuid') - call_func(info_add, 'os.getgid', os, 'getgid') - call_func(info_add, 'os.uname', os, 'uname') + for func in ( + 'cpu_count', + 'getcwd', + 'getegid', + 'geteuid', + 'getgid', + 'getloadavg', + 'getresgid', + 'getresuid', + 'getuid', + 'uname', + ): + call_func(info_add, 'os.%s' % func, os, func) def format_groups(groups): return ', '.join(map(str, groups)) @@ -220,9 +228,6 @@ def collect_os(info_add): else: info_add("os.login", login) - call_func(info_add, 'os.cpu_count', os, 'cpu_count') - call_func(info_add, 'os.getloadavg', os, 'getloadavg') - # Environment variables used by the stdlib and tests. Don't log the full # environment: filter to list to not leak sensitive information. # @@ -303,7 +308,7 @@ def collect_os(info_add): if hasattr(os, 'umask'): mask = os.umask(0) os.umask(mask) - info_add("os.umask", '%03o' % mask) + info_add("os.umask", '0o%03o' % mask) def collect_pwd(info_add): |