Skip to content

fix(scp): Use less escaping for filenames when not needed - #1701

Open
yedayak wants to merge 1 commit into
scop:mainfrom
yedayak:scp-spaces
Open

fix(scp): Use less escaping for filenames when not needed#1701
yedayak wants to merge 1 commit into
scop:mainfrom
yedayak:scp-spaces

Conversation

@yedayak

@yedayak yedayak commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

fix(scp): Use less escaping for filenames when not needed

OpenSSH 9.0 changed the default protocol the "scp" command uses to
sftp, which needs less escaping for special characters in remote
filenames. Check if the command has the option to use the legacy
protocol and do less escaping.

If the command line has the "-O" option to use the legacy protocol,
we revert to the old behaviour.

The extra escaping is necessary for older versions, so we can't do it
unconditionally.

Fixes: #1540

Comment thread completions-core/ssh.bash
@yedayak
yedayak force-pushed the scp-spaces branch 2 times, most recently from d987ac8 to 39b4830 Compare July 30, 2026 12:56
Comment thread test/t/test_scp.py Outdated

@akinomyoga akinomyoga left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for updating.

Comment thread completions-core/ssh.bash Outdated
Comment thread test/t/test_scp.py Outdated
Comment thread test/t/test_scp.py Outdated
OpenSSH 9.0 changed the default protocol the "scp" command uses to
sftp, which needs less escaping for special characters in remote
filenames. Check if the command has the option to use the legacy
protocol and do less escaping.

If the command line has the "-O" option to use the legacy protocol,
we revert to the old behaviour.

The extra escaping is necessary for older versions, so we can't do it
unconditionally.

Fixes: scop#1540
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.

scp: remote filenames get escaped twice

2 participants