Skip to content

bin/pyda: quote app-args passthrough so target args survive#67

Open
s8lvg wants to merge 1 commit into
ndrewh:masterfrom
s8lvg:fix-pyda-argv-quoting
Open

bin/pyda: quote app-args passthrough so target args survive#67
s8lvg wants to merge 1 commit into
ndrewh:masterfrom
s8lvg:fix-pyda-argv-quoting

Conversation

@s8lvg

@s8lvg s8lvg commented Jun 1, 2026

Copy link
Copy Markdown

Problem

bin/pyda passes the target program's arguments through an unquoted ${@:2}.
Bash field-splits an unquoted expansion on $IFS and globs it, so any target
argument containing spaces, tabs, newlines, or glob characters is mangled
before it reaches the target.

Reproduce

A no-op tool (noop.py):

from pyda import *
p = process()
p.run()

Run a target with a single argument that contains spaces:

pyda noop.py -- /usr/bin/printf '[%s]\n' 'a b c'

Expected (one argument):

[a b c]

Actual (argument split into three):

[a]
[b]
[c]

Same cause also globs: pyda noop.py -- /bin/echo '*' prints the directory
listing instead of a literal *.

Fix

Quote the expansion: "${@:2}" expands each positional parameter as its own
word, verbatim, with no splitting or globbing. Also quote "$PYDA_TOOL_PATH"
for paths with spaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant