Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 408425 - app-shells/bash-4.2_p20 has weird $VAR completion behavior
Summary: app-shells/bash-4.2_p20 has weird $VAR completion behavior
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-16 00:35 UTC by Maxim Kammerer
Modified: 2013-01-01 22:56 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maxim Kammerer 2012-03-16 00:35:03 UTC
In bash-4.1_p9[net,nls] (same readline version):
  VAR=/tmp
  echo $VA[hit Tab] -> $VAR
  echo $VAR/[hit Tab] -> /tmp/
  echo $VAR/[hit Tab twice] -> /tmp/[completions are shown]

In bash-4.2_p20[net,nls] with readline-6.2_p1:
  VAR=/tmp
  echo $VA[hit Tab] -> $VAR
  echo $VAR/[hit Tab] -> \$VAR/[completions are shown]

Of course, further completions don't work after that, although if one manually removes the \, completions do work (once, then \ needs to be removed again). It seems that the intention was to make variable-in-path completion work like in tcsh (where variable is not expanded in the command, but is expanded internally for the purpose of path completion), which is a welcome change, but somewhere along the way the variable name becomes "quoted".

There is no mention of the changed behavior at http://tiswww.case.edu/php/chet/bash/NEWS. The behavior also seems independent of INPUTRC settings.

As a side-note, completion of $VA to $VAR probably should add a terminating / instead of a space if $VAR resolves to an existing path, but I guess that would be too blatant copying from tcsh.
Comment 1 SpanKY gentoo-dev 2012-03-18 23:54:20 UTC
this is discussed in the upstream mailing list
Comment 2 Maxim Kammerer 2012-03-19 22:01:05 UTC
Indeed, the summary is here:
http://lists.gnu.org/archive/html/bug-bash/2011-12/msg00079.html

Seems like a classic example of shooting oneself in a foot -- bash-readline interaction prevents the tcsh behavior (expand path internally, but not externally), so they had to choose between either quoting the variable, or expanding it in-line.

The motivation for quoting seems to be Windows filenames with $ in the name, which is strange (the $ would be quoted anyway on Tab-completion), but oh well.
Comment 3 Maxim Kammerer 2013-01-01 22:56:02 UTC
Upstream fix propagated into stable 4.2_p37.