Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escaping of remote filenames containing spaces is broken for rsync #1255

Open
omgold opened this issue Oct 25, 2024 · 5 comments
Open

Escaping of remote filenames containing spaces is broken for rsync #1255

omgold opened this issue Oct 25, 2024 · 5 comments

Comments

@omgold
Copy link

omgold commented Oct 25, 2024

Describe the bug

If I want to copy a file from remote to local containing spaces, the space will be escaped with triple backslashes, but it should be only one.

To reproduce

If there is a named test file.txt when I try to complete

rsync localhost:test

I get the completion

rsync localhost:test\\\ file.txt

which doesn't work.

Expected behavior

It should be

rsync localhost:test\ file.txt

Versions (please complete the following information)

  • [ x] Operating system name/distribution and version: Arch
  • [ x] bash version, echo "$BASH_VERSION": 5.2.37(1)-release
  • [ x] bash-completion version, (IFS=.; echo "${BASH_COMPLETION_VERSINFO[*]}"): 2.14.0
@yedayak
Copy link
Collaborator

yedayak commented Oct 25, 2024

Hi, what version of rsync are you using?
This should be fixed on the main branch, see this pr.
Can you try using the main branch and see if it works for you?

@omgold
Copy link
Author

omgold commented Oct 25, 2024

Okay tried it. It seems to be fix only partially, though.

It still misbehaves when there are 2 files present, test file.txt and test\ file.txt.

If I then try to complete

rsync localhost:test

at the first tab press I get

rsync localhost:test\

but on subsequent presses, I get no choices to pick from at all.

I'm using rsync 3.3.0

@yedayak
Copy link
Collaborator

yedayak commented Nov 2, 2024

Can you add set -x lines to completions/rsync?
like this:

106                 set -x #<------ Add this
107                 _comp_cmd_rsync__vercomp "$rsync_version" "3.2.4"
108                 if (($? == 2)); then
109                     _comp_compgen -x scp remote_files
110                 else
111                     _comp_compgen -x scp remote_files -l
112                 fi
113                 set +x <-----  # and this

And attach the output when completing with the issue?

@omgold
Copy link
Author

omgold commented Nov 4, 2024

@yedayak here you go.

rsync-complete-debug-output.txt

@scop
Copy link
Owner

scop commented Dec 10, 2024

I wonder if #1232 is the same issue as this one.

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

No branches or pull requests

3 participants