[arch-general] dd and bash_completion

Aaron Griffin aaronmgriffin at gmail.com
Thu Sep 24 16:15:22 EDT 2009


On Thu, Sep 24, 2009 at 2:41 PM, Thomas Göbel <goebel.thomas at gmx.net> wrote:
> * <aaronmgriffin at gmail.com> [24.09.2009 21:27]:
>> On Thu, Sep 24, 2009 at 7:39 AM, Thomas Bächler <thomas at archlinux.org> 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


More information about the arch-general mailing list