[Bash-completion-devel] [bash-completion-Bugs][312741] shopt -s failglob breaks __reassemble_comp_words_by_ref

bash-completion-bugs at alioth.debian.org bash-completion-bugs at alioth.debian.org
Fri Aug 30 22:28:14 UTC 2013


bash-completion-Bugs item #312741 was changed at 2013-08-30 18:28 by Ian! D. Allen
You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=312741&group_id=100114

Status: Open
Priority: 3
Submitted By: Ville Skyttä  (scop-guest)
Assigned to: Nobody (None)
Summary: shopt -s failglob breaks __reassemble_comp_words_by_ref 
Distribution: None
Originally reported in: None
Milestone: None
Status: None
Original bug number: 


Initial Comment:
$ shopt -s failglob
$ ssh <TAB>bash: no match: words[0]=${!ref}${COMP_WORDS[i]}

http://thread.gmane.org/gmane.comp.shells.bash.completion.devel/2546

----------------------------------------------------------------------

Comment By: Ian! D. Allen (idallen-guest)
Date: 2013-08-30 18:28

Message:
In addition to failures under "set -u", using "shopt -s failglob" also
causes errors that make all bash_completion versions (including 2.1)
unusable:

$ env -i bash --login --noprofile --norc
bash-4.2$ shopt -s failglob
bash-4.2$ . /usr/share/bash-completion/bash_completion
bash-4.2$ make <TAB> bash: no match: words[0]=${!ref}${COMP_WORDS[i]}
bash-4.2$ find <TAB> bash: no match: words[0]=${!ref}${COMP_WORDS[i]}
bash-4.2$ mutt <TAB> bash: no match: words[0]=${!ref}${COMP_WORDS[i]}
bash-4.2$ date <TAB> bash: no match: words[0]=${!ref}${COMP_WORDS[i]}
bash-4.2$ echo <TAB> bash: no match: words[0]=${!ref}${COMP_WORDS[i]}
etc.

The code has many errors where characters are not quoted (e.g. bash
array subscripts), so they try to expand as GLOB file names and fail.

As an example, to fix the above, change the lines:

eval $2[$j]=\${!ref}\${COMP_WORDS[i]}

to this:

eval "$ref"='${!ref-}${COMP_WORDS[i]-}'

everywhere (and also fix it so that "set -u" doesn't also make it fail).

----------------------------------------------------------------------

You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=312741&group_id=100114



More information about the Bash-completion-devel mailing list