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: trace: $prefix and $exec_prefix improperly replaced on Fedora
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: mathstuf, miss-islington, vstinner
Priority: normal Keywords: patch

Created on 2014-03-22 03:46 by mathstuf, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18476 merged vstinner, 2020-02-12 09:14
PR 18482 merged miss-islington, 2020-02-12 12:02
PR 18483 merged miss-islington, 2020-02-12 12:02
Messages (7)
msg214435 - (view) Author: Ben Boeckel (mathstuf) Date: 2014-03-22 03:46
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).
msg361881 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-02-12 12:02
New changeset 4fac7ed43ebf1771a8fe86fdfe7b9991f3be78cd by Victor Stinner in branch 'master':
bpo-21016: pydoc and trace use sysconfig (GH-18476)
https://github.com/python/cpython/commit/4fac7ed43ebf1771a8fe86fdfe7b9991f3be78cd
msg361887 - (view) Author: miss-islington (miss-islington) Date: 2020-02-12 12:32
New changeset ca133e53fafdec1aa77613fcb7558deed959383f by Miss Islington (bot) in branch '3.7':
bpo-21016: pydoc and trace use sysconfig (GH-18476)
https://github.com/python/cpython/commit/ca133e53fafdec1aa77613fcb7558deed959383f
msg361889 - (view) Author: miss-islington (miss-islington) Date: 2020-02-12 12:32
New changeset ac6f4d2db703c0ff88e496bcb7b7fe55cf2ac458 by Miss Islington (bot) in branch '3.8':
bpo-21016: pydoc and trace use sysconfig (GH-18476)
https://github.com/python/cpython/commit/ac6f4d2db703c0ff88e496bcb7b7fe55cf2ac458
msg361891 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-02-12 12:33
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.
msg361941 - (view) Author: Ben Boeckel (mathstuf) Date: 2020-02-13 07:52
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).
msg361946 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-02-13 08:35
> 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.
History
Date User Action Args
2022-04-11 14:58:00adminsetgithub: 65215
2020-02-13 08:35:46vstinnersetmessages: + msg361946
2020-02-13 07:52:10mathstufsetmessages: + msg361941
2020-02-12 12:33:38vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg361891

stage: patch review -> resolved
2020-02-12 12:32:58miss-islingtonsetmessages: + msg361889
2020-02-12 12:32:53miss-islingtonsetnosy: + miss-islington
messages: + msg361887
2020-02-12 12:02:49miss-islingtonsetpull_requests: + pull_request17855
2020-02-12 12:02:42miss-islingtonsetpull_requests: + pull_request17853
2020-02-12 12:02:41vstinnersetnosy: + vstinner
messages: + msg361881
2020-02-12 09:14:37vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request17845
2014-03-22 03:46:20mathstufcreate