Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Unexpected bash completion behavior
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
wilburpan
l33t
l33t


Joined: 21 Jan 2003
Posts: 977

PostPosted: Sat Sep 27, 2003 1:24 am    Post subject: Unexpected bash completion behavior Reply with quote

I recently noticed strange behavior with bash completion. If I use the tab key multiple times on the same command line to complete, on the second or higher time I hit tab the completion does not leave a trailing "/" at the end of the line. I seem to remember that hitting tab would continue to leave trailing slashes if the completion was a directory.

For instance, if I am using tabs to quickly get to /usr/portage/kde-base/kdebase/kdebase-3.2.0_alpha2.ebuild, this is what happens:
Code:
I type:
/usr/port [tab]

The completion works as expected:
"/usr/portage/"

I then type:
kde-b [tab]

The completion looks like this:
"/usr/portage/kdebase " {note trailing space, no trailing slash}

I expect the completion to look like this:
"/usr/portage/kdebase/"

If I keep trying to use [tab] to complete, I keep getting trailing spaces instead of trailing slashes.

This may or may not be related, but I first noticed this after trying to emerge KDE 3.2 alpha packages, but this behavior persists even if I am working in a regular console (no desktop/window manager).
_________________
I'm only hanging out in OTW until I get rid of this stupid l33t ranking.....Crap. That didn't work.
Back to top
View user's profile Send private message
ecatmur
Advocate
Advocate


Joined: 20 Oct 2003
Posts: 3595
Location: Edinburgh

PostPosted: Wed Dec 31, 2003 8:40 pm    Post subject: Reply with quote

Good spot.
I guess it's a bug in /etc/bash_completion.d/gentoo.
Try this patch:
Code:
--- gentoo.completion-20031225  2003-12-27 11:40:37.000000000 +0000
+++ /etc/bash_completion.d/gentoo       2003-12-31 20:32:26.000000000 +0000
@@ -286,7 +286,9 @@
                fi
 
                if [ "${cur}" ]; then
-                       if [ $(echo "${cur}" | grep '/') ]; then
+                       if [[ "${cur} " == @('/'|'.'|'~'|'$')* ]]; then
+                               COMPREPLY=''
+                       elif [ $(echo "${cur}" | grep '/') ]; then
                                setbig=$(compgen -G "${cur}*" | ${sedcmd})"${systemactions}"
                                COMPREPLY=($(echo "${setbig}" | $grepcmd))
                        else
Back to top
View user's profile Send private message
ecatmur
Advocate
Advocate


Joined: 20 Oct 2003
Posts: 3595
Location: Edinburgh

PostPosted: Wed Dec 31, 2003 8:55 pm    Post subject: Reply with quote

Filed a bug: https://bugs.gentoo.org/show_bug.cgi?id=36910
Back to top
View user's profile Send private message
viperlin
Veteran
Veteran


Joined: 15 Apr 2003
Posts: 1319
Location: UK

PostPosted: Wed Dec 31, 2003 9:11 pm    Post subject: Re: Unexpected bash completion behavior Reply with quote

wilburpan wrote:

Must...resist...posting....
One...step...closer...to...getting...stupid...l33t...ranking....


very offtopic but about your .sig

i know exactly what you mean, but i'm close to Veteran now :-)
Back to top
View user's profile Send private message
wilburpan
l33t
l33t


Joined: 21 Jan 2003
Posts: 977

PostPosted: Tue Jan 13, 2004 1:42 am    Post subject: Reply with quote

Thanks for the patch -- I'll try it tomorrow. Somehow I missed this thread when it came out.

Regarding my .sig: So I guess that the good news is that a stupid l33t ranking, like most things, shall pass eventually.

The bad news is that I guess I'll have to start hanging out in Off The Wall. :evil:
_________________
I'm only hanging out in OTW until I get rid of this stupid l33t ranking.....Crap. That didn't work.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum