mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-29 08:29:54 +02:00
fix for memory leak with unset associative array elements; last set of changes to globbing bracket expressions; fix for timing subshell commands
This commit is contained in:
@@ -4495,3 +4495,38 @@ lib/readline/readline.c
|
||||
- readline_initialize_everything: use xmalloc to initialize
|
||||
rl_executing_keyseq, since we use xrealloc to reallocate it and
|
||||
don't check it for NULL anywhere
|
||||
|
||||
subst.c
|
||||
- parameter_brace_expand_word: make sure to update *ESTATEP and pass
|
||||
ES back to the caller even if array_value returns NULL. Fixes
|
||||
memory leak referencing unset associative array elements reported
|
||||
by Ralf Oehler <Ralf@Oehler-Privat.de>; fix from
|
||||
Koichi Murase <myoga.murase@gmail.com>
|
||||
|
||||
11/22
|
||||
-----
|
||||
lib/glob/sm_loop.c
|
||||
- BRACKMATCH: if a backslash appears before a slash in a bracket
|
||||
expression, treat the whole thing as literal and try to match the
|
||||
open bracket
|
||||
- BRACKMATCH: if a bracket expression ends in an unquoted backslash,
|
||||
try to match the left bracket literally and go on. More discussion with
|
||||
Koichi Murase <myoga.murase@gmail.com>
|
||||
|
||||
execute_cmd.c
|
||||
- execute_in_subshell: don't try to optimize away forks in the command
|
||||
if the subshell command is being timed or its return value is being
|
||||
inverted. Report from Dabrien 'Dabe' Murphy <dabe@dabe.com>
|
||||
|
||||
11/23
|
||||
-----
|
||||
lib/readline/complete.c
|
||||
- __WIN32__: remove uses of this preprocessor symbol, use _WIN32
|
||||
|
||||
lib/readline/rldefs.h
|
||||
- Don't define NEW_TTY_DRIVER on _WIN32. Fix from
|
||||
sparrowhawk996@gmail.com
|
||||
|
||||
include/posixselect.h
|
||||
- include "posixtime.h" instead of <sys/time.h> so the right guards
|
||||
are present
|
||||
|
||||
@@ -489,6 +489,8 @@
|
||||
|
||||
#undef HAVE_DECL_STRTOLD
|
||||
|
||||
#undef HAVE_DECL_GETTIMEOFDAY
|
||||
|
||||
#undef PRI_MACROS_BROKEN
|
||||
|
||||
#undef STRTOLD_BROKEN
|
||||
|
||||
@@ -875,6 +875,7 @@ AC_CHECK_DECLS([sbrk])
|
||||
AC_CHECK_DECLS([setregid])
|
||||
AC_CHECK_DECLS([strcpy])
|
||||
AC_CHECK_DECLS([strsignal])
|
||||
AC_CHECK_DECLS([gettimeofday])
|
||||
|
||||
AC_CHECK_FUNCS(setresuid setresgid)
|
||||
|
||||
|
||||
+2
-1
@@ -1664,7 +1664,8 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
|
||||
subshell sets an exit trap, so we set CMD_NO_FORK for simple commands
|
||||
and set CMD_TRY_OPTIMIZING for simple commands on the right side of an
|
||||
and-or or `;' list to test for optimizing forks when they are executed. */
|
||||
if (user_subshell && command->type == cm_subshell)
|
||||
if (user_subshell && command->type == cm_subshell &&
|
||||
(command->flags & (CMD_TIME_PIPELINE|CMD_INVERT_RETURN)) == 0)
|
||||
optimize_subshell_command (command->value.Subshell->command);
|
||||
|
||||
/* Do redirections, then dispose of them before recursive call. */
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#if defined (HAVE_SELECT)
|
||||
# if !defined (HAVE_SYS_SELECT_H) || !defined (M_UNIX)
|
||||
# include <sys/time.h>
|
||||
# include "posixtime.h"
|
||||
# endif
|
||||
#endif /* HAVE_SELECT */
|
||||
#if defined (HAVE_SYS_SELECT_H)
|
||||
|
||||
+5
-3
@@ -569,7 +569,9 @@ BRACKMATCH (p, test, flags)
|
||||
if (!(flags & FNM_NOESCAPE) && c == L('\\'))
|
||||
{
|
||||
if (*p == '\0')
|
||||
return (CHAR *)0;
|
||||
return ((test == L('[')) ? savep : (CHAR *)0);
|
||||
else if (*p == L('/') && (flags & FNM_PATHNAME))
|
||||
return ((test == L('[')) ? savep : (CHAR *)0);
|
||||
cstart = cend = *p++;
|
||||
}
|
||||
|
||||
@@ -699,11 +701,11 @@ matched:
|
||||
else if (!(flags & FNM_NOESCAPE) && c == L('\\'))
|
||||
{
|
||||
if (*p == '\0')
|
||||
return (CHAR *)0;
|
||||
return ((test == L('[')) ? savep : (CHAR *)0);
|
||||
/* We don't allow backslash to quote slash if we're matching pathnames */
|
||||
else if (*p == L('/') && (flags & FNM_PATHNAME))
|
||||
return ((test == L('[')) ? savep : (CHAR *)0);
|
||||
/* XXX 1003.2d11 is unclear if this is right. */
|
||||
/* Posix issue 8 leaves this unspecified for the shell. */
|
||||
++p;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,6 +282,9 @@ parse-colors.o: ${BUILD_DIR}/config.h colors.h parse-colors.h
|
||||
parse-colors.o: rldefs.h rlconf.h
|
||||
parse-colors.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
|
||||
|
||||
input.o: posixselect.h posixtime.h
|
||||
parens.o: posixselect.h posixtime.h
|
||||
|
||||
bind.o: rlshell.h
|
||||
histfile.o: rlshell.h
|
||||
nls.o: rlshell.h
|
||||
|
||||
@@ -2271,9 +2271,9 @@ rl_completion_matches (const char *text, rl_compentry_func_t *entry_function)
|
||||
char *
|
||||
rl_username_completion_function (const char *text, int state)
|
||||
{
|
||||
#if defined (__WIN32__) || defined (__OPENNT)
|
||||
#if defined (_WIN32) || defined (__OPENNT)
|
||||
return (char *)NULL;
|
||||
#else /* !__WIN32__ && !__OPENNT) */
|
||||
#else /* !_WIN32 && !__OPENNT) */
|
||||
static char *username = (char *)NULL;
|
||||
static struct passwd *entry;
|
||||
static int namelen, first_char, first_char_loc;
|
||||
@@ -2322,7 +2322,7 @@ rl_username_completion_function (const char *text, int state)
|
||||
|
||||
return (value);
|
||||
}
|
||||
#endif /* !__WIN32__ && !__OPENNT */
|
||||
#endif /* !_WIN32 && !__OPENNT */
|
||||
}
|
||||
|
||||
/* Return non-zero if CONVFN matches FILENAME up to the length of FILENAME
|
||||
|
||||
@@ -3374,7 +3374,7 @@ _rl_update_final (void)
|
||||
full_lines = 1;
|
||||
}
|
||||
_rl_move_vert (_rl_vis_botlin);
|
||||
woff = W_OFFSET(_rl_vis_botlin, wrap_offset);
|
||||
woff = W_OFFSET(_rl_vis_botlin, wrap_offset); /* XXX - WRAP_OFFSET? */
|
||||
botline_length = VIS_LLEN(_rl_vis_botlin) - woff;
|
||||
/* If we've wrapped lines, remove the final xterm line-wrap flag. */
|
||||
if (full_lines && _rl_term_autowrap && botline_length == _rl_screenwidth)
|
||||
@@ -3383,7 +3383,7 @@ _rl_update_final (void)
|
||||
|
||||
/* LAST_LINE includes invisible characters, so if you want to get the
|
||||
last character of the first line, you have to take WOFF into account.
|
||||
This needs to be done for both calls to _rl_move_cursor_relative,
|
||||
This needs to be done both for calls to _rl_move_cursor_relative,
|
||||
which takes a buffer position as the first argument, and any direct
|
||||
subscripts of LAST_LINE. */
|
||||
last_line = &visible_line[vis_lbreaks[_rl_vis_botlin]]; /* = VIS_CHARS(_rl_vis_botlin); */
|
||||
|
||||
+1
-1
@@ -694,7 +694,7 @@ static int saved_history_logical_offset = -1;
|
||||
#define HISTORY_FULL() (history_is_stifled () && history_length >= history_max_entries)
|
||||
|
||||
static int
|
||||
set_saved_history ()
|
||||
set_saved_history (void)
|
||||
{
|
||||
int absolute_offset, count;
|
||||
|
||||
|
||||
@@ -708,6 +708,7 @@ readline_internal_charloop (void)
|
||||
_rl_internal_char_cleanup ();
|
||||
|
||||
#if defined (READLINE_CALLBACKS)
|
||||
memcpy ((void *)_rl_top_level, (void *)olevel, sizeof (procenv_t));
|
||||
return 0;
|
||||
#else
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
# if defined (HAVE_TERMIO_H)
|
||||
# define TERMIO_TTY_DRIVER
|
||||
# else
|
||||
# if !defined (__MINGW32__)
|
||||
# if !defined (__MINGW32__) && !defined (_WIN32)
|
||||
# define NEW_TTY_DRIVER
|
||||
# else
|
||||
# define NO_TTY_DRIVER
|
||||
|
||||
@@ -548,6 +548,7 @@ uconvert.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
uconvert.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
|
||||
|
||||
ufuncs.o: ${topdir}/bashtypes.h
|
||||
ufuncs.o: ${BASHINCDIR}/posixtime.h ${BASHINCDIR}/posixselect.h
|
||||
|
||||
clock.o: ${BASHINCDIR}/posixtime.h
|
||||
|
||||
|
||||
@@ -7507,8 +7507,6 @@ expand_arrayref:
|
||||
? quote_string (temp)
|
||||
: quote_escapes (temp);
|
||||
rflags |= W_ARRAYIND;
|
||||
if (estatep)
|
||||
*estatep = es; /* structure copy */
|
||||
}
|
||||
/* Note that array[*] and array[@] expanded to a quoted null string by
|
||||
returning the W_HASQUOTEDNULL flag to the caller in addition to TEMP. */
|
||||
@@ -7517,7 +7515,9 @@ expand_arrayref:
|
||||
else if (es.subtype == 2 && temp && QUOTED_NULL (temp) && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)))
|
||||
rflags |= W_HASQUOTEDNULL;
|
||||
|
||||
if (estatep == 0)
|
||||
if (estatep)
|
||||
*estatep = es; /* structure copy */
|
||||
else
|
||||
flush_eltstate (&es);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user