Bug 831835 - cur: command not found / no completion for "> filename"
cur: command not found / no completion for "> filename"
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: bash-completion (Show other bugs)
17
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Ville Skyttä
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-13 16:54 EDT by Harald Reindl
Modified: 2012-06-22 14:55 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-06-22 14:55:49 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Harald Reindl 2012-06-13 16:54:12 EDT
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 17:13:17 EDT
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 17:20:47 EDT
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@local.rhsoft.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 17:30:50 EDT
(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@local.rhsoft.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@local.rhsoft.net"?
Comment 4 Harald Reindl 2012-06-13 17:38:35 EDT
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@local.rhsoft.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 13:31:56 EDT
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 15:31:43 EDT
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 14:55:49 EDT
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.