[Bash-completion-devel] Bug#463969: bash-completion: The bug seems to still present in 20080617.5
morita-pub-en-debian at inz.sakura.ne.jp
Wed Jun 25 15:23:46 UTC 2008
On 06/25/2008 11:10 PM, David Paleino wrote:
>> I know what you mean, but IMHO
>> * gdb completion should not completes non existing program name. (e.g. Bash's
>> built-in command names.)
>> * gdb completion should ALSO completes directory names.
> It ALSO completes directory names. But commands in $PATH have precedence, so I
> can't do anything about this.
>> I agree that executing gdb for command in $PATH is common usage.
>> However it is also common that executing gdb for programs under the current
>> For example, recently I run gdb for traceroute that locally built with a
>> debug symbols as follow:
>> $ apt-get source traceroute
>> $ gdb traceroute-2.0.11/traceroute/traceroute
>> If gdb does not complete directory names, I need to type "traceroute-2.0.11"
>> by hand. It's very inconvenient.
> GDB *does* complete directory names. The unfortunate case is having a directory
> name which starts the same as a $PATH command.
>> Therefore, I think it would be better if gdb completes directory names as
>> well as command names.
> Again, it does. Just that command names take precedence.
At long last, I have understand what you mean.
Thanks a lot for your explanation!
$ gdb trace[TAB]
=> traceproto traceroute-nanog.db tracert
traceproto.db traceroute.db tracert.db
$ gdb traceroute[TAB]
=> traceroute traceroute-nanog.db traceroute6
traceroute-nanog traceroute.db traceroute6.db
$ gdb traceroute-[TAB]
=> $ gdb traceroute-nanog Oh my...
$ gdb traceroute-2[TAB]
=> $ gdb traceroute-2.0.11/ I got it!!
BTW, can I make a suggestion?
I read the code for gdb completion, the _gdb function.
It calls compgen -c, I see that is a reason why gdb completes command names.
COMPREPLY=( $( compgen -c -- $cur ) )
Why not add -d option to compgen?
COMPREPLY=( $( compgen -d -c -- $cur ) )
I think adding -d option makes gdb completion better, especially on worst case,
e.g. "traceroute-[TAB]" in above.
Currently, the list of the possible completions does not contain directory
names. It confuses users and menu-completion in readline.
Adding -d option can also helps such cases.
Morita Sho <morita-pub-en-debian at inz.sakura.ne.jp>
More information about the Bash-completion-devel