Issue 22140: "python-config --includes" returns a wrong path (double prefix) (original) (raw)

Created on 2014-08-05 13:28 by Michael.Dussere, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
patch_python_sym_links.txt rdossin,2015-07-22 10:45 review
Pull Requests
URL Status Linked Edit
PR 3769 merged mgorny,2017-09-26 15:13
PR 3793 merged benjamin.peterson,2017-09-28 03:23
Messages (7)
msg224825 - (view) Author: Michael Dussere (Michael.Dussere) Date: 2014-08-05 13:28
Our python is installed on a shared directory that is accessed through a symbolic link. $ which python3.4-config /Produits/publics/x86_64.Linux.RH6/python/3.4.1/bin/python3.4-config $ ls -al /Produits lrwxrwxrwx 1 root root 13 Oct 31 2013 /Produits -> /nfs/Produits With this configuration python-config returns a wrong path (it gives a double /nfs prefix) $ python3.4-config --includes -I/nfs/nfs/Produits/publics/x86_64.Linux.RH6/python/3.4.1/include/python3.4m -I/nfs/nfs/Produits/publics/x86_64.Linux.RH6/python/3.4.1/include/python3.4m The problem is due to a double string replacement in the script prefix_build="/Produits/publics/x86_64.Linux.RH6/python/3.4.1" prefix_real=$(installed_prefix "$0") # Use sed to fix paths from their built-to locations to their installed-to # locations. prefix=$(echo "$prefix_build" | sed "s#$prefix_build#$prefix_real#") exec_prefix_build="${prefix}" exec_prefix=$(echo "$exec_prefix_build" sed "s#$exec_prefix_build#$prefix_real#") includedir=$(echo "${prefix}/include" sed "s#$prefix_build#$prefix_real#") for includedirthereplacementofincludedir the replacement of includedirthereplacementofprefix_build by prefixrealisapplyedtwiceandsincetheprefix_real is applyed twice and since the prefixrealisapplyedtwiceandsincetheprefix_real contains prefixbuilditproduceawrongresult.InadditionIthinkitisstrangetohavelineslikethefollowingprefix=prefix_build it produce a wrong result. In addition I think it is strange to have lines like the following prefix=prefixbuilditproduceawrongresult.InadditionIthinkitisstrangetohavelineslikethefollowingprefix=(echo "$prefix_build" sed "s#$prefix_build#$prefix_real#")
msg231307 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-11-18 07:19
Do you want to provide a patch?
msg247108 - (view) Author: Romain Dossin (rdossin) * Date: 2015-07-22 10:45
I stumbled across the exact same problem and I have made a fix that is working, at least for the usage I have...
msg249003 - (view) Author: Alexey Gorshkov (animus) Date: 2015-08-23 09:41
I don't understand: Why python-config needs to seek "realpath"? Why python-config is trying to be smarter than one who starts ./configure script? As so, the right thing to this, is remove "smart" parts from python-config. But as for fast hack in to this is replace line 'prefix_real=$(installed_prefix "$0")' with 'prefix_real=$prefix_build'.
msg303045 - (view) Author: Michał Górny (mgorny) * Date: 2017-09-26 15:16
I've submitted a pull request with another fix. I've tried to keep the changes at minimal but I couldn't stand keeping meaningless 'echo x∥sed−es/x | sed -e s/xsedes/x/$y/' ;-). I have to point out that the attached patch is wrong since it does readlink on CFLAGS &c.
msg303096 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2017-09-27 05:45
New changeset 14086cfc5eed8c5e78342d79e5db87a135d75fa8 by Benjamin Peterson (Michał Górny) in branch 'master': closes bpo-22140: Prevent double substitution of prefix in python-config.sh (#3769) https://github.com/python/cpython/commit/14086cfc5eed8c5e78342d79e5db87a135d75fa8
msg303188 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2017-09-28 03:27
New changeset 68b131d5b674549bb637b366730497714ad11328 by Benjamin Peterson in branch '3.6': [3.6] closes bpo-22140: Prevent double substitution of prefix in python-config.sh (GH-3769) (#3793) https://github.com/python/cpython/commit/68b131d5b674549bb637b366730497714ad11328
History
Date User Action Args
2022-04-11 14:58:06 admin set github: 66338
2020-11-27 14:00:05 iritkatriel link issue31713 superseder
2017-09-28 03:27:44 benjamin.peterson set messages: +
2017-09-28 03:23:50 benjamin.peterson set pull_requests: + <pull%5Frequest3777>
2017-09-27 05:45:08 benjamin.peterson set status: open -> closednosy: + benjamin.petersonmessages: + resolution: fixedstage: patch review -> resolved
2017-09-26 15:16:52 mgorny set messages: + versions: + Python 3.5, Python 3.6, Python 3.7, Python 3.8
2017-09-26 15:13:21 mgorny set keywords: + patchstage: needs patch -> patch reviewpull_requests: + <pull%5Frequest3754>
2017-09-25 17:44:22 mgorny set nosy: + mgorny
2015-08-23 09:41:05 animus set nosy: + animusmessages: +
2015-07-22 10:45:56 rdossin set files: + patch_python_sym_links.txtnosy: + rdossinmessages: +
2014-11-18 07:19:37 serhiy.storchaka set nosy: + serhiy.storchakamessages: + components: + Build, - Demos and Toolsstage: needs patch
2014-08-05 13:28:32 Michael.Dussere create