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

[2.14.0] rsync path completion fails if a folder name have a space #1232

Open
jeandestouches opened this issue Jul 6, 2024 · 0 comments
Open

Comments

@jeandestouches
Copy link

jeandestouches commented Jul 6, 2024

Describe the bug

bash-completion was recently updated from 2.11.0 to 2.14.0 in Gentoo.
With bash-completion-2.14.0, rsync path completion fails if a folder name have a space.

To reproduce

~ mkdir "a b" "a c"
~ rsync -av a [hit tab]
It adds a backslash to the command "rsync -av a\ " but hitting tab again fails to show :
a\ b/ a\ c/

with set -x
when I hit tab again (after the backslash is set) :

++ compgen -A hostname -P '' -S : -- 'a\ '
+ _result=
+ _comp_compgen__error_fallback
+ local _status=1
+ [[ -n set ]]
+ eval -- 'known_hosts+=()'
++ known_hosts+=()
+ return 1
+ return
+ (( 0 ))
+ return 1
+ return 1
+ _comp_compgen -ax scp local_files
+ local _append=
+ local _var=
+ local '_cur=a\ '
+ local _dir=
+ local '_ifs= 	
' _has_ifs=
+ local _icmd= _xcmd=
+ _upvars=()
+ local -a _upvars
+ local _old_nocasematch=
+ shopt -q nocasematch
+ local OPTIND=1 OPTARG= OPTERR=0 _opt
+ getopts :av:U:Rc:C:lF:i:x: _opt -ax scp local_files
+ case $_opt in
+ _append=set
+ getopts :av:U:Rc:C:lF:i:x: _opt -ax scp local_files
+ case $_opt in
+ [[ ! -n scp ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ _xcmd=scp
+ getopts :av:U:Rc:C:lF:i:x: _opt -ax scp local_files
+ [[ -n '' ]]
+ shift 2
+ (( 1 == 0 ))
+ [[ ! -n '' ]]
+ _var=COMPREPLY
+ [[ -n set ]]
+ [[ local_files != -* ]]
+ [[ -n '' ]]
+ local -a _generator
+ [[ -n '' ]]
+ [[ -n scp ]]
+ _generator=(_comp_xfunc "$_xcmd" "compgen_$1")
+ declare -F -- _comp_xfunc
+ (( 0 ))
+ [[ -n '' ]]
+ local _comp_compgen__append=set
+ local _comp_compgen__var=COMPREPLY
+ local '_comp_compgen__cur=a\ ' 'cur=a\ '
+ _comp_xfunc scp compgen_local_files
+ local xfunc_name=compgen_local_files
+ [[ compgen_local_files == _* ]]
+ xfunc_name=_comp_xfunc_scp_compgen_local_files
+ declare -F -- _comp_xfunc_scp_compgen_local_files
+ _comp_xfunc_scp_compgen_local_files
+ local _dirsonly=
+ [[ '' == -d ]]
+ local files
+ _comp_expand_glob files '"$cur"*'
+ (( 2 != 2 ))
+ [[ files == @(GLOBIGNORE|_*|*[^_a-zA-Z0-9]*|[0-9]*|) ]]
+ local _original_opts=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:xtrace:checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:globasciiranges:globskipdots:histappend:interactive_comments:no_empty_cmd_completion:patsub_replacement:progcomp:promptvars:sourcepath
+ set +o noglob
+ shopt -s nullglob
+ shopt -u failglob dotglob
+ local GLOBIGNORE=
+ eval -- 'files=()'
++ files=()
+ eval -- 'files=("$cur"*)'
++ files=("$cur"*)
+ _comp_unlocal GLOBIGNORE
+ (( BASH_VERSINFO[0] >= 5 ))
+ shopt -q localvar_unset
+ unset -v GLOBIGNORE
+ [[ :braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:xtrace:checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:globasciiranges:globskipdots:histappend:interactive_comments:no_empty_cmd_completion:patsub_replacement:progcomp:promptvars:sourcepath: == *:dotglob:* ]]
+ shopt -u dotglob
+ [[ :braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:xtrace:checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:globasciiranges:globskipdots:histappend:interactive_comments:no_empty_cmd_completion:patsub_replacement:progcomp:promptvars:sourcepath: == *:nullglob:* ]]
+ shopt -u nullglob
+ [[ :braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:xtrace:checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:globasciiranges:globskipdots:histappend:interactive_comments:no_empty_cmd_completion:patsub_replacement:progcomp:promptvars:sourcepath: == *:failglob:* ]]
+ [[ :braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:xtrace:checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:globasciiranges:globskipdots:histappend:interactive_comments:no_empty_cmd_completion:patsub_replacement:progcomp:promptvars:sourcepath: == *:noglob:* ]]
+ eval '((${#files[@]}))'
++ (( 0 ))
+ return 0
+ local _status=0
+ [[ -n '' ]]
+ return 0

Versions

  • [Gentoo Hardened / 6.6.30]
  • [ 5.2.26(1)-release] bash version
  • [ 2.14.0] bash-completion version

It isn't exclusive to Gentoo as I observe the exact same issue with Debian testing (Trixie) which features bash-completion-2.14.
On the other hand, with Debian stable (bookworm) and bash-completion-2.11, hitting tab correctly show the folders (with space or not)
Finally, downgrading bash-completion from 2.14.0 to 2.11.0 on my gentoo system solves the issue too.

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

1 participant