Re: dd and bash_completion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Thu, Sep 24, 2009 at 2:41 PM, Thomas Göbel <goebel.thomas@xxxxxxx> wrote:
> * <aaronmgriffin@xxxxxxxxx> [24.09.2009 21:27]:
>> On Thu, Sep 24, 2009 at 7:39 AM, Thomas Bächler <thomas@xxxxxxxxxxxxx> wrote:
>> > Xavier schrieb:
>> >>
>> >> I just tried git, before realizing there was a good pkgbuild for it :
>> >> http://aur.archlinux.org/packages.php?ID=27520
>> >>
>> >> and it does not work either.
>> >
>> > I also checked the git code for dd and it is identical to the 1.0 code.
>>
>> Found the issue. It's not dd specific at all, it has to do with bash's
>> setting of the COMP_WORDBREAKS
>>
>> $ echo $COMP_WORDBREAKS
>> "'><=;|&(:
>>
>> These are word separators for completion words. The command "dd
>> if=<tab>" contains 3 completion words - "dd", "if", and "=" with the
>> current word being "=".
>>
>> If you do the following, it works:
>>
>> $ export COMP_WORDBREAKS=${COMP_WORDBREAKS//=}
>> $ dd if=<tab>
>>
>> I suggest reporting this is a bug in bash_completion, as fixing this
>> is rather complex
>
> Didn`t work for me. dd if=<tab> shows me the content of the actual
> directory. If i now type /ho<tab> "dd if=/ho<tab>" the string if=/ho
> will be displaced to "dd /home".

Ah, well obviously it's more complicated than I though.

The point is, that the COMP_WORDBREAKS setting, is splitting "if="
into "if" and "=", which doesn't match the case statement.

If we want to fix this just for dd, we need to match the "=" and then
get the previous word in COMP_WORDS
   prev="${COMP_WORDS[$(($COMP_CWORD -1))]}"

Aaaaand... that doesn't work. I dunno, this is confusing, but the
point is, it's splitting on the "if=" and thus can never complete as
is


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux