Red Hat Bugzilla – Bug 70819
TAB-completion of `pwd`-started pathname never completes
Last modified: 2007-04-18 12:45:15 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020724
Description of problem:
Earlier versions of bash (e.g. in 7.3) would expand `pwd`/ to the current
pathname when TAB-completing them. The current version enters and endless loop.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.Log in as root
2.Type ls `pwd`/anaconda
Actual Results: Nothing happens.
Still nothing happens.
Nothing keeps on happening. :-)
CPU usage goes up as bash uses up a lot of it.
Control-C is the only way to get it out of this loop.
Expected Results: I'd expect it to expand `pwd` into /root, and complete the
pathname to /root/anaconda-ks.cfg
There's nothing special about root or anaconda-ks.cfg, it was just an example
that was readily-available on any Red Hat Linux install. The same problem can
be easily replicated as any other user with any other pathname.
I can't reproduce this problem with bash-2.05b-3. What version are you using?
The same. It's odd. I just had trouble duplicating it myself, but it is surely
there. It seems that it only shows up in the shell started within
gnome-terminal. In a `su -' or `ssh'-started login shell, it works just fine.
I couldn't identify what causes the problem to show up or not, but it occurs in
subst.c:unclosed_pair(), when checking whether the closing backtick is unpaired.
The counter reaches the end of the string, and from then on ADVANCE_CHAR no
longer increments i in the case of MB_CUR_MAX > 1, even though it will do so
just fine when MB_CUR_MAX == 1 (which is the case of a ssh-started bash). The
idiom of testing for mblength < 1 is present in several of the other
multibyte-enabled macros in include/shmbutil.h, so I used it in ADVANCE_CHAR too.
Created attachment 72144 [details]
Implementation of the fix for ADVANCE_CHAR in case it reaches the end of the string
Fixed package is bash-2.05b-4.
Confirmed fixed in bash-2.05b-5