Description of problem: When using tab completion in bash, it produces an error. Sometimes, it doesn't produce an error. On the previous version (build bash-completion-1.2-4.el5.2), tab completion always works as expected. On non-working RHEL 5.7 box: (type v-i-m-space-slash-u-s-r-slash-b-i-n-slash-r-tab) $ vim /usr/bin/r-bash: eval: line -853: unexpected EOF while looking for matching `'' -bash: eval: line -852: syntax error: unexpected end of file On working RHEL 5.7 box: (type v-i-m-space-slash-u-s-r-slash-b-i-n-slash-r-tab) $ vim /usr/bin/r racc rebuild-jar-repository resque-web rpdump rpmverify racc2y recode-sr-latin rev rpload rsvg rackup refer rex rpm2cpio rsvg-convert rails rename rgb2ycbcr rpmdb rsvg-view (...snip...) The RHEL boxes that do work have about 618 packages installed. The RHEL boxes that don't work have about 1460 packages installed. /etc/bash_completion.d on RHEL boxes that work have 66 files/symlinks. /etc/bash_completion.d on RHEL boxes that don't work have 87 files/symlinks. $ cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.7 (Tikanga) Version-Release number of selected component (if applicable): $ rpm -qa| grep ^bash- bash-3.2-32.el5 bash-completion-1.3-4.el5 How reproducible: 100% on certain RHEL boxes. Steps to Reproduce: 1. login (with bash-completion-1.3-4.el5 installed) 2. try tab completion 3. Actual results: $ vim /usr/bin/r-bash: eval: line -853: unexpected EOF while looking for matching `'' -bash: eval: line -852: syntax error: unexpected end of file Expected results: $ vim /usr/bin/r racc rebuild-jar-repository resque-web rpdump rpmverify racc2y recode-sr-latin rev rpload rsvg rackup refer rex rpm2cpio rsvg-convert rails rename rgb2ycbcr rpmdb rsvg-view (...snip...) Additional info: Ville, I don't know how to troubleshoot these _* macros. I suspect some other package from RHEL / EPEL is getting installed that has files that end up in /etc/bash_completion.d. It's just which package... I have gone back to using bash-completion-1.2-4.el5.2
I cannot reproduce on CentOS 5.6. To debug what happens on completion, run "set -x" in a shell, then invoke the completion. Post the (whole) output here or add it as an attachment. To find out which package installs which bash_completion.d file, do for example this: $ for file in /etc/bash_completion.d/* ; do echo "$file: $(rpm -qf $file)" ; done
Hi Ville, Sweet! Thanks for the debugging tips. I found the problem. I have an MP3 file with singe quotes in the name! Dang it! Here is the file as seen with an ls: 08 - 2 Skinnee J's - Mindtrick.mp3 Here is the output in case you want to tweak the completion bits: $ vim /usr/bin/r+ local IFS cur xspec + IFS=' ' + COMPREPLY=() + _get_comp_words_by_ref cur + local exclude flag i OPTIND=1 + words=() + local cur cword words + upargs=() + upvars=() + local upargs upvars vcur vcword vprev vwords + getopts c:i:n:p:w: flag cur + [[ 1 -ge 1 ]] + case ${!OPTIND} in + vcur=cur + let 'OPTIND += 1' + [[ 1 -ge 2 ]] + __get_cword_at_cursor_by_ref '' words cword cur + words=() + local cword words + __reassemble_comp_words_by_ref '' words cword + local exclude i j ref + [[ -n '' ]] + eval cword=1 ++ cword=1 + [[ -n '' ]] + eval 'words=(' '"${COMP_WORDS[@]}"' ')' ++ words=("${COMP_WORDS[@]}") + local i cur2 + local 'cur=vim /usr/bin/r' + local index=14 + (( i = 0 )) + (( i <= cword )) + [[ 14 -ge 3 ]] + [[ vim != \v\i\m ]] + [[ 0 -lt 1 ]] + local old_size=14 + cur=' /usr/bin/r' + local new_size=11 + index=11 + (( ++i )) + (( i <= cword )) + [[ 11 -ge 10 ]] + [[ /usr/bin/ != \/\u\s\r\/\b\i\n\/\r ]] + cur=/usr/bin/r + (( index-- )) + [[ 10 -ge 10 ]] + [[ /usr/bin/r != \/\u\s\r\/\b\i\n\/\r ]] + [[ 1 -lt 1 ]] + (( ++i )) + (( i <= cword )) + [[ /usr/bin/r != \/\u\s\r\/\b\i\n\/\r ]] + cur2=/usr/bin/r + local words cword cur + _upvars -a2 words vim /usr/bin/r -v cword 1 -v cur /usr/bin/r + (( 10 )) + (( 10 )) + case $1 in + [[ -n 2 ]] + printf %d 2 + [[ -n words ]] + unset -v words + eval 'words=("${@:3:2}")' ++ words=("${@:3:2}") + shift 4 + (( 6 )) + case $1 in + [[ -n cword ]] + unset -v cword + eval 'cword="$3"' ++ cword=1 + shift 3 + (( 3 )) + case $1 in + [[ -n cur ]] + unset -v cur + eval 'cur="$3"' ++ cur=/usr/bin/r + shift 3 + (( 0 )) + [[ -n cur ]] + upvars+=("$vcur") + upargs+=(-v $vcur "$cur") + [[ -n '' ]] + [[ -n '' ]] + [[ -n '' ]] + (( 1 )) + local cur + _upvars -v cur /usr/bin/r + (( 3 )) + (( 3 )) + case $1 in + [[ -n cur ]] + unset -v cur + eval 'cur="$3"' ++ cur=/usr/bin/r + shift 3 + (( 0 )) + _expand + [[ /usr/bin/r == \~*/* ]] + [[ /usr/bin/r == \~* ]] ++ awk '/^complete[ \t]+.*[ \t]vim([ \t]|$)/ { print $0; exit }' /etc/bash_completion + xspec='complete -f -X '\''*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)'\'' vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate kwrite' + xspec=''\''*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)'\'' vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate kwrite' + xspec=''\''*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)'\''' + local -a toks + local tmp + toks=(${toks[@]-} $( compgen -d -- "$(quote_readline "$cur")" | { while read -r tmp; do # see long TODO comment in _filedir() --David printf '%s\n' $tmp done } )) ++ read -r tmp +++ quote_readline /usr/bin/r +++ local quoted +++ _quote_readline_by_ref /usr/bin/r ret +++ [[ / == \' ]] +++ [[ 3 -le 3 ]] +++ [[ / == \" ]] +++ printf -v ret %q /usr/bin/r +++ [[ / == \$ ]] +++ printf %s /usr/bin/r ++ compgen -d -- /usr/bin/r + eval 'xspec='\''*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)'\''' ++ xspec='*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)' + local 'matchop=!' + [[ *.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class) == !* ]] + [[ 3 -ge 4 ]] ++ tr '[:lower:]' '[:upper:]' ++ printf %s '08 - 2 Skinnee J'\''s - Mindtrick.mp3' bash-completion-1.2-4.el5.2.noarch.rpm decisiv-repo-1.2-1.el5.noarch.rpm epel-release-5-4.noarch.rpm mod_dav_svn-1.6.1-3.i386.rpm sqlite-3.4.2-3.i386.rpm sqlite-debuginfo-3.4.2-3.i386.rpm sqlite-devel-3.4.2-3.i386.rpm sqlite-tcl-3.4.2-3.i386.rpm + xspec='!(*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)|08 - 2 SKINNEE J'\''S - MINDTRICK.MP3BASH-COMPLETION-1.2-4.EL5.2.NOARCH.RPMDECISIV-REPO-1.2-1.EL5.NOARCH.RPMEPEL-RELEASE-5-4.NOARCH.RPMMOD_DAV_SVN-1.6.1-3.I386.RPMSQLITE-3.4.2-3.I386.RPMSQLITE-DEBUGINFO-3.4.2-3.I386.RPMSQLITE-DEVEL-3.4.2-3.I386.RPMSQLITE-TCL-3.4.2-3.I386.RPM)' + toks=(${toks[@]-} $( eval compgen -f -X "!$xspec" -- "\$(quote_readline "\$cur")" | { while read -r tmp; do [ -n $tmp ] && printf '%s\n' $tmp done } )) ++ read -r tmp ++ eval compgen -f -X '!!(*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)|08 - 2 SKINNEE J'\''S - MINDTRICK.MP3BASH-COMPLETION-1.2-4.EL5.2.NOARCH.RPMDECISIV-REPO-1.2-1.EL5.NOARCH.RPMEPEL-RELEASE-5-4.NOARCH.RPMMOD_DAV_SVN-1.6.1-3.I386.RPMSQLITE-3.4.2-3.I386.RPMSQLITE-DEBUGINFO-3.4.2-3.I386.RPMSQLITE-DEVEL-3.4.2-3.I386.RPMSQLITE-TCL-3.4.2-3.I386.RPM)' -- '$(quote_readline $cur)' -bash: eval: line -853: unexpected EOF while looking for matching `'' -bash: eval: line -852: syntax error: unexpected end of file + '[' 0 -ne 0 ']' + COMPREPLY=("${toks[@]}") ++ history -a
Created attachment 515766 [details] Candidate fix Ok, that uncovers an ... interesting bug. This patch should fix it, could you try it out?
Hi Ville, Thanks for the patch. It seems like it works: $sudo patch -p1 < ~/ville-bash-completion-tick-in-file-name.path $cat ville-bash-completion-tick-in-file-name.path --- bash-completion-1.3/bash_completion 2011-07-28 19:28:03.374350007 +0300 +++ bash-completion-1.3/bash_completion 2011-07-28 19:34:59.059346735 +0300 @@ -1620,7 +1620,7 @@ _filedir_xspec() fi [[ ${BASH_VERSINFO[0]} -ge 4 ]] && \ xspec="$matchop($xspec|${xspec^^})" || \ - xspec="$matchop($xspec|$(printf %s $xspec | tr '[:lower:]' '[:upper:]'))" + xspec="$matchop($xspec|$(tr '[:lower:]' '[:upper:]' <<<$xspec))" toks=( ${toks[@]-} $( eval compgen -f -X "!$xspec" -- "\$(quote_readline "\$cur")" | { $ rpm -qa ^bash-* bash-completion-1.3-4.el5 $ ls -al *.mp3 -rw-rw-rw- 1 allen domain users 4.9M Jul 4 2007 08 -2 Skinnee J's - Mindtrick.mp3 (type v-i-m-space-slash-u-s-r-slash-b-i-n-slash-r-tab) $ vim /usr/bin/r Display all 145 possibilities? (y or n)
bash-completion-1.3-5.el5 has been submitted as an update for Fedora EPEL 5. https://admin.fedoraproject.org/updates/bash-completion-1.3-5.el5
Package bash-completion-1.3-5.el5: * should fix your issue, * was pushed to the Fedora EPEL 5 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=epel-testing bash-completion-1.3-5.el5' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/bash-completion-1.3-5.el5 then log in and leave karma (feedback).
bash-completion-1.3-5.el5 has been pushed to the Fedora EPEL 5 stable repository. If problems still persist, please make note of it in this bug report.