Bug 831835 - cur: command not found / no completion for "> filename"
Summary: cur: command not found / no completion for "> filename"
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: bash-completion
Version: 17
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ville Skyttä
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-06-13 20:54 UTC by Harald Reindl
Modified: 2012-06-22 18:55 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-06-22 18:55:49 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Harald Reindl 2012-06-13 20:54:12 UTC
i have two problems noticed in F17

"dmesg <TAB><TAB>" -> "dmesg bash: cur: command not found"
this happens for some commands after <TAB><TAB>

[root@srv-rhsoft:~]$ chkconfig bash: cur: Kommando nicht gefunden.
bash: cur: Kommando nicht gefunden.

[root@srv-rhsoft:/etc/yum.repos.d]$ scp fedorabash: cur: Kommando nicht gefunden.
bash: configfile: Kommando nicht gefunden.
_____________________________

[root@rh:~]$ ls messages
lrwxrwxrwx 1 root root 17 2012-03-30 01:21 messages -> /var/log/messages
[root@rh:~]$ cat messages
Jun 13 16:13:04 rh kernel: warning: `growisofs' uses 32-bit capabilities (legacy support in use)
[root@rh:~]$ > me

why is this completion for empty a textfile no longer working?
"cat mess<TAB><TAB>" still works

Comment 1 Ville Skyttä 2012-06-13 21:13:17 UTC
One bug per report, please.

Let's look at dmesg first: before invoking the completion, do "set -x" in a shell, then invoke the completion and post/attach the resulting output here.

Also, please make sure you're working in a clean environment (no bash_completion files explicitly sourced in your .bashrc or friends - that should be done only by /etc/profile.d/bash_completion.sh).

Completion for ">" is broken due to a bash bug, already worked around upstream:
http://anonscm.debian.org/gitweb/?p=bash-completion/bash-completion.git;a=commitdiff;h=6f3d650e2309feff4f3e80717409ebccb2d38362

Comment 2 Harald Reindl 2012-06-13 21:20:47 UTC
the missing completion for "> mess" makes me crazy
i have each day tons of half-named new files :-)

what makes me wonder is that F16/F17 have the same version of 
bash-completion and F16 worked like a charme until upgrade to F17

[harry@srv-rhsoft:~]$ set -x
++ printf '\033]0;%s@%s:%s\007' harry srv-rhsoft '~'
[harry@srv-rhsoft:~]$ dmesg + local compdir=./completions
+ [[ /usr/share/bash-completion/bash_completion == */* ]]
+ compdir=/usr/share/bash-completion/completions
+ . /usr/share/bash-completion/completions/dmesg
+ return 124
+ [[ linux-gnu == *solaris* ]]
+ ssh -4 -2 -C -p 10022 root.net cur prev words cword
bash: cur: Kommando nicht gefunden.
+ _init_completion
+ local exclude= flag outx errx inx OPTIND=1
+ getopts n:e:o:i:s flag
+ COMPREPLY=()
+ local 'redir=@(?([0-9])<|?([0-9&])>?(>)|>&)'
+ _get_comp_words_by_ref -n '<>&' cur prev words cword
+ 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 -n '<>&' cur prev words cword
+ case $flag in
+ exclude='<>&'
+ getopts c:i:n:p:w: flag -n '<>&' cur prev words cword
+ [[ 6 -ge 3 ]]
+ case ${!OPTIND} in
+ vcur=cur
+ let 'OPTIND += 1'
+ [[ 6 -ge 4 ]]
+ case ${!OPTIND} in
+ vprev=prev
+ let 'OPTIND += 1'
+ [[ 6 -ge 5 ]]
+ case ${!OPTIND} in
+ vwords=words
+ let 'OPTIND += 1'
+ [[ 6 -ge 6 ]]
+ case ${!OPTIND} in
+ vcword=cword
+ let 'OPTIND += 1'
+ [[ 6 -ge 7 ]]
+ __get_cword_at_cursor_by_ref '<>&' words cword cur
+ words=()
+ local cword words
+ __reassemble_comp_words_by_ref '<>&' words cword
+ local exclude i j line ref
+ [[ -n <>& ]]
+ exclude='<>&'
+ eval cword=1
++ cword=1
+ [[ -n <>& ]]
+ line='dmesg '
+ (( i=0, j=0 ))
+ (( i < 2 ))
+ [[ 0 -gt 0 ]]
+ ref='words[0]'
+ eval 'words[0]=${!ref}${COMP_WORDS[i]}'
++ words[0]=dmesg
+ line=' '
+ [[ 0 == 1 ]]
+ (( i++, j++ ))
+ (( i < 2 ))
+ [[ 1 -gt 0 ]]
+ [[ '' == +([<>&]) ]]
+ ref='words[1]'
+ eval 'words[1]=${!ref}${COMP_WORDS[i]}'
++ words[1]=
+ line=' '
+ [[ 1 == 1 ]]
+ eval cword=1
++ cword=1
+ (( i++, j++ ))
+ (( i < 2 ))
+ local i cur index=6 'lead=dmesg '
+ [[ 6 -gt 0 ]]
+ [[ -n dmesg  ]]
+ [[ -n dmesg ]]
+ cur='dmesg '
+ (( i = 0 ))
+ (( i <= cword ))
+ [[ 6 -ge 5 ]]
+ [[ dmesg != \d\m\e\s\g ]]
+ [[ 0 -lt 1 ]]
+ local old_size=6
+ cur=' '
+ local new_size=1
+ index=1
+ (( ++i  ))
+ (( i <= cword ))
+ [[ 1 -ge 0 ]]
+ [[ '' != '' ]]
+ [[ 1 -lt 1 ]]
+ (( ++i  ))
+ (( i <= cword ))
+ [[ -n   ]]
+ [[ ! -n '' ]]
+ cur=
+ [[ 1 -lt 0 ]]
+ local words cword cur
+ _upvars -a2 words dmesg '' -v cword 1 -v cur ''
+ ((  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=
+ shift 3
+ ((  0  ))
+ [[ -n cur ]]
+ upvars+=("$vcur")
+ upargs+=(-v $vcur "$cur")
+ [[ -n cword ]]
+ upvars+=("$vcword")
+ upargs+=(-v $vcword "$cword")
+ [[ -n prev ]]
+ [[ 1 -ge 1 ]]
+ upvars+=("$vprev")
+ upargs+=(-v $vprev "${words[cword - 1]}")
+ [[ -n words ]]
+ upvars+=("$vwords")
+ upargs+=(-a${#words[@]} $vwords "${words[@]}")
+ ((  4  ))
+ local cur cword prev words
+ _upvars -v cur '' -v cword 1 -v prev dmesg -a2 words dmesg ''
+ ((  13  ))
+ ((  13  ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval 'cur="$3"'
++ cur=
+ shift 3
+ ((  10  ))
+ case $1 in
+ [[ -n cword ]]
+ unset -v cword
+ eval 'cword="$3"'
++ cword=1
+ shift 3
+ ((  7  ))
+ case $1 in
+ [[ -n prev ]]
+ unset -v prev
+ eval 'prev="$3"'
++ prev=dmesg
+ shift 3
+ ((  4  ))
+ case $1 in
+ [[ -n 2 ]]
+ printf %d 2
+ [[ -n words ]]
+ unset -v words
+ eval 'words=("${@:3:2}")'
++ words=("${@:3:2}")
+ shift 4
+ ((  0  ))
+ _variables
+ [[ '' =~ ^(\$\{?)([A-Za-z0-9_]*)$ ]]
+ return 1
+ [[ '' == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ [[ dmesg == @(?([0-9])<|?([0-9&])>?(>)|>&) ]]
+ local i skip
+ (( i=1 ))
+ (( i < 2 ))
+ [[ '' == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ i=2
+ (( 1 ))
+ (( i < 2 ))
+ [[ 1 -eq 0 ]]
+ prev=dmesg
+ [[ -n '' ]]
+ return 0
+ case $prev in
+ [[ '' == -* ]]

Comment 3 Ville Skyttä 2012-06-13 21:30:50 UTC
(In reply to comment #2)
> what makes me wonder is that F16/F17 have the same version of 
> bash-completion and F16 worked like a charme until upgrade to F17

As said there are bash bugs involved, and the bash version between F16 and F17 is different.

> [harry@srv-rhsoft:~]$ set -x
> ++ printf '\033]0;%s@%s:%s\007' harry srv-rhsoft '~'
> [harry@srv-rhsoft:~]$ dmesg + local compdir=./completions
> + [[ /usr/share/bash-completion/bash_completion == */* ]]
> + compdir=/usr/share/bash-completion/completions
> + . /usr/share/bash-completion/completions/dmesg
> + return 124
> + [[ linux-gnu == *solaris* ]]
> + ssh -4 -2 -C -p 10022 root.net cur prev words cword

Wow, this is not at all what should happen. The two last lines for me are:

+ [[ linux-gnu == *solaris* ]]
+ local cur prev words cword

You don't happen to have the command "local" aliased to "ssh -4 -2 -C -p 10022 root.net"?

Comment 4 Harald Reindl 2012-06-13 21:38:35 UTC
i understood that well, but i saw this problem multiple times in rawhide-vms taht "> filename" was not completed and getting slowly tired of this

> You don't happen to have the command 
> "local" aliased to "ssh -4 -2 -C -p 10022 root.net"?

WTF - yes i had, i had this for years since "which local" did
not say it was used anywhere - indeed this seems to be the problem

i will come back here if it happens without this alias in other combinations

THANK YOU!

Comment 5 Fedora Update System 2012-06-19 17:31:56 UTC
bash-completion-2.0-1.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/bash-completion-2.0-1.fc17

Comment 6 Fedora Update System 2012-06-20 19:31:43 UTC
Package bash-completion-2.0-1.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing bash-completion-2.0-1.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-9735/bash-completion-2.0-1.fc17
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2012-06-22 18:55:49 UTC
bash-completion-2.0-1.fc17 has been pushed to the Fedora 17 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.