bug-bash
[Top][All Lists]
Advanced

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

Re: Serious tab completion bug


From: Chet Ramey
Subject: Re: Serious tab completion bug
Date: Sun, 08 Mar 2015 16:46:18 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

On 3/6/15 4:54 PM, Joseph Graham wrote:
> Hi,
> 
> I don't know what the etiquette is for using this mailing list but I hope 
> it's OK to just get straight to the bug.
> 
> *STEPS TO REPRODUCE*
> 1. run the following commands to get everything set up:
>    $ touch hiya
>    $ mkdir '$HOME'
>    $ touch '$HOME/hiya'
> 2. Now to reproduce the bug, type:
>    $ rm "$HOME/hi
>    THEN PRESS TAB!
>    It incorrectly escapes the $ resulting in:
>    $ rm "\$HOME/hiya"
>    If the user does not notice and presses return it will DELETE THE 
> WRONG FILE!!!

Thanks for the report.  This isn't a bug; it's intentional behavior.  You
have presented bash with an ambiguous situation: it doesn't know whether
or not you want to look for a filename in the current directory or perform
variable expansion.

Bash assumes you want filename completion if there's an existing pathname
matching the string you typed, so it treats your scenario as filename
completion rather than variable expansion.

Bash has behaved this way since bash-3.0, the result of a bug report
received back in July, 2004.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]