Skip to content

test_import: test_unwritable_module() fails on AMD64 Fedora Stable Clang Installed 3.x #83640

Closed

Description

@vstinner
BPO 39459
Nosy @brettcannon, @vstinner, @DinoV
PRs
  • bpo-39459: test.pythoninfo logs effective uid/gid #18203
  • Add unwritable test package to list of library files to fix bpo-39459 #18211
  • bpo-39459: include missing test files in windows installer too #18241
  • 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-01-27.23:08:32.899>
    created_at = <Date 2020-01-27.09:19:04.597>
    labels = ['tests', '3.9']
    title = 'test_import: test_unwritable_module() fails on AMD64 Fedora Stable Clang Installed 3.x'
    updated_at = <Date 2020-01-28.22:16:12.795>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2020-01-28.22:16:12.795>
    actor = 'dino.viehland'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-01-27.23:08:32.899>
    closer = 'dino.viehland'
    components = ['Tests']
    creation = <Date 2020-01-27.09:19:04.597>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 39459
    keywords = ['patch']
    message_count = 18.0
    messages = ['360743', '360744', '360746', '360776', '360778', '360781', '360789', '360792', '360796', '360797', '360820', '360831', '360833', '360891', '360902', '360903', '360904', '360907']
    nosy_count = 3.0
    nosy_names = ['brett.cannon', 'vstinner', 'dino.viehland']
    pr_nums = ['18203', '18211', '18241']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue39459'
    versions = ['Python 3.9']

    Activity

    1. vstinner commented on Jan 27, 2020

      @vstinner
      MemberAuthor

      AMD64 Fedora Stable Clang Installed 3.x:
      https://buildbot.python.org/all/#/builders/127/builds/212

      test_unwritable_module (test.test_import.CircularImportTests) ... ERROR

      ======================================================================
      ERROR: test_unwritable_module (test.test_import.CircularImportTests)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.clang-installed/build/target/lib/python3.9/test/test_import/__init__.py", line 1347, in test_unwritable_module
          import test.test_import.data.unwritable as unwritable
      ModuleNotFoundError: No module named 'test.test_import.data.unwritable'
    2. vstinner commented on Jan 27, 2020

      @vstinner
      MemberAuthor

      Test added in bpo-39336 by:

      commit 9b6fec4
      Author: Dino Viehland <dinoviehland@gmail.com>
      Date: Wed Jan 22 16:42:38 2020 -0800

      bpo-39336: Allow packages to not let their child modules be set on them (bpo-18006)
      
      * bpo-39336: Allow setattr to fail on modules which aren't assignable
      
      When attaching a child module to a package if the object in sys.modules raises an Attribu
      

      teError (e.g. because it is immutable) it causes the whole import to fail. This now allows i
      mmutable packages to exist and an ImportWarning is reported and the AttributeError exception
      is ignored.

    3. vstinner commented on Jan 27, 2020

      @vstinner
      MemberAuthor

      Same error on x86 Gentoo Installed with X 3.x:
      https://buildbot.python.org/all/#/builders/128/builds/204

    4. vstinner commented on Jan 27, 2020

      @vstinner
      MemberAuthor

      Issue also seen when building Python 3.9.0a3 on Fedora Rawhide:
      https://src.fedoraproject.org/rpms/python39/pull-request/16

      Logs: https://jenkins-continuous-infra.apps.ci.centos.org/job/fedora-rawhide-pr-pipeline/2558/artifact/package-tests/logs/console.log

      pythoninfo:

      CC.version: gcc (GCC) 10.0.1 20200126 (Red Hat 10.0.1-0.6)
      Py_DEBUG: No (sys.gettotalrefcount() missing)
      config[executable]: '/usr/bin/python3.9'
      config[module_search_paths]: ['/usr/lib64/python39.zip', '/usr/lib64/python3.9', '/usr/lib64/python3.9/lib-dynload']
      os.getcwd: /var/str/python/selftest
      os.getgid: 0
      os.getgrouplist: 0
      os.getgroups: 0
      os.getuid: 0
      os.login: root
      platform.architecture: 64bit ELF
      platform.libc_ver: glibc 2.30.9000
      platform.platform: Linux-5.5.0-0.rc6.git3.1.fc32.x86_64-x86_64-with-glibc2.30.9000
      platform.python_implementation: CPython
      pwd.getpwuid(0): pwd.struct_passwd(pw_name='root', pw_passwd='x', pw_uid=0, pw_gid=0, pw_gecos='root', pw_dir='/root', pw_shell='/bin/bash')
      
    5. vstinner commented on Jan 27, 2020

      @vstinner
      MemberAuthor

      https://src.fedoraproject.org/rpms/python39/pull-request/16
      os.getuid: 0

      Maybe this failure comes from the fact that the test suite was run as the root user. I wrote PR 18203 to log the effective uid and gid in pythoninfo, to learn more about this issue.

    6. vstinner commented on Jan 27, 2020

      @vstinner
      MemberAuthor

      New changeset 4a46adc by Victor Stinner in branch 'master':
      bpo-39459: test.pythoninfo logs effective uid/gid (GH-18203)
      4a46adc

    7. DinoV commented on Jan 27, 2020

      @DinoV
      Contributor

      The curious thing about this is other tests in CircularImportTests are importing packages from test.test_import.data in the exact same way.

    8. vstinner commented on Jan 27, 2020

      @vstinner
      MemberAuthor

      AMD64 Fedora Stable Clang Installed 3.x:
      https://buildbot.python.org/all/#/builders/127/builds/212

      So, I added effective uid/gid to pythoninfo, here you have:

      os.getegid: 1000
      os.geteuid: 1000
      os.getgid: 1000
      os.getgrouplist: 1000
      os.getgroups: 1000
      os.getresgid: (1000, 1000, 1000)
      os.getresuid: (1000, 1000, 1000)
      os.getuid: 1000

      There is nothing related to root (uid 0).

    9. brettcannon commented on Jan 27, 2020

      @brettcannon
      Member

      Was the Makefile updated to install Lib/test/test_import/date/unwritable?

    10. DinoV commented on Jan 27, 2020

      @DinoV
      Contributor

      Ahh, that's probably it Brett, I didn't know that was there, thanks!

    11. DinoV commented on Jan 27, 2020

      @DinoV
      Contributor

      I've added the files to the makefile and AMD64 Fedora Stable Clang Installed 3.x was passing.

    12. vstinner commented on Jan 28, 2020

      @vstinner
      MemberAuthor

      commit 2528a6c
      Author: Dino Viehland <dinoviehland@gmail.com>
      Date: Mon Jan 27 14:04:56 2020 -0800

      Add test.test_import.data.unwritable package to makefile (bpo-18211)
      
    13. vstinner commented on Jan 28, 2020

      @vstinner
      MemberAuthor

      I've added the files to the makefile and AMD64 Fedora Stable Clang Installed 3.x was passing.

      Thanks for the fix! I didn't notice that only "Installed" buildbot workers were impacted.

    14. brettcannon commented on Jan 28, 2020

      @brettcannon
      Member

      Did the Windows-equivalent project files also get updated?

    15. DinoV commented on Jan 28, 2020

      @DinoV
      Contributor

      New changeset 0cd5bff by Dino Viehland in branch 'master':
      bpo-39459: include missing test files in windows installer
      0cd5bff

    16. DinoV commented on Jan 28, 2020

      @DinoV
      Contributor

      Nope, thank you for pointing that out. I've updated them now with PR 18241

    17. vstinner commented on Jan 28, 2020

      @vstinner
      MemberAuthor

      The Windows installer copies Lib/test/ and subdirectories: see <InstallFiles Include="$(PySourcePath)Lib\test\**\*" ...> in Tools/msi/test/test.wixproj.

    18. DinoV commented on Jan 28, 2020

      @DinoV
      Contributor

      I guess the update to lib.pyproj probably just makes the files show up when opening the solution in Visual Studio then.

    19. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.9 (EOL)end of lifetestsTests in the Lib/test dir

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions