i have found shopt -s nullglob
apparently disables tab-completion files , directories, , shopt -u nullglob
restores it. why tab-completion directories apparently rely on nullglob
being unset?
i using bash 4.2.37(1)-release
on debian 7.
this apparently known issue bash-completion , listed objective fixed in 3.0 version.
but apparently has been way since @ least 2012.
see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=666933 reference.
edit: @ least 2011: http://thread.gmane.org/gmane.comp.shells.bash.completion.devel/3652
i not @ understand how nullglob causes problem listed in email though.
edit: understand happening. problem glob expansion dumb. sees entire "word" $2[$j]=\${!ref}\${comp_words[i]}
single glob , tries expand it. fails , gets left alone nullglob
on entire argument vanishes (thus causing problem).
quick testing indicates replacing this:
eval $2[$j]=\${!ref}\${comp_words[i]}
with either:
eval $2\[$j\]=\${!ref}\${comp_words\[i\]}
or:
eval "$2[$j]=\${!ref}\${comp_words[i]}"
seems fix problem. can't vouch either of being correct fix though.
update: fixed in debian bash-completion git repository (in way hadn't thought of better).
this commit fixes it. there other globbing related fixes too.
grabbing __reassemble_comp_words_by_ref
git head , sourcing on top of current 1 appears fix problem temporary workaround/solution.