mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-01 01:20:00 +02:00
posix change for cd; fix for command word completion where the command names contain spaces; fix for error-and-output redirection with quoted filename
This commit is contained in:
@@ -9105,3 +9105,54 @@ test.c
|
||||
|
||||
support/config.guess,support/config.sub,support/config.rpath
|
||||
- new versions, imported from gnulib
|
||||
|
||||
4/5
|
||||
---
|
||||
doc/bashref.texi
|
||||
- update compatibility, posix mode, and bourne shell sections for
|
||||
bash-5.3-alpha release
|
||||
|
||||
version.c
|
||||
- update copyright date to 2024
|
||||
|
||||
[bash-5.3-alpha frozen]
|
||||
|
||||
4/6
|
||||
---
|
||||
builtins/cd.def
|
||||
- cd_builtin: a null pathname argument is now an error; POSIX interp
|
||||
1047
|
||||
|
||||
variables.c
|
||||
- makunbound: revert change from 7/10/2023 about preserving the export
|
||||
attribute when unsetting a local variable in light of POSIX interp
|
||||
1806
|
||||
|
||||
4/8
|
||||
---
|
||||
bashline.c
|
||||
- command_word_completion_function: we don't need to perform an extra
|
||||
comparison against what rl_filename_completion_function returns if
|
||||
we are searching $PATH for executable completions
|
||||
- command_word_completion_function: if a directory name from $PATH
|
||||
contains characters that need to be quoted, quote them and set
|
||||
rl_completion_found_quote to force rl_filename_completion_function
|
||||
to dequote the entire pathname
|
||||
- command_word_completion_function: since the directory name from $PATH
|
||||
is not quoted, use the dequoted hint to construct the full pathname
|
||||
to pass to rl_filename_completion_function (possibly after quoting it
|
||||
From https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=306043
|
||||
|
||||
4/10
|
||||
----
|
||||
redir.h
|
||||
- RX_EXPANDED: flag set when translating redirects to their final form;
|
||||
indicates the redirection should not be expanded again
|
||||
|
||||
redir.c
|
||||
- do_redirection_internal: when translating a redirect into
|
||||
r_err_and_out, set the RX_EXPANDED flag so the filename doesn't
|
||||
get expanded again.
|
||||
Fixes bug reported by squeaky <q7d9y9muja@liamekaens.com>
|
||||
|
||||
|
||||
|
||||
@@ -254,7 +254,6 @@ lib/glob/xmbsrtowcs.c f
|
||||
lib/glob/collsyms.h f
|
||||
lib/glob/doc/Makefile f
|
||||
lib/glob/doc/glob.texi f
|
||||
lib/glob/ndir.h f
|
||||
lib/intl/Makefile.in f
|
||||
lib/intl/VERSION f
|
||||
lib/intl/ref-add.sin f
|
||||
@@ -667,7 +666,6 @@ CWRU/misc/sigstat.c f
|
||||
CWRU/misc/bison f
|
||||
CWRU/misc/errlist.c f
|
||||
CWRU/misc/hpux10-dlfcn.h f
|
||||
CWRU/PLATFORMS f
|
||||
CWRU/README f
|
||||
CWRU/changelog f
|
||||
CWRU/sh-redir-hack f
|
||||
@@ -995,6 +993,7 @@ tests/array29.sub f
|
||||
tests/array30.sub f
|
||||
tests/array31.sub f
|
||||
tests/array32.sub f
|
||||
tests/array33.sub f
|
||||
tests/array-at-star f
|
||||
tests/array2.right f
|
||||
tests/assoc.tests f
|
||||
@@ -1037,6 +1036,7 @@ tests/builtins8.sub f
|
||||
tests/builtins9.sub f
|
||||
tests/builtins10.sub f
|
||||
tests/builtins11.sub f
|
||||
tests/builtins12.sub f
|
||||
tests/source1.sub f
|
||||
tests/source2.sub f
|
||||
tests/source3.sub f
|
||||
@@ -1212,6 +1212,7 @@ tests/func1.sub f
|
||||
tests/func2.sub f
|
||||
tests/func3.sub f
|
||||
tests/func4.sub f
|
||||
tests/func5.sub f
|
||||
tests/getopts.tests f
|
||||
tests/getopts.right f
|
||||
tests/getopts1.sub f
|
||||
|
||||
+1
-1
@@ -1254,7 +1254,7 @@ subst.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
|
||||
subst.o: make_cmd.h subst.h sig.h pathnames.h externs.h parser.h
|
||||
subst.o: flags.h jobs.h siglist.h execute_cmd.h ${BASHINCDIR}/filecntl.h trap.h pathexp.h
|
||||
subst.o: mailcheck.h input.h $(DEFSRC)/getopt.h $(DEFSRC)/common.h
|
||||
subst.o: bashline.h bashhist.h ${GLOB_LIBSRC}/strmatch.h
|
||||
subst.o: bashline.h bashhist.h ${GLOB_LIBSRC}/strmatch.h redir.h
|
||||
subst.o: ${BASHINCDIR}/chartypes.h
|
||||
subst.o: ${BASHINCDIR}/shmbutil.h ${BASHINCDIR}/shmbchar.h
|
||||
subst.o: ${DEFDIR}/builtext.h
|
||||
|
||||
+33
-3
@@ -1969,6 +1969,7 @@ command_word_completion_function (const char *hint_text, int state)
|
||||
static int mapping_over, local_index, searching_path, hint_is_dir;
|
||||
static int old_glob_ignore_case, globpat;
|
||||
static SHELL_VAR **varlist = (SHELL_VAR **)NULL;
|
||||
static int orig_found_quote;
|
||||
#if defined (ALIAS)
|
||||
static alias_t **alias_list = (alias_t **)NULL;
|
||||
#endif /* ALIAS */
|
||||
@@ -2078,7 +2079,9 @@ command_word_completion_function (const char *hint_text, int state)
|
||||
|
||||
if (rl_completion_found_quote && rl_completion_quote_character == 0)
|
||||
dequoted_hint = bash_dequote_filename (hint, 0);
|
||||
|
||||
|
||||
orig_found_quote = rl_completion_found_quote;
|
||||
|
||||
path = path_value ("PATH", 0);
|
||||
path_index = dot_in_path = 0;
|
||||
|
||||
@@ -2242,6 +2245,8 @@ globword:
|
||||
{
|
||||
char *current_path;
|
||||
|
||||
rl_completion_found_quote = orig_found_quote;
|
||||
|
||||
/* Get the next directory from the path. If there is none, then we
|
||||
are all done. */
|
||||
if (path == 0 || path[path_index] == 0 ||
|
||||
@@ -2273,13 +2278,28 @@ globword:
|
||||
free (filename_hint);
|
||||
fnhint = filename_hint = (char *)NULL;
|
||||
|
||||
filename_hint = sh_makepath (current_path, hint, 0);
|
||||
/* We can have characters that need to be quoted in either the $PATH
|
||||
element or the dequoted filename. Since we only want to call a
|
||||
quoting function on the entire path once, and we've already dequoted
|
||||
the hint text we were passed (dequoted_hint), build the path using
|
||||
the dequoted hint text and quote it if we need to. Readline will only
|
||||
call the dequoting function if rl_completion_found_quote != 0, so
|
||||
we have to force it. */
|
||||
|
||||
filename_hint = sh_makepath (current_path, dequoted_hint, 0);
|
||||
/* Need a quoted version (though it doesn't matter much in most
|
||||
cases) because rl_filename_completion_function dequotes the
|
||||
filename it gets, assuming that it's been quoted as part of
|
||||
the input line buffer. */
|
||||
#if 1
|
||||
if (strpbrk (filename_hint, "\"'\\"))
|
||||
fnhint = sh_backslash_quote (filename_hint, filename_bstab, 0);
|
||||
#else
|
||||
if (strpbrk (filename_hint, rl_filename_quote_characters))
|
||||
#endif
|
||||
{
|
||||
fnhint = sh_backslash_quote (filename_hint, filename_bstab, 0);
|
||||
rl_completion_found_quote = 4; /* just has to be non-zero */
|
||||
}
|
||||
else
|
||||
fnhint = filename_hint;
|
||||
free (current_path); /* XXX */
|
||||
@@ -2333,10 +2353,20 @@ globword:
|
||||
if (temp)
|
||||
{
|
||||
temp++;
|
||||
#if 0
|
||||
/* We're comparing an unquoted filename read from the directory
|
||||
(temp, returned by rl_filename_completion_function) against
|
||||
the possibly-quoted hint text. We should compare against
|
||||
the dequoted hint text. */
|
||||
if (igncase == 0)
|
||||
freetemp = match = strncmp (temp, hint, hint_len) == 0;
|
||||
else
|
||||
freetemp = match = strncasecmp (temp, hint, hint_len) == 0;
|
||||
#else
|
||||
/* Why duplicate the comparison rl_filename_completion_function
|
||||
already performs? */
|
||||
freetemp = match = 1;
|
||||
#endif
|
||||
if (match)
|
||||
temp = savestring (temp);
|
||||
}
|
||||
|
||||
@@ -330,13 +330,11 @@ cd_builtin (WORD_LIST *list)
|
||||
return (EX_USAGE);
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
else if (list->word->word[0] == '\0')
|
||||
{
|
||||
builtin_error (_("null directory")); /* POSIX cd implementation defined */
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
#endif
|
||||
else if (list->word->word[0] == '-' && list->word->word[1] == '\0')
|
||||
{
|
||||
/* This is `cd -', equivalent to `cd $OLDPWD' */
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
You are a software developer writing a widely-user open source software package. You are discussing a new feature with a user. Write an email declining the user's proposal because it is too complicated.
|
||||
|
||||
|
||||
@@ -829,6 +829,7 @@ do_redirection_internal (REDIRECT *redirect, int flags, char **fnp)
|
||||
sd = redirect->redirector;
|
||||
rd.filename = make_bare_word (redirectee_word);
|
||||
new_redirect = make_redirection (sd, r_err_and_out, rd, 0);
|
||||
new_redirect->flags |= RX_EXPANDED; /* we already expanded this */
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -883,7 +884,10 @@ do_redirection_internal (REDIRECT *redirect, int flags, char **fnp)
|
||||
oflags = redirectee->flags;
|
||||
redirectee->flags |= W_NOGLOB;
|
||||
}
|
||||
redirectee_word = redirection_expand (redirectee);
|
||||
if ((redirect->flags & RX_EXPANDED) == 0)
|
||||
redirectee_word = redirection_expand (redirectee);
|
||||
else
|
||||
redirectee_word = savestring (redirectee->word);
|
||||
if (posixly_correct && interactive_shell == 0)
|
||||
redirectee->flags = oflags;
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#define RX_USER 0x10
|
||||
#define RX_SAVCLEXEC 0x20 /* set close-on-exec off in restored fd even though saved on has it on */
|
||||
#define RX_SAVEFD 0x40 /* fd used to save another even if < SHELL_FD_BASE */
|
||||
#define RX_EXPANDED 0x80 /* this redirection has already been expanded */
|
||||
|
||||
extern void redirection_error (REDIRECT *, int, char *);
|
||||
extern int do_redirections (REDIRECT *, int);
|
||||
|
||||
@@ -413,7 +413,7 @@ SEE ALSO
|
||||
bash(1)
|
||||
|
||||
IMPLEMENTATION
|
||||
Copyright (C) 2022 Free Software Foundation, Inc.
|
||||
Copyright (C) 2024 Free Software Foundation, Inc.
|
||||
|
||||
These shell commands are defined internally. Type `help' to see this list.
|
||||
Type `help name' to find out more about the function `name'.
|
||||
|
||||
@@ -3982,16 +3982,10 @@ makunbound (const char *name, VAR_CONTEXT *vc)
|
||||
{
|
||||
dispose_variable_value (old_var);
|
||||
|
||||
#if 0
|
||||
/* Reset the attributes. Preserve the export attribute if the variable
|
||||
came from a temporary environment. Make sure it stays local, and
|
||||
make it invisible. */
|
||||
old_var->attributes = (exported_p (old_var) && tempvar_p (old_var)) ? att_exported : 0;
|
||||
#else /* TAG:bash-5.3 look at this again */
|
||||
/* Reset the attributes, but preserve the export attribute.
|
||||
Make sure it stays local, and make it invisible. */
|
||||
old_var->attributes = exported_p (old_var) ? att_exported : 0;
|
||||
#endif
|
||||
VSETATTR (old_var, att_local);
|
||||
VSETATTR (old_var, att_invisible);
|
||||
var_setvalue (old_var, (char *)NULL);
|
||||
|
||||
Reference in New Issue
Block a user