diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 4b6321db..8580d399 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -9315,3 +9315,29 @@ doc/{bash.1,bashref.texi} locale.c - local_shiftstates -> locale_shiftsates in the non-multibyte code branch. Reported by Henry Bent + +subst.c + - expand_compound_assignment_word: make sure to call dispose_words on + the WORD_LIST * returned from expand_oneword after turning it back + into a string. Fixes memory leak reported by Alexander Mescheryakov + + + 1/13 + ---- +variables.c + - bind_variable_internal: when performing an assignment to a subscripted + array variable that was the value of a nameref (used in the original + assignment), don't call make_variable_value on the value, since that + messes up +=. Just call assign_array_element and let that take care + of calling make_variable_value appropriately. Fixes bug reported by + Oguz + + 1/14 + ---- +findcmd.c + - search_for_command: if `checkhash' is set, don't add non-executable + files to the command hash table, since we will just remove them + later + +lib/sh/winsize.c + - get_new_window_size: set *rp and *cp even if READLINE is not defined diff --git a/arrayfunc.c b/arrayfunc.c index ce65788e..778c4008 100644 --- a/arrayfunc.c +++ b/arrayfunc.c @@ -1,6 +1,6 @@ /* arrayfunc.c -- High-level array functions used by other parts of the shell. */ -/* Copyright (C) 2001-2020 Free Software Foundation, Inc. +/* Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. diff --git a/execute_cmd.c b/execute_cmd.c index 310cfba9..319a70e7 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -1,6 +1,6 @@ /* execute_cmd.c -- Execute a COMMAND structure. */ -/* Copyright (C) 1987-2020 Free Software Foundation, Inc. +/* Copyright (C) 1987-2021 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -3013,10 +3013,11 @@ eval_arith_for_expr (l, okp) int r; char *expr, *temp; -#if 0 /* TAG: bash-5.2 */ - expr = l->next ? string_list (l) : savestring (l->word->word); +#if 1 /* TAG: bash-5.2 */ + expr = l->next ? string_list (l) : l->word->word; temp = expand_arith_string (expr, Q_DOUBLE_QUOTES|Q_ARITH); - free (expr); + if (l->next) + free (expr); new = make_word_list (make_word (temp), (WORD_LIST *)NULL); free (temp); #else @@ -3796,6 +3797,7 @@ execute_arith_command (arith_command) exp = new->word->word; exp = expand_arith_string (exp, Q_DOUBLE_QUOTES|Q_ARITH); + FREE (t); /* If we're tracing, make a new word list with `((' at the front and `))' at the back and print it. Change xtrace_print_arith_cmd to take a string @@ -3818,7 +3820,6 @@ execute_arith_command (arith_command) expresult = 0; expok = 1; } - FREE (t); if (expok == 0) return (EXECUTION_FAILURE); diff --git a/findcmd.c b/findcmd.c index e235705a..a4e679b8 100644 --- a/findcmd.c +++ b/findcmd.c @@ -399,7 +399,7 @@ search_for_command (pathname, flags) } /* If we're in posix mode, don't add files without the execute bit to the hash table. */ - else if (posixly_correct) + else if (posixly_correct || check_hashed_filenames) { st = file_status (command); if (st & FS_EXECABLE) diff --git a/lib/sh/winsize.c b/lib/sh/winsize.c index 861c7c89..52ff53d2 100644 --- a/lib/sh/winsize.c +++ b/lib/sh/winsize.c @@ -88,11 +88,11 @@ get_new_window_size (from_sig, rp, cp) sh_set_lines_and_columns (win.ws_row, win.ws_col); #if defined (READLINE) rl_set_screen_size (win.ws_row, win.ws_col); +#endif if (rp) *rp = win.ws_row; if (cp) *cp = win.ws_col; -#endif } #endif } diff --git a/locale.c b/locale.c index d6dd95a3..7309d71a 100644 --- a/locale.c +++ b/locale.c @@ -1,6 +1,6 @@ /* locale.c - Miscellaneous internationalization functions. */ -/* Copyright (C) 1996-2009,2012,2016,2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2009,2012,2016-2021 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. diff --git a/subst.c b/subst.c index 1b20b8c8..f6e16e8d 100644 --- a/subst.c +++ b/subst.c @@ -4,7 +4,7 @@ /* ``Have a little faith, there's magic in the night. You ain't a beauty, but, hey, you're alright.'' */ -/* Copyright (C) 1987-2020 Free Software Foundation, Inc. +/* Copyright (C) 1987-2021 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -7439,8 +7439,12 @@ verify_substring_values (v, value, substr, vtype, e1p, e2p) else t = (char *)0; - temp1 = expand_arith_string (substr, Q_DOUBLE_QUOTES); + temp1 = expand_arith_string (substr, Q_DOUBLE_QUOTES); /* Q_ARITH? */ +#if 1 /* TAG: bash-5.2 */ + *e1p = evalexp (temp1, EXP_EXPANDED, &expok); +#else *e1p = evalexp (temp1, 0, &expok); /* XXX - EXP_EXPANDED? */ +#endif free (temp1); if (expok == 0) return (0); @@ -7495,10 +7499,14 @@ verify_substring_values (v, value, substr, vtype, e1p, e2p) { t++; temp2 = savestring (t); - temp1 = expand_arith_string (temp2, Q_DOUBLE_QUOTES); + temp1 = expand_arith_string (temp2, Q_DOUBLE_QUOTES); /* Q_ARITH? */ free (temp2); t[-1] = ':'; +#if 1 /* TAG: bash-5.2 */ + *e2p = evalexp (temp1, EXP_EXPANDED, &expok); +#else *e2p = evalexp (temp1, 0, &expok); /* XXX - EXP_EXPANDED? */ +#endif free (temp1); if (expok == 0) return (0); @@ -11682,6 +11690,8 @@ expand_compound_assignment_word (tlist, flags) free (value); value = string_list (l); + dispose_words (l); + wlen = STRLEN (value); /* Now, let's rebuild the string */ diff --git a/tests/RUN-ONE-TEST b/tests/RUN-ONE-TEST index c8bef8dd..0b063810 100755 --- a/tests/RUN-ONE-TEST +++ b/tests/RUN-ONE-TEST @@ -1,4 +1,4 @@ -BUILD_DIR=/usr/local/build/bash/bash-current +BUILD_DIR=/usr/local/build/chet/bash/bash-current THIS_SH=$BUILD_DIR/bash PATH=$PATH:$BUILD_DIR diff --git a/variables.c b/variables.c index 73f157fb..623d6e4a 100644 --- a/variables.c +++ b/variables.c @@ -3136,8 +3136,14 @@ bind_variable_internal (name, value, table, hflags, aflags) VUNSETATTR (tentry, att_nameref); } free (tname); - /* XXX - should it be aflags? */ - entry = assign_array_element (newval, make_variable_value (entry, value, aflags), aflags|ASS_NAMEREF); + + /* entry == nameref variable; tentry == array variable; + newval == x[2]; value = bar + We don't need to call make_variable_value here, since + assign_array_element will eventually do it itself based on + newval and aflags. */ + + entry = assign_array_element (newval, value, aflags|ASS_NAMEREF); if (entry == 0) return entry; }