[Top][All Lists]

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

Wrong prompt and incorrect parsing if completion is used

From: Egmont Koblinger
Subject: Wrong prompt and incorrect parsing if completion is used
Date: Mon, 9 Aug 2010 18:02:40 +0200


I've found a weird behavior.  In some circumstances, if I use TAB completion
during typing a command line, the final command is parsed differently than
if I typed it all along.

I'm on Ubuntu Lucid.  The bug described below occurs only if I use the
bash-completion package (that is, I source /etc/bash_completion - it can be
found at http://packages.ubuntu.com/lucid/bash-completion ).  However, the
behavior suggests that probably it's a bug in bash itself, not the
bash-completion package.

Type the following command line:
ps1$ cd /bin/`
(note the trailing back tick) then press Enter.
The behavior is: the secondary prompt is printed, as the command should
continue. Correct.

Start over, type the following (replace TAB by pressing the TAB key):
ps1$ cd /biTAB`
The auto-completed command looks exactly as the manually typed one, hence
the expected behavior is the same.  However, press Enter, and the primary
prompt gets displayed. Logically, however, this is still a secondary prompt
(if you type another command, or press ^D, the behavior suggests this).

Start over, type the following:
ps1$ cd /biTAB`
ps1$ cd /sbTAB`
The following error is printed:
bash: bad substitution: no closing `}' in "${to`
cd /sbin/`

Note that bash_completion doesn't have a shell variable named "to", it only
has "toks", so seems like parsing the file pretty much goes off the track.
 The error message cuts this word in half at a position depending on the
length of the directory pathnames.

Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
-DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/lib   -g -O2
uname output: Linux [somehostname] 2.6.32 SMP [somedate] x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.1
Patch Level: 5
Release Status: release


reply via email to

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