Skip to content

馃悰 fix(execute): keep spaces in quoted shebang interpreter paths - #4064

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
r3wretrhy:fix-shebang-quoted-path
Sep 9, 2026
Merged

gaborbernat merged 1 commit into
tox-dev:mainfrom
r3wretrhy:fix-shebang-quoted-path

Conversation

@r3wretrhy

Copy link
Copy Markdown
Contributor

shebang() used str.split() on the rest of the #! line. A quoted interpreter path that contains spaces was therefore broken into several argv entries, so TOX_LIMITED_SHEBANG rewrote the invocation to a command that does not exist.

#! "/Program Files/Python/python.exe" -c
split()      -> ['"/Program', 'Files/Python/python.exe"', '-c']
shlex.split  -> ['/Program Files/Python/python.exe', '-c']

Unquoted lines (#! /bin/python \t-c\t) stay the same. An unbalanced quote is treated as unparseable, matching the existing non-UTF-8 path.

The added test fails on the unpatched tree and passes with the change.

@r3wretrhy
r3wretrhy force-pushed the fix-shebang-quoted-path branch from 32c537d to bb3ad65 Compare September 9, 2026 00:53
@gaborbernat
gaborbernat enabled auto-merge (squash) September 9, 2026 01:01
@gaborbernat
gaborbernat merged commit eea1cb7 into tox-dev:main Sep 9, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants