mirror of
https://git.freebsd.org/ports.git
synced 2025-05-31 02:16:27 -04:00
"In certain cases, Bash appends a space instead of a slash to a directory name
relative to the current directory when performing command name completion. This affects partial completion of intermediate directory names." Fix this. Bash PR: http://mail.gnu.org/pipermail/bug-bash/2002-July/004789.html Obtained from: http://www.geocrawler.com/mail/msg.php3?msg_id=9514404&list=342
This commit is contained in:
parent
c084c2e753
commit
ce9d222b68
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=65876
3 changed files with 102 additions and 24 deletions
|
@ -1,6 +1,32 @@
|
|||
--- bashline.c.orig Wed May 8 04:52:42 2002
|
||||
+++ bashline.c Wed Jul 24 05:54:07 2002
|
||||
@@ -1873,10 +1873,6 @@
|
||||
--- bashline.c.deo Tue May 7 12:52:42 2002
|
||||
+++ bashline.c Sun Sep 8 18:17:30 2002
|
||||
@@ -1044,6 +1044,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
+#define CMD_IS_DIR(x) (absolute_pathname(x) == 0 && *(x) != '~' && test_for_directory (x))
|
||||
matches = rl_completion_matches (text, command_word_completion_function);
|
||||
/* If we are attempting command completion and nothing matches, we
|
||||
do not want readline to perform filename completion for us. We
|
||||
@@ -1052,7 +1053,7 @@
|
||||
filenames and leave directories in the match list. */
|
||||
if (matches == (char **)NULL)
|
||||
rl_ignore_some_completions_function = bash_ignore_filenames;
|
||||
- else if (matches[1] == 0 && *matches[0] != '/')
|
||||
+ else if (matches[1] == 0 && CMD_IS_DIR(matches[0]))
|
||||
/* Turn off rl_filename_completion_desired so readline doesn't
|
||||
append a slash if there is a directory with the same name
|
||||
in the current directory, or other filename-specific things.
|
||||
@@ -1061,7 +1062,7 @@
|
||||
looking in the current directory anyway, so there's no
|
||||
conflict. */
|
||||
rl_filename_completion_desired = 0;
|
||||
- else if (matches[0] && matches[1] && STREQ (matches[0], matches[1]) && *matches[0] != '/')
|
||||
+ else if (matches[0] && matches[1] && STREQ (matches[0], matches[1]) && CMD_IS_DIR (matches[0]))
|
||||
/* There are multiple instances of the same match (duplicate
|
||||
completions haven't yet been removed). In this case, all of
|
||||
the matches will be the same, and the duplicate removal code
|
||||
@@ -1873,10 +1874,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,7 +37,7 @@
|
|||
/* If FIGNORE is set, then don't match files with the given suffixes when
|
||||
completing filenames. If only one of the possibilities has an acceptable
|
||||
suffix, delete the others, else just return and let the completer
|
||||
@@ -1901,10 +1897,15 @@
|
||||
@@ -1901,10 +1898,15 @@
|
||||
{
|
||||
char **newnames;
|
||||
int idx, nidx;
|
||||
|
@ -29,7 +55,7 @@
|
|||
|
||||
/* If there is only one completion, see if it is acceptable. If it is
|
||||
not, free it up. In any case, short-circuit and return. This is a
|
||||
@@ -1912,13 +1913,12 @@
|
||||
@@ -1912,13 +1914,12 @@
|
||||
if there is only one completion; it is the completion itself. */
|
||||
if (names[1] == (char *)0)
|
||||
{
|
||||
|
@ -49,7 +75,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
@@ -1927,10 +1927,11 @@
|
||||
@@ -1927,10 +1928,11 @@
|
||||
for (nidx = 1; names[nidx]; nidx++)
|
||||
;
|
||||
newnames = strvec_create (nidx + 1);
|
||||
|
@ -65,7 +91,7 @@
|
|||
|
||||
newnames[0] = names[0];
|
||||
for (idx = nidx = 1; names[idx]; idx++)
|
||||
@@ -1938,11 +1939,10 @@
|
||||
@@ -1938,11 +1940,10 @@
|
||||
if ((*name_func) (names[idx]))
|
||||
newnames[nidx++] = names[idx];
|
||||
else
|
||||
|
@ -81,7 +107,7 @@
|
|||
}
|
||||
|
||||
newnames[nidx] = (char *)NULL;
|
||||
@@ -1950,21 +1950,23 @@
|
||||
@@ -1950,21 +1951,23 @@
|
||||
/* If none are acceptable then let the completer handle it. */
|
||||
if (nidx == 1)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,32 @@
|
|||
--- bashline.c.orig Wed May 8 04:52:42 2002
|
||||
+++ bashline.c Wed Jul 24 05:54:07 2002
|
||||
@@ -1873,10 +1873,6 @@
|
||||
--- bashline.c.deo Tue May 7 12:52:42 2002
|
||||
+++ bashline.c Sun Sep 8 18:17:30 2002
|
||||
@@ -1044,6 +1044,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
+#define CMD_IS_DIR(x) (absolute_pathname(x) == 0 && *(x) != '~' && test_for_directory (x))
|
||||
matches = rl_completion_matches (text, command_word_completion_function);
|
||||
/* If we are attempting command completion and nothing matches, we
|
||||
do not want readline to perform filename completion for us. We
|
||||
@@ -1052,7 +1053,7 @@
|
||||
filenames and leave directories in the match list. */
|
||||
if (matches == (char **)NULL)
|
||||
rl_ignore_some_completions_function = bash_ignore_filenames;
|
||||
- else if (matches[1] == 0 && *matches[0] != '/')
|
||||
+ else if (matches[1] == 0 && CMD_IS_DIR(matches[0]))
|
||||
/* Turn off rl_filename_completion_desired so readline doesn't
|
||||
append a slash if there is a directory with the same name
|
||||
in the current directory, or other filename-specific things.
|
||||
@@ -1061,7 +1062,7 @@
|
||||
looking in the current directory anyway, so there's no
|
||||
conflict. */
|
||||
rl_filename_completion_desired = 0;
|
||||
- else if (matches[0] && matches[1] && STREQ (matches[0], matches[1]) && *matches[0] != '/')
|
||||
+ else if (matches[0] && matches[1] && STREQ (matches[0], matches[1]) && CMD_IS_DIR (matches[0]))
|
||||
/* There are multiple instances of the same match (duplicate
|
||||
completions haven't yet been removed). In this case, all of
|
||||
the matches will be the same, and the duplicate removal code
|
||||
@@ -1873,10 +1874,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,7 +37,7 @@
|
|||
/* If FIGNORE is set, then don't match files with the given suffixes when
|
||||
completing filenames. If only one of the possibilities has an acceptable
|
||||
suffix, delete the others, else just return and let the completer
|
||||
@@ -1901,10 +1897,15 @@
|
||||
@@ -1901,10 +1898,15 @@
|
||||
{
|
||||
char **newnames;
|
||||
int idx, nidx;
|
||||
|
@ -29,7 +55,7 @@
|
|||
|
||||
/* If there is only one completion, see if it is acceptable. If it is
|
||||
not, free it up. In any case, short-circuit and return. This is a
|
||||
@@ -1912,13 +1913,12 @@
|
||||
@@ -1912,13 +1914,12 @@
|
||||
if there is only one completion; it is the completion itself. */
|
||||
if (names[1] == (char *)0)
|
||||
{
|
||||
|
@ -49,7 +75,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
@@ -1927,10 +1927,11 @@
|
||||
@@ -1927,10 +1928,11 @@
|
||||
for (nidx = 1; names[nidx]; nidx++)
|
||||
;
|
||||
newnames = strvec_create (nidx + 1);
|
||||
|
@ -65,7 +91,7 @@
|
|||
|
||||
newnames[0] = names[0];
|
||||
for (idx = nidx = 1; names[idx]; idx++)
|
||||
@@ -1938,11 +1939,10 @@
|
||||
@@ -1938,11 +1940,10 @@
|
||||
if ((*name_func) (names[idx]))
|
||||
newnames[nidx++] = names[idx];
|
||||
else
|
||||
|
@ -81,7 +107,7 @@
|
|||
}
|
||||
|
||||
newnames[nidx] = (char *)NULL;
|
||||
@@ -1950,21 +1950,23 @@
|
||||
@@ -1950,21 +1951,23 @@
|
||||
/* If none are acceptable then let the completer handle it. */
|
||||
if (nidx == 1)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,32 @@
|
|||
--- bashline.c.orig Wed May 8 04:52:42 2002
|
||||
+++ bashline.c Wed Jul 24 05:54:07 2002
|
||||
@@ -1873,10 +1873,6 @@
|
||||
--- bashline.c.deo Tue May 7 12:52:42 2002
|
||||
+++ bashline.c Sun Sep 8 18:17:30 2002
|
||||
@@ -1044,6 +1044,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
+#define CMD_IS_DIR(x) (absolute_pathname(x) == 0 && *(x) != '~' && test_for_directory (x))
|
||||
matches = rl_completion_matches (text, command_word_completion_function);
|
||||
/* If we are attempting command completion and nothing matches, we
|
||||
do not want readline to perform filename completion for us. We
|
||||
@@ -1052,7 +1053,7 @@
|
||||
filenames and leave directories in the match list. */
|
||||
if (matches == (char **)NULL)
|
||||
rl_ignore_some_completions_function = bash_ignore_filenames;
|
||||
- else if (matches[1] == 0 && *matches[0] != '/')
|
||||
+ else if (matches[1] == 0 && CMD_IS_DIR(matches[0]))
|
||||
/* Turn off rl_filename_completion_desired so readline doesn't
|
||||
append a slash if there is a directory with the same name
|
||||
in the current directory, or other filename-specific things.
|
||||
@@ -1061,7 +1062,7 @@
|
||||
looking in the current directory anyway, so there's no
|
||||
conflict. */
|
||||
rl_filename_completion_desired = 0;
|
||||
- else if (matches[0] && matches[1] && STREQ (matches[0], matches[1]) && *matches[0] != '/')
|
||||
+ else if (matches[0] && matches[1] && STREQ (matches[0], matches[1]) && CMD_IS_DIR (matches[0]))
|
||||
/* There are multiple instances of the same match (duplicate
|
||||
completions haven't yet been removed). In this case, all of
|
||||
the matches will be the same, and the duplicate removal code
|
||||
@@ -1873,10 +1874,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,7 +37,7 @@
|
|||
/* If FIGNORE is set, then don't match files with the given suffixes when
|
||||
completing filenames. If only one of the possibilities has an acceptable
|
||||
suffix, delete the others, else just return and let the completer
|
||||
@@ -1901,10 +1897,15 @@
|
||||
@@ -1901,10 +1898,15 @@
|
||||
{
|
||||
char **newnames;
|
||||
int idx, nidx;
|
||||
|
@ -29,7 +55,7 @@
|
|||
|
||||
/* If there is only one completion, see if it is acceptable. If it is
|
||||
not, free it up. In any case, short-circuit and return. This is a
|
||||
@@ -1912,13 +1913,12 @@
|
||||
@@ -1912,13 +1914,12 @@
|
||||
if there is only one completion; it is the completion itself. */
|
||||
if (names[1] == (char *)0)
|
||||
{
|
||||
|
@ -49,7 +75,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
@@ -1927,10 +1927,11 @@
|
||||
@@ -1927,10 +1928,11 @@
|
||||
for (nidx = 1; names[nidx]; nidx++)
|
||||
;
|
||||
newnames = strvec_create (nidx + 1);
|
||||
|
@ -65,7 +91,7 @@
|
|||
|
||||
newnames[0] = names[0];
|
||||
for (idx = nidx = 1; names[idx]; idx++)
|
||||
@@ -1938,11 +1939,10 @@
|
||||
@@ -1938,11 +1940,10 @@
|
||||
if ((*name_func) (names[idx]))
|
||||
newnames[nidx++] = names[idx];
|
||||
else
|
||||
|
@ -81,7 +107,7 @@
|
|||
}
|
||||
|
||||
newnames[nidx] = (char *)NULL;
|
||||
@@ -1950,21 +1950,23 @@
|
||||
@@ -1950,21 +1951,23 @@
|
||||
/* If none are acceptable then let the completer handle it. */
|
||||
if (nidx == 1)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue