Bug 709907 - bash 4.2 completion mishandles variables
Summary: bash 4.2 completion mishandles variables
Keywords:
Status: CLOSED DUPLICATE of bug 679696
Alias: None
Product: Fedora
Classification: Fedora
Component: bash
Version: 15
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Roman Rakus
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-06-01 22:51 UTC by Don Lindsay
Modified: 2014-01-13 00:13 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-06-07 11:06:26 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Don Lindsay 2011-06-01 22:51:49 UTC
Description of problem:

If I have an environment variable "foo" pointing at a directory, and type eg

   ls $foo/RE

and then hit TAB, I would expect it to look in $foo and find the name README. Which it does (even if the CWD does not contain such a name). So it looks as if bash really is searching in directory $foo. But then it transforms the line to:

   ls \$foo/README

and since the backslash makes the "$" literal, 'ls' says there is no such file.
This is wrong. Either the $ is literal or it isn't, but it's wrong to treat it both ways. The former (and desired) behavior was non-literal, ie expand $foo to its contents.




Version-Release number of selected component (if applicable):

I upgraded Fedora from f14 to f15 and got bash-4.2.10-2.fc15.x86_64. This is from inside a gnome-terminal. My bashrc is unchanged, so if some controlling variable has been altered, it wasn't my doing.

Comment 1 Roman Rakus 2011-06-02 12:13:16 UTC

*** This bug has been marked as a duplicate of bug 679696 ***

Comment 2 Don Lindsay 2011-06-02 19:06:19 UTC
No, it is not a duplicate of 679696. 

That bug questioned whether <tab> after $PWD should echo eg "/home/user". I have no such concern. I don't care what's echoed. 

Here is an example of the issue. I have variable $sk containing a directory name. In that directory is a file "susan.blackmore". I wish to list it. I type:

   ls $sk/susan<tab>

and I get

   ls: cannot access $sk/susan.blackmore: No such file or directory

I do not care about whether you echo expansions. I put the long, complicated directory name in a variable precisely because I didn't want to see it. I'm not interested in the directory. The focus is that I want to tell a filename to some tool, and you're generating an invalid representation.

What I care about is that "ls", "emacs", "rm" and so on are now giving me error messages when they didn't with previous bash releases. Unless you think that "ls", "emacs", and "rm" are the things that should be fixed, thus getting you off the hook ??

Comment 3 Roman Rakus 2011-06-07 11:06:26 UTC
(In reply to comment #2)
> No, it is not a duplicate of 679696. 
Yes it is
> 
> That bug questioned whether <tab> after $PWD should echo eg "/home/user". I
> have no such concern. I don't care what's echoed. 
> 
The bug is about tab completion. As well as this bug.
> Here is an example of the issue. I have variable $sk containing a directory
> name. In that directory is a file "susan.blackmore". I wish to list it. I type:
> 
>    ls $sk/susan<tab>
You see? Tab -> tab completion.
> 
> and I get
> 
>    ls: cannot access $sk/susan.blackmore: No such file or directory
Really? After hitting tab? I don't think so.
> 
> I do not care about whether you echo expansions. I put the long, complicated
> directory name in a variable precisely because I didn't want to see it. I'm not
> interested in the directory. The focus is that I want to tell a filename to
> some tool, and you're generating an invalid representation.
> 
> What I care about is that "ls", "emacs", "rm" and so on are now giving me error
> messages when they didn't with previous bash releases. Unless you think that
> "ls", "emacs", and "rm" are the things that should be fixed, thus getting you
> off the hook ??

*** This bug has been marked as a duplicate of bug 679696 ***


Note You need to log in before you can comment on or make changes to this bug.