Skip to content
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

test.test_subprocess.POSIXProcessTestCase.test_user fails in the limited build environment #84036

Closed
mcepl mannequin opened this issue Mar 4, 2020 · 3 comments
Closed
Labels
3.9 only security fixes tests Tests in the Lib/test dir

Comments

@mcepl
Copy link
Mannequin

mcepl mannequin commented Mar 4, 2020

BPO 39855
Nosy @vstinner, @mcepl
PRs
  • bpo-39855: Fix test_subprocess if nobody user doesn't exist #18781
  • 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:

    assignee = None
    closed_at = <Date 2020-03-05.13:30:17.941>
    created_at = <Date 2020-03-04.19:21:51.736>
    labels = ['tests', '3.9']
    title = 'test.test_subprocess.POSIXProcessTestCase.test_user fails in the limited build environment'
    updated_at = <Date 2020-03-05.13:30:17.940>
    user = 'https://github.com/mcepl'

    bugs.python.org fields:

    activity = <Date 2020-03-05.13:30:17.940>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-03-05.13:30:17.941>
    closer = 'vstinner'
    components = ['Tests']
    creation = <Date 2020-03-04.19:21:51.736>
    creator = 'mcepl'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 39855
    keywords = ['patch']
    message_count = 3.0
    messages = ['363380', '363431', '363432']
    nosy_count = 2.0
    nosy_names = ['vstinner', 'mcepl']
    pr_nums = ['18781']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue39855'
    versions = ['Python 3.9']

    @mcepl
    Copy link
    Mannequin Author

    mcepl mannequin commented Mar 4, 2020

    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?

    @mcepl mcepl mannequin added 3.9 only security fixes tests Tests in the Lib/test dir labels Mar 4, 2020
    @vstinner
    Copy link
    Member

    vstinner commented Mar 5, 2020

    New changeset f7b5d41 by Victor Stinner in branch 'master':
    bpo-39855: Fix test_subprocess if nobody user doesn't exist (GH-18781)
    f7b5d41

    @vstinner
    Copy link
    Member

    vstinner commented Mar 5, 2020

    Python 3.8 is not affected. I close the issue.

    @vstinner vstinner closed this as completed Mar 5, 2020
    @vstinner vstinner closed this as completed Mar 5, 2020
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes tests Tests in the Lib/test dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant