[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Bug in directory completion
From: |
achurch |
Subject: |
[PATCH] Bug in directory completion |
Date: |
Tue, 09 Dec 2003 13:48:27 JST |
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
-DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFIG_H -I. -I/pkg/bash/include -I.
-I./include -I./lib -O2 -march=pentium4 -msse2
uname output: Linux crystal 2.4.21 #21 Sun Nov 30 21:04:53 JST 2003 i686
unknown unknown Linux
Machine Type: i686-pc-linux-gnu
Bash Version: 2.05b
Patch Level: 0
Release Status: release
Description:
Bash 2.05b (with all official patches applied) improperly appends a
trailing space to non-absolute directory names in command position
when completing with Tab.
Repeat-By:
(1)
$ mkdir foo
$ mkdir foo/bar
$ foo/bar<TAB> # will expand to "foo/bar " instead of "foo/bar/"
(2)
$ PATH=$HOME/foo:$PATH
$ mkdir $HOME/foo
$ cd $HOME/foo
$ mkdir barflorgl # or any name that has no command completions
$ barflorgl<TAB> # will expand to "barflorgl " instead of "barflorgl/"
(3)
$ mkdir uname # or any directory name the same as an existing command
$ uname<TAB> # will expand to "uname " instead of listing "uname" and
# "uname/"
Fix:
The patch below fixes (1). Fixing (2) and (3) will probably take
more extensive reworking of the completion algorithm.
--- bashline.c.old 2003-12-09 11:57:03 +0900
+++ bashline.c 2003-12-09 12:59:11 +0900
@@ -1044,7 +1044,7 @@
}
else
{
-#define CMD_IS_DIR(x) (absolute_pathname(x) == 0 && *(x) != '~' &&
test_for_directory (x))
+#define CMD_IS_DIR(x) (absolute_pathname (x) == 0 && absolute_program (x) ==
0 && *(x) != '~' && test_for_directory (x))
matches = rl_completion_matches (text,
command_word_completion_function);
--- general.c.old 2002-06-13 05:57:55 +0900
+++ general.c 2003-12-09 12:57:59 +0900
@@ -478,7 +478,9 @@
}
/* Return 1 if STRING contains an absolute pathname, else 0. Used by `cd'
- to decide whether or not to look up a directory name in $CDPATH. */
+ to decide whether or not to look up a directory name in $CDPATH, and
+ by command completion to help decide whether a completion should get a
+ trailing slash or space. */
int
absolute_pathname (string)
const char *string;
@@ -500,7 +502,8 @@
/* Return 1 if STRING is an absolute program name; it is absolute if it
contains any slashes. This is used to decide whether or not to look
- up through $PATH. */
+ up through $PATH, and by command completion to help decide whether a
+ completion should get a trailing slash or space. */
int
absolute_program (string)
const char *string;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Bug in directory completion,
achurch <=