Bug 629518 - bash-completion handles htab incorrectly
Summary: bash-completion handles htab incorrectly
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: bash-completion
Version: el6
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Ville Skyttä
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: ActualBug
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-09-02 07:50 UTC by Stefan Assmann
Modified: 2011-05-28 21:35 UTC (History)
3 users (show)

Fixed In Version: bash-completion-1.3-4.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-05-28 21:35:36 UTC


Attachments (Terms of Use)

Description Stefan Assmann 2010-09-02 07:50:22 UTC
Description of problem:
I have a patch with the filename of "[RHEL5_6 PATCH] igb: add registers etc. printout code just before?resetting adapters.eml".
When I try to auto-complete this with [-tab or \[-tab I get
ls \[bash: [: [RHEL5_6 PATCH] igb: add registers etc. printout code just before: binary operator expected

I tried this on a clean RHEL6 with only bash-completion added to the system.
Note: it works when bash-completion is not installed.

Version-Release number of selected component (if applicable):
bash-4.1.2-3.el6.x86_64
bash-completion-1.1-7.el6.noarch

How reproducible:
always

Steps to Reproduce:
1. install system
2. add bash-completion rpm
3.
  
Actual results:
bash completion unable to handle [

Expected results:
bash completion handles [ correctly

Additional info:

Comment 1 Ville Skyttä 2010-09-13 18:50:21 UTC
I don't have an EL6 system to test with, but I don't seem to be able to reproduce with the EL5 version nor current upstream bleeding edge on F13, both seem to work correctly to me.

But then again I'm not sure I'm testing the right thing: what is the actual command you're trying to complete?  I tested "ls \[<TAB>" and "ls [<TAB>".

Before invoking the completion, please do a "set -x" in a shell and post relevant parts of the output here.

Comment 2 Stefan Assmann 2010-09-14 06:42:38 UTC
Hi Ville,

thanks for your reply. What you did is correct. However I figured that the problem seems not to be more complicated.

There might be some special character involved as I saved the file from thunderbird with the it's proposed name. Hope the debug output solves the riddle. Thanks!

I did ls /dev/shm/[<TAB> with the problematic file in placed in /dev/shm

ls /dev/shm/[+ local cur prev
++ _get_cword
++ '[' -n '4.1.2(1)-release' ']'
++ __get_cword4
++ local i
++ local LC_CTYPE=C
++ local 'WORDBREAKS=
"'\''><=;|&(:'
++ WORDBREAKS='
'\''><=;|&(:'
++ WORDBREAKS='
><=;|&(:'
++ '[' -n '' ']'
++ local 'cur=ls /dev/shm/['
++ local 'tmp=ls /dev/shm/['
+++ expr 'ls /dev/shm/[' : '.*[
><=;|&(:]'
++ local word_start=3
++ '[' 3 -ge 2 ']'
++ local char=s
++ '[' s '!=' '\' ']'
++ break
++ cur='/dev/shm/['
++ printf %s '/dev/shm/['
+ cur='/dev/shm/['
+ prev=ls
+ _split_longopt
+ [[ /dev/shm/[ == --?*=* ]]
+ return 1
+ [[ /dev/shm/[ == -* ]]
+ [[ ls == rmdir ]]
+ _filedir
+ local 'IFS=
' xspec
+ _expand
+ [[ /dev/shm/[ == \~*/* ]]
+ [[ /dev/shm/[ == \~* ]]
+ local -a toks
+ local tmp
+ toks=(${toks[@]-} $(
    compgen -d -- "$(quote_readline "$cur")" | {
    while read -r tmp; do
        echo $tmp
    done
}
))
++ read -r tmp
+++ quote_readline '/dev/shm/['
+++ '[' -n '4.1.2(1)-release' ']'
+++ echo '/dev/shm/['
+++ return
++ compgen -d -- '/dev/shm/['
+ [[ '' != -d ]]
+ xspec=
+ toks=(${toks[@]-} $(
    compgen -f -X "$xspec" -- "$(quote_readline "$cur")" | {
    while read -r tmp; do
        [ -n $tmp ] && echo $tmp
    done
}
))
++ read -r tmp
+++ quote_readline '/dev/shm/['
+++ '[' -n '4.1.2(1)-release' ']'
+++ echo '/dev/shm/['
+++ return
++ compgen -f -X '' -- '/dev/shm/['
++ '[' -n '/dev/shm/[RHEL5_6 PATCH] igb: add registers etc. printout code just before' 'resetting adapters.eml' ']'
bash: [: /dev/shm/[RHEL5_6 PATCH] igb: add registers etc. printout code just before: binary operator expected
++ read -r tmp
++ '[' -n '/dev/shm/[RHEL5.6 PATCH] xfs: fix missing untrusted inode lookup tag.eml' ']'
++ echo '/dev/shm/[RHEL5.6 PATCH] xfs: fix missing untrusted inode lookup tag.eml'
++ read -r tmp

Comment 3 Ville Skyttä 2010-09-14 17:53:41 UTC
I'm fairly certain that there's something unusual between "before" and "resetting" in the filename, and/or perhaps even a linefeed between "just" and "before".  Unfortunately I cannot see what it is from my browser or mail, and I tried things out by constructing a filename that had a non-breaking space in it, but couldn't find any problems.

The "[" in the error message is somewhat misleading BTW, I don't think there's anything wrong with its handling, it's just a coincidence that it happens to be in the filename.  The error originates from that two arguments end up being passed to the "[" command (see the 5th last line that starts with "++" in your output).

Comment 4 Stefan Assmann 2010-09-15 06:37:13 UTC
Thanks for your analysis. I think I know what it is now.

ls *RHEL5* |xxd
0000000: 5b52 4845 4c35 5f36 2050 4154 4348 5d20  [RHEL5_6 PATCH] 
0000010: 6967 623a 2061 6464 2072 6567 6973 7465  igb: add registe
0000020: 7273 2065 7463 2e20 7072 696e 746f 7574  rs etc. printout
0000030: 2063 6f64 6520 6a75 7374 2062 6566 6f72   code just befor
0000040: 6509 7265 7365 7474 696e 6720 6164 6170  e.resetting adap
0000050: 7465 7273 2e65 6d6c 0a                   ters.eml.

It's a horizontal tab (see 0000040, second character), that comes from a bug in thunderbird.

Comment 5 Ville Skyttä 2010-09-28 20:09:53 UTC
Discussing upstream:
http://thread.gmane.org/gmane.comp.shells.bash.completion.devel/2543

Comment 6 Ville Skyttä 2010-10-04 17:50:24 UTC
Most cases should be fixed upstream now:

http://git.debian.org/?p=bash-completion/bash-completion.git;a=commitdiff;h=3d8efed

Comment 7 Fedora Update System 2011-04-15 21:16:57 UTC
bash-completion-1.3-3.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/bash-completion-1.3-3.el6

Comment 8 Fedora Update System 2011-04-15 21:22:48 UTC
bash-completion-1.3-3.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/bash-completion-1.3-3.el5

Comment 9 Fedora Update System 2011-04-16 18:23:53 UTC
Package bash-completion-1.3-3.el6:
* should fix your issue,
* was pushed to the Fedora EPEL 6 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-3.el6'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/bash-completion-1.3-3.el6
then log in and leave karma (feedback).

Comment 10 Fedora Update System 2011-05-10 21:41:10 UTC
bash-completion-1.3-4.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/bash-completion-1.3-4.el6

Comment 11 Fedora Update System 2011-05-10 21:42:55 UTC
bash-completion-1.3-4.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/bash-completion-1.3-4.el5

Comment 12 Fedora Update System 2011-05-28 21:33:51 UTC
bash-completion-1.3-4.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2011-05-28 21:35:17 UTC
bash-completion-1.3-4.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.