Skip to content

Quote scp paths in salt-ssh to support paths with spaces - #70085

Open
twangboy wants to merge 1 commit into
saltstack:3008.xfrom
twangboy:fix/61338/3008.x
Open

Quote scp paths in salt-ssh to support paths with spaces#70085
twangboy wants to merge 1 commit into
saltstack:3008.xfrom
twangboy:fix/61338/3008.x

Conversation

@twangboy

Copy link
Copy Markdown
Contributor

What does this PR do?

Shell.send() built the scp command as an unquoted f-string, so any space in the local or remote path (e.g. a master cachedir/root_dir containing a space) caused shlex.split() to break it into bogus extra arguments and fail the transfer. This affected every send() caller: thin/relenv tarball deploy, ext_mods tarball, pre-flight script, shim transfer, and the relenv minion-config transfer.

Quote local and host:remote with shlex.quote() in Shell.send(), and apply the same treatment to the related unquoted "test -d"/"test -f" remote checks in Single.check_thin_dir() and Single.cmd_block().

Add a unit test covering the command string built by Shell.send(), and an integration test that overrides a roster's thin_dir with a space-containing path and drives a real salt-ssh deploy against it.

What issues does this PR fix or reference?

Fixes #61338

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

Yes

@twangboy twangboy added this to the Argon v3008.3 milestone Aug 18, 2026
@twangboy twangboy self-assigned this Aug 18, 2026
@twangboy
twangboy requested a review from a team as a code owner August 18, 2026 20:51
@twangboy twangboy added the test:full Run the full test suite label Aug 18, 2026
Shell.send() built the scp command as an unquoted f-string, so any
space in the local or remote path (e.g. a master cachedir/root_dir
containing a space) caused shlex.split() to break it into bogus
extra arguments and fail the transfer. This affected every send()
caller: thin/relenv tarball deploy, ext_mods tarball, pre-flight
script, shim transfer, and the relenv minion-config transfer.

Quote local and host:remote with shlex.quote() in Shell.send(), and
apply the same treatment to the related unquoted "test -d"/"test -f"
remote checks in Single.check_thin_dir() and Single.cmd_block().

Add a unit test covering the command string built by Shell.send(),
and an integration test that overrides a roster's thin_dir with a
space-containing path and drives a real salt-ssh deploy against it.

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

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant