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

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

Closed
mathstuf mannequin opened this issue Mar 22, 2014 · 7 comments
Closed

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

mathstuf mannequin opened this issue Mar 22, 2014 · 7 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@mathstuf
Copy link
Mannequin

mathstuf mannequin commented Mar 22, 2014

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']

    @mathstuf
    Copy link
    Mannequin Author

    mathstuf mannequin commented Mar 22, 2014

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

    @mathstuf mathstuf mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Mar 22, 2014
    @vstinner
    Copy link
    Member

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

    @miss-islington
    Copy link
    Contributor

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

    @miss-islington
    Copy link
    Contributor

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

    @vstinner
    Copy link
    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.

    @mathstuf
    Copy link
    Mannequin Author

    mathstuf mannequin commented Feb 13, 2020

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

    @vstinner
    Copy link
    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.

    @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
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants