FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Shell `python3-config` prints empty or wrong paths when its installation path contains spaces · Issue #159819 · python/cpython · GitHub

Repository navigation

Shell python3-config prints empty or wrong paths when its installation path contains spaces #159819

Open

Description

Bug report

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/py
dirname: 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=$?"

Ran into this when working on relocatable builds.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS, Linux

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    buildThe build process and cross-build
    on Oct 20, 2026
  2. added 8 commits that reference this issue on Oct 20, 2026
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

    buildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL