Skip to content

scp: remote filenames get escaped twice #1540

@14mRh4X0r

Description

@14mRh4X0r

Describe the bug

Since OpenSSH 9.0, scp uses the sftp protocol by default, so it only needs single escaping.

To reproduce

  1. Complete a remote filename destination which needs escaping, e.g. my file.pdf
  2. Spaces in the remote filename get completed as \\\ , e.g. remote:my\\\ file.pdf
  3. When executed, the local file gets copied to a remote file named my\ file.pdf instead of my file.pdf

Expected behavior

Special characters in the remote filename get completed using a single backslash, e.g. remote:my\ file.pdf

Versions (please complete the following information)

  • Operating system name/distribution and version: Arch Linux
  • bash version, echo "$BASH_VERSION": 5.3.8(1)-release
  • bash-completion version, (IFS=.; echo "${BASH_COMPLETION_VERSINFO[*]}"): 2.17.0

Additional context

Passing -O to scp uses the old method, thus still requiring double escaping.

Debug trace

I don't think one is needed for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions