Skip to content

trace: $prefix and $exec_prefix improperly replaced on Fedora #65215

Closed

Description

@mathstuf
mannequin
BPO 21016
Nosy @vstinner, @mathstuf, @miss-islington
PRs
  • bpo-21016: pydoc and trace use sysconfig #18476
  • [3.8] bpo-21016: pydoc and trace use sysconfig (GH-18476) #18482
  • [3.7] bpo-21016: pydoc and trace use sysconfig (GH-18476) #18483
  • 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-02-12.12:33:38.151>
    created_at = <Date 2014-03-22.03:46:20.443>
    labels = ['type-bug', 'library']
    title = 'trace: $prefix and $exec_prefix improperly replaced on Fedora'
    updated_at = <Date 2020-02-13.08:35:46.753>
    user = 'https://github.com/mathstuf'

    bugs.python.org fields:

    activity = <Date 2020-02-13.08:35:46.753>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-02-12.12:33:38.151>
    closer = 'vstinner'
    components = ['Library (Lib)']
    creation = <Date 2014-03-22.03:46:20.443>
    creator = 'mathstuf'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 21016
    keywords = ['patch']
    message_count = 7.0
    messages = ['214435', '361881', '361887', '361889', '361891', '361941', '361946']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'mathstuf', 'miss-islington']
    pr_nums = ['18476', '18482', '18483']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue21016'
    versions = ['Python 2.7', 'Python 3.3']

    Activity

    1. mathstuf commented on Mar 22, 2014

      mathstufmannequin
      MannequinAuthor

      In the --ignore-dir handling of trace.py, the following is done:

                      s = s.replace("$prefix",
                                    os.path.join(sys.base_prefix, "lib",
                                                 "python" + sys.version[:3]))
                      s = s.replace("$exec_prefix",
                                    os.path.join(sys.base_exec_prefix, "lib",
                                                 "python" + sys.version[:3]))

      This does not do what is expected on 64-bit Fedora and newer Debian since the proper directory is /usr/lib64/python2.7 or /usr/lib/$triple/python2.7. Just the libsuffix can't be changed either since Fedora also has /usr/lib/python2.7 for arch-independent modules. It'd be nice if $prefix were replaced with the following directories from sysconfig.get_paths(): platstdlib, platlib, purelib, and stdlib.

      It also erroneously replaces things like '$prefixpath'. It should probably do split the path on the path separators and only replace components that are equal to $prefix or $exec_prefix (so that the '$' can be escaped for directories named as such literally, but that would require a pass to parse the escapes).

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or error
      on Mar 22, 2014
    3. vstinner commented on Feb 12, 2020

      @vstinner
      Member

      New changeset 4fac7ed by Victor Stinner in branch 'master':
      bpo-21016: pydoc and trace use sysconfig (GH-18476)
      4fac7ed

    4. miss-islington commented on Feb 12, 2020

      @miss-islington
      Contributor

      New changeset ca133e5 by Miss Islington (bot) in branch '3.7':
      bpo-21016: pydoc and trace use sysconfig (GH-18476)
      ca133e5

    5. miss-islington commented on Feb 12, 2020

      @miss-islington
      Contributor

      New changeset ac6f4d2 by Miss Islington (bot) in branch '3.8':
      bpo-21016: pydoc and trace use sysconfig (GH-18476)
      ac6f4d2

    6. vstinner commented on Feb 12, 2020

      @vstinner
      Member

      Thanks Ben Boeckel for the bugfix. Sorry for the delay (6 years)! But it's now fixed in 3.7, 3.8 and master branches.

    7. mathstuf commented on Feb 13, 2020

      mathstufmannequin
      MannequinAuthor

      Thanks!

      Should I file a new issue for the other (less urgent) problem mentioned at the bottom or is it not really worth fixing?

      It also erroneously replaces things like '$prefixpath'. It should probably do split the path on the path separators and only replace components that are equal to $prefix or $exec_prefix (so that the '$' can be escaped for directories named as such literally, but that would require a pass to parse the escapes).

    8. vstinner commented on Feb 13, 2020

      @vstinner
      Member

      It also erroneously replaces things like '$prefixpath'. It should probably do split the path on the path separators and only replace components that are equal to $prefix or $exec_prefix (so that the '$' can be escaped for directories named as such literally, but that would require a pass to parse the escapes).

      re.sub() can be used to leave $prefixpath unchanged. Yeah, please open a separed issue. Sorry, I missed this part of the bug report.

    9. 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

      stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions