This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test.test_subprocess.POSIXProcessTestCase.test_user fails in the limited build environment
Type: Stage: resolved
Components: Tests Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: mcepl, vstinner
Priority: normal Keywords: patch

Created on 2020-03-04 19:21 by mcepl, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18781 merged vstinner, 2020-03-04 22:03
Messages (3)
msg363380 - (view) Author: Matej Cepl (mcepl) * Date: 2020-03-04 19:21
When testing Python from Python-3.9.0a3.tar.xz two test cases file in the limited build environment for openSUSE. We have very limited number of users there:

stitny:/home/abuild/rpmbuild/BUILD/Python-3.9.0a3 # cat /etc/passwd 
root:x:0:0:root:/root:/bin/bash
abuild:x:399:399:Autobuild:/home/abuild:/bin/bash
stitny:/home/abuild/rpmbuild/BUILD/Python-3.9.0a3 #

So, tests which expect existence of the user 'nobody' fail:

[  747s] ======================================================================
[  747s] ERROR: test_user (test.test_subprocess.POSIXProcessTestCase) (user='nobody', close_fds=False)
[  747s] ----------------------------------------------------------------------
[  747s] Traceback (most recent call last):
[  747s]   File "/home/abuild/rpmbuild/BUILD/Python-3.9.0a3/Lib/test/test_subprocess.py", line 1805, in test_user
[  747s]     output = subprocess.check_output(
[  747s]   File "/home/abuild/rpmbuild/BUILD/Python-3.9.0a3/Lib/subprocess.py", line 419, in check_output
[  747s]     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
[  747s]   File "/home/abuild/rpmbuild/BUILD/Python-3.9.0a3/Lib/subprocess.py", line 510, in run
[  747s]     with Popen(*popenargs, **kwargs) as process:
[  747s]   File "/home/abuild/rpmbuild/BUILD/Python-3.9.0a3/Lib/subprocess.py", line 929, in __init__
[  747s]     uid = pwd.getpwnam(user).pw_uid
[  747s] KeyError: "getpwnam(): name not found: 'nobody'"
[  747s] 
[  747s] ======================================================================
[  747s] ERROR: test_user (test.test_subprocess.POSIXProcessTestCase) (user='nobody', close_fds=True)
[  747s] ----------------------------------------------------------------------
[  747s] Traceback (most recent call last):
[  747s]   File "/home/abuild/rpmbuild/BUILD/Python-3.9.0a3/Lib/test/test_subprocess.py", line 1805, in test_user
[  747s]     output = subprocess.check_output(
[  747s]   File "/home/abuild/rpmbuild/BUILD/Python-3.9.0a3/Lib/subprocess.py", line 419, in check_output
[  747s]     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
[  747s]   File "/home/abuild/rpmbuild/BUILD/Python-3.9.0a3/Lib/subprocess.py", line 510, in run
[  747s]     with Popen(*popenargs, **kwargs) as process:
[  747s]   File "/home/abuild/rpmbuild/BUILD/Python-3.9.0a3/Lib/subprocess.py", line 929, in __init__
[  747s]     uid = pwd.getpwnam(user).pw_uid
[  747s] KeyError: "getpwnam(): name not found: 'nobody'"
[  747s] 
[  747s] ----------------------------------------------------------------------
[  747s]

I am not sure what is the proper solution here. Whether test should be skipped if nobody doesn’t exist, or the test should switch to user 0, or the current user?
msg363431 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-05 13:29
New changeset f7b5d419bf871d9cc898982c7b6b4c043f7d5e9d by Victor Stinner in branch 'master':
bpo-39855: Fix test_subprocess if nobody user doesn't exist (GH-18781)
https://github.com/python/cpython/commit/f7b5d419bf871d9cc898982c7b6b4c043f7d5e9d
msg363432 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-05 13:30
Python 3.8 is not affected. I close the issue.
History
Date User Action Args
2022-04-11 14:59:27adminsetgithub: 84036
2020-03-05 13:30:17vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg363432

stage: patch review -> resolved
2020-03-05 13:29:02vstinnersetmessages: + msg363431
2020-03-04 22:03:55vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request18139
2020-03-04 19:21:51mceplcreate