You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Shell python3-config prints empty or wrong paths when its installation path contains spaces #159819
The shell version of python-config (Misc/python-config.sh.in, installed as bin/python3-config on POSIX platforms other than macOS) locates its own
prefix with unquoted command substitutions:
RESULT=$(dirname $(cd $(dirname "$1")&&pwd -P))
With a space in the path, the substitutions are word-split. The script
complains on stderr but still exits 0 and prints an empty prefix and paths
rooted at /:
$ cp -a /tmp/py-plain "/tmp/py with spaces"
$ "/tmp/py with spaces/bin/python3-config" --prefix/tmp/py with spaces/bin/python3-config: 24: cd: can't cd to /tmp/pydirname: missing operand
$ echo$?0
$ "/tmp/py with spaces/bin/python3-config" --includes-I/include/python3.16 -I/include/python3.16
Invoked via a relative path, there is no stderr at all and the result is
silently mangled (--prefix → /tmp . spaces). The same tree at a path
without spaces works, and a script generated by ./configure --prefix="/path with spaces" fails identically in place, so the
problem is purely how the script finds itself.
Reproducer
./configure --prefix=/tmp/py-plain && make -j && make install
cp -a /tmp/py-plain "/tmp/py with spaces""/tmp/py with spaces/bin/python3-config" --prefix;echo"exit=$?"
Activity
pythongh-159819: Fix python-config.sh for installation paths containi…
pythongh-159819: Add test for python-config.sh with a prefix containi…
pythongh-159819: Relocate paths in python-config.sh without sed
pythongh-159819: Add NEWS entry
pythongh-159819: Fix python-config.sh for installation paths containi…
pythongh-159819: Add test for python-config.sh with a prefix containi…
pythongh-159819: Relocate paths in python-config.sh without sed
pythongh-159819: Add NEWS entry
gh-159819: Fix python-config.sh for installation paths containing spa…
[3.15] gh-159819: Fix python-config.sh for installation paths contain…
[3.14] gh-159819: Fix python-config.sh for installation paths contain…