mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-04 10:50:50 +02:00
fix for leak when completing command word with glob pattern that matches multiple files; preserve export attribute when unsetting local variable in case it is reset; fix for using nl_langinfo when performing charset conversions
This commit is contained in:
@@ -7124,3 +7124,22 @@ jobs.c
|
||||
that we use IS_ASYNC to determine whether to give the terminal
|
||||
back to the shell's process group.
|
||||
From a report by Grisha Levit <grishalevit@gmail.com>
|
||||
|
||||
bashline.c
|
||||
- command_word_completion_function: if we have a glob pattern that
|
||||
expands to multiple words, dispose of the list before returning NULL.
|
||||
From a report by Grisha Levit <grishalevit@gmail.com>
|
||||
|
||||
variables.c
|
||||
- makunbound: if we're unsetting a local variable, preserve the export
|
||||
attribute even if the variable's not in the temporary environment
|
||||
Tentative fix, compatible with other POSIX shells (except the BSD
|
||||
variants of ash)
|
||||
|
||||
7/12
|
||||
----
|
||||
lib/sh/unicode.c
|
||||
- include <langinfo.h> if HAVE_LANGINFO_CODESET is defined, use
|
||||
nl_langinfo (CODESET) if HAVE_LANGINFO_CODESET is define, since
|
||||
we no longer check for nl_langinfo. This is what locale.c does.
|
||||
|
||||
|
||||
@@ -973,7 +973,7 @@ tests/assoc16.sub f
|
||||
tests/assoc17.sub f
|
||||
tests/assoc18.sub f
|
||||
tests/assoc19.sub f
|
||||
`tests/attr.tests f
|
||||
tests/attr.tests f
|
||||
tests/attr.right f
|
||||
tests/attr1.sub f
|
||||
tests/attr2.sub f
|
||||
|
||||
+5
-1
@@ -2192,7 +2192,11 @@ globword:
|
||||
local_index = 0;
|
||||
|
||||
if (glob_matches[1] && rl_completion_type == TAB) /* multiple matches are bad */
|
||||
return ((char *)NULL);
|
||||
{
|
||||
strvec_dispose (glob_matches);
|
||||
glob_matches = (char **)NULL;
|
||||
return ((char *)NULL);
|
||||
}
|
||||
}
|
||||
|
||||
while (val = glob_matches[local_index++])
|
||||
|
||||
+5
-1
@@ -35,6 +35,10 @@
|
||||
# include <iconv.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LANGINFO_CODESET
|
||||
# include <langinfo.h>
|
||||
#endif
|
||||
|
||||
#include <xmalloc.h>
|
||||
|
||||
#ifndef USHORT_MAX
|
||||
@@ -267,7 +271,7 @@ u32cconv (unsigned long c, char *s)
|
||||
{
|
||||
#if HAVE_LOCALE_CHARSET
|
||||
charset = locale_charset ();
|
||||
#elif HAVE_NL_LANGINFO
|
||||
#elif HAVE_LANGINFO_CODESET
|
||||
charset = nl_langinfo (CODESET);
|
||||
#else
|
||||
charset = stub_charset ();
|
||||
|
||||
@@ -3942,10 +3942,16 @@ makunbound (const char *name, VAR_CONTEXT *vc)
|
||||
FREE (nameref_cell (old_var));
|
||||
else
|
||||
FREE (value_cell (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