-
Notifications
You must be signed in to change notification settings - Fork 390
Escaping of remote filenames containing spaces is broken for rsync #1255
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
Comments
Hi, what version of rsync are you using? |
Okay tried it. It seems to be fix only partially, though. It still misbehaves when there are 2 files present, If I then try to complete
at the first tab press I get
but on subsequent presses, I get no choices to pick from at all. I'm using rsync 3.3.0 |
Can you add set -x lines to completions/rsync?
And attach the output when completing with the issue? |
@yedayak here you go. |
I wonder if #1232 is the same issue as this one. |
I'd say it is closely related, but it's a separate issue. The original problem reported in #1255 (comment) was already fixed as I don't see the reported behavior in the latest version of The second problem mentioned in #1255 (comment) is even another independent problem. The completion generates the following two candidates.
Then, Bash inserts the common prefix This seems to be fixed by extending diff --git a/bash_completion b/bash_completion
index 89a9584be..81b024dd2 100644
--- a/bash_completion
+++ b/bash_completion
@@ -235,8 +235,11 @@ _comp_dequote__initialize
_comp_dequote()
{
REPLY=() # fallback value for unsafe word and failglob
- [[ $1 =~ $_comp_dequote__regex_safe_word ]] || return 1
+ if [[ $1 =~ $_comp_dequote__regex_safe_word ]]; then
eval "REPLY=($1)" 2>/dev/null # may produce failglob
+ elif [[ $1 =~ ${_comp_dequote__regex_safe_word%$}\\$ ]]; then
+ eval "REPLY=(${1%\\})" 2>/dev/null
+ fi
}
# Unset the given variables across a scope boundary. Useful for unshadowing Although, I'm not sure if the above change wouldn't cause an issue in other places that use |
scop#1255 (comment) Co-authored-by: Yedaya Katsman <yedaya.ka@gmail.com>
scop#1255 (comment) Co-authored-by: Yedaya Katsman <yedaya.ka@gmail.com>
scop#1255 (comment) Co-authored-by: Yedaya Katsman <yedaya.ka@gmail.com>
scop#1255 (comment) Co-authored-by: Yedaya Katsman <yedaya.ka@gmail.com>
scop#1255 (comment) Co-authored-by: Yedaya Katsman <yedaya.ka@gmail.com>
scop#1255 (comment) Co-authored-by: Yedaya Katsman <yedaya.ka@gmail.com>
scop#1255 (comment) Co-authored-by: Yedaya Katsman <yedaya.ka@gmail.com>
scop#1255 (comment) Co-authored-by: Yedaya Katsman <yedaya.ka@gmail.com>
scop#1255 (comment) Co-authored-by: Yedaya Katsman <yedaya.ka@gmail.com>
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 completersync 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)
echo "$BASH_VERSION"
: 5.2.37(1)-release(IFS=.; echo "${BASH_COMPLETION_VERSINFO[*]}")
: 2.14.0The text was updated successfully, but these errors were encountered: