From 3475994a81ce49cf3a50b6ceeb5ad719986aa5f4 Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Fri, 22 Apr 2016 11:37:14 -0400 Subject: [PATCH] commit bash-20160415 snapshot --- CWRU/CWRU.chlog | 44 +++++++++++++++++++++++++++++++++++ arrayfunc.c | 6 +++++ bashhist.c | 4 +++- bashline.c | 4 ++-- config-top.h | 4 ++++ configure | 20 ++++++++-------- configure.ac | 4 ++-- execute_cmd.c | 19 ++++++++++++++- lib/readline/doc/rltech.texi | 8 +++++++ lib/readline/doc/version.texi | 6 ++--- lib/readline/readline.c | 2 +- lib/readline/rltty.c | 13 +++++++++++ parse.y | 1 + tests/RUN-ONE-TEST | 2 +- variables.c | 15 ++++++++++++ variables.h | 1 + 16 files changed, 132 insertions(+), 21 deletions(-) diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index a9bdb915..d18b26ae 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -10632,3 +10632,47 @@ lib/glob/sm_loop.c * is the last character in the pattern until after we check the special cases for matching a `.'. Fixes bugs reported back on 3/23 by Isabella Parakiss + + 4/13 + ---- +bashhist.c + - hc_erasedups: fix memory leak by freeing history entry returned by + remove_history. Bug and fix from Seiichi Ishitsuka + + + 4/19 + ---- +config-top.h + - CD_COMPLAINS: now settable in config-top.h; enables (fatal) error + messages if cd is given multiple directory arguments + + 4/20 + ---- +execute_cmd.c + - coproc_setvars: refuse to create variables with names that are not + valid identifiers. Suggestion from Piotr Grzybowski + + +rltty.c + - rl_tty_set_echoing: interface to set _rl_echoing_p, returning old + value. Inspired by gdb use of _rl_echoing_p when switching + between terminal and curses modes described by Doug Evans + + +bashline.c + - bash_execute_unix_command: use rl_clear_visible_line instead of + erasing current line on the screen, inspired by same report from + 3/12. Still tentative change + +configure.ac + - update release status to rc2, may skip this and go directly to + release + + 4/21 + ---- +arrayfunc.c + - convert_var_to_array: make sure that the newly-converted array + variable is not marked as being an associative array. Fixes bug + reported by Grisha Levit + - convert_var_to_assoc: make sure that the newly-converted associative + array variable is not marked as being an indexed array diff --git a/arrayfunc.c b/arrayfunc.c index 9e83864f..4a9fd1d3 100644 --- a/arrayfunc.c +++ b/arrayfunc.c @@ -87,6 +87,9 @@ convert_var_to_array (var) VSETATTR (var, att_array); VUNSETATTR (var, att_invisible); + /* Make sure it's not marked as an associative array any more */ + VUNSETATTR (var, att_assoc); + return var; } @@ -118,6 +121,9 @@ convert_var_to_assoc (var) VSETATTR (var, att_assoc); VUNSETATTR (var, att_invisible); + /* Make sure it's not marked as an indexed array any more */ + VUNSETATTR (var, att_array); + return var; } diff --git a/bashhist.c b/bashhist.c index ce25aae2..9979f99a 100644 --- a/bashhist.c +++ b/bashhist.c @@ -674,7 +674,9 @@ hc_erasedups (line) if (STREQ (temp->line, line)) { r = where_history (); - remove_history (r); + temp = remove_history (r); + if (temp) + free_history_entry (temp); } } using_history (); diff --git a/bashline.c b/bashline.c index 040f1908..3d1927ef 100644 --- a/bashline.c +++ b/bashline.c @@ -1,6 +1,6 @@ /* bashline.c -- Bash's interface to the readline library. */ -/* Copyright (C) 1987-2013 Free Software Foundation, Inc. +/* Copyright (C) 1987-2016 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -4080,7 +4080,7 @@ bash_execute_unix_command (count, key) ce = rl_get_termcap ("ce"); if (ce) /* clear current line */ { -#if 1 +#if 0 fprintf (rl_outstream, "\r"); tputs (ce, 1, putx); #else diff --git a/config-top.h b/config-top.h index e32482dc..d3659ec6 100644 --- a/config-top.h +++ b/config-top.h @@ -27,6 +27,10 @@ error messages about `break' and `continue' out of context. */ #define BREAK_COMPLAINS +/* Define CD_COMPLAINS if you want the non-standard, but sometimes-desired + error messages about multiple directory arguments to `cd'. */ +#define CD_COMPLAINS + /* Define BUFFERED_INPUT if you want the shell to do its own input buffering, rather than using stdio. Do not undefine this; it's required to preserve semantics required by POSIX. */ diff --git a/configure b/configure index 46db3821..c9c433c7 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac for Bash 4.4, version 4.078. # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for bash 4.4-rc1. +# Generated by GNU Autoconf 2.69 for bash 4.4-rc2. # # Report bugs to . # @@ -581,8 +581,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='bash' PACKAGE_TARNAME='bash' -PACKAGE_VERSION='4.4-rc1' -PACKAGE_STRING='bash 4.4-rc1' +PACKAGE_VERSION='4.4-rc2' +PACKAGE_STRING='bash 4.4-rc2' PACKAGE_BUGREPORT='bug-bash@gnu.org' PACKAGE_URL='' @@ -1393,7 +1393,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures bash 4.4-rc1 to adapt to many kinds of systems. +\`configure' configures bash 4.4-rc2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1458,7 +1458,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of bash 4.4-rc1:";; + short | recursive ) echo "Configuration of bash 4.4-rc2:";; esac cat <<\_ACEOF @@ -1651,7 +1651,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -bash configure 4.4-rc1 +bash configure 4.4-rc2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2360,7 +2360,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by bash $as_me 4.4-rc1, which was +It was created by bash $as_me 4.4-rc2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2754,7 +2754,7 @@ ac_config_headers="$ac_config_headers config.h" BASHVERS=4.4 -RELSTATUS=rc1 +RELSTATUS=rc2 case "$RELSTATUS" in alp*|bet*|dev*|rc*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;; @@ -16655,7 +16655,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by bash $as_me 4.4-rc1, which was +This file was extended by bash $as_me 4.4-rc2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -16721,7 +16721,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -bash config.status 4.4-rc1 +bash config.status 4.4-rc2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 39c9188b..ab8f066d 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,7 @@ dnl report bugs to chet@po.cwru.edu dnl dnl Process this file with autoconf to produce a configure script. -# Copyright (C) 1987-2015 Free Software Foundation, Inc. +# Copyright (C) 1987-2016 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify @@ -24,7 +24,7 @@ dnl Process this file with autoconf to produce a configure script. AC_REVISION([for Bash 4.4, version 4.078])dnl define(bashvers, 4.4) -define(relstatus, rc1) +define(relstatus, rc2) AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org]) diff --git a/execute_cmd.c b/execute_cmd.c index cc115a65..3d4d3e8a 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -1,6 +1,6 @@ /* execute_cmd.c -- Execute a COMMAND structure. */ -/* Copyright (C) 1987-2015 Free Software Foundation, Inc. +/* Copyright (C) 1987-2016 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -2150,6 +2150,7 @@ coproc_setvars (cp) SHELL_VAR *v; char *namevar, *t; int l; + WORD_DESC w; #if defined (ARRAY_VARS) arrayind_t ind; #endif @@ -2157,11 +2158,27 @@ coproc_setvars (cp) if (cp->c_name == 0) return; + /* We could do more here but right now we only check the name, warn if it's + not a valid identifier, and refuse to create variables with invalid names + if a coproc with such a name is supplied. */ + w.word = cp->c_name; + w.flags = 0; + if (check_identifier (&w, 1) == 0) + return; + l = strlen (cp->c_name); namevar = xmalloc (l + 16); #if defined (ARRAY_VARS) v = find_variable (cp->c_name); +# if 0 + if (v && (readonly_p (v) || noassign_p (v))) + { + if (readonly_p (v)) + err_readonly (cp->c_name); + return; + } +# endif if (v == 0) v = make_new_array_variable (cp->c_name); if (array_p (v) == 0) diff --git a/lib/readline/doc/rltech.texi b/lib/readline/doc/rltech.texi index dbfe711f..9b21e279 100644 --- a/lib/readline/doc/rltech.texi +++ b/lib/readline/doc/rltech.texi @@ -1140,6 +1140,14 @@ that the terminal editing characters are bound to @code{rl_insert}. The bindings are performed in @var{kmap}. @end deftypefun +@deftypefun int rl_tty_set_echoing (int value) +Set Readline's idea of whether or not it is echoing output to its output +stream (@var{rl_outstream}). If @var{value} is 0, Readline does not display +output to @var{rl_outstream}; any other value enables output. The initial +value is set when Readline initializes the terminal settings. +This function returns the previous value. +@end deftypefun + @deftypefun int rl_reset_terminal (const char *terminal_name) Reinitialize Readline's idea of the terminal settings using @var{terminal_name} as the terminal type (e.g., @code{vt100}). diff --git a/lib/readline/doc/version.texi b/lib/readline/doc/version.texi index abeee593..766864ae 100644 --- a/lib/readline/doc/version.texi +++ b/lib/readline/doc/version.texi @@ -4,7 +4,7 @@ Copyright (C) 1988-2016 Free Software Foundation, Inc. @set EDITION 7.0 @set VERSION 7.0 -@set UPDATED 12 March 2016 -@set UPDATED-MONTH March 2016 +@set UPDATED 20 April 2016 +@set UPDATED-MONTH April 2016 -@set LASTCHANGE Sat Mar 12 15:45:03 EST 2016 +@set LASTCHANGE Wed Apr 20 13:32:48 PDT 2016 diff --git a/lib/readline/readline.c b/lib/readline/readline.c index 547dd314..e51df4f0 100644 --- a/lib/readline/readline.c +++ b/lib/readline/readline.c @@ -965,7 +965,7 @@ _rl_dispatch_subseq (key, map, got_subseq) /* Tentative inter-character timeout for potential multi-key sequences? If no input within timeout, abort sequence and act as if we got non-matching input. */ - /* _rl_keyseq_timeout specified in milliseconds; _rl_input_queued[B + /* _rl_keyseq_timeout specified in milliseconds; _rl_input_queued takes microseconds, so multiply by 1000 */ if (_rl_keyseq_timeout > 0 && (RL_ISSTATE (RL_STATE_INPUTPENDING|RL_STATE_MACROINPUT) == 0) && diff --git a/lib/readline/rltty.c b/lib/readline/rltty.c index ce36aec3..b1c79294 100644 --- a/lib/readline/rltty.c +++ b/lib/readline/rltty.c @@ -714,6 +714,19 @@ rl_deprep_terminal () _rl_release_sigint (); } #endif /* !NO_TTY_DRIVER */ + +/* Set readline's idea of whether or not it is echoing output to the terminal, + returning the old value. */ +int +rl_tty_set_echoing (u) + int u; +{ + int o; + + o = _rl_echoing_p; + _rl_echoing_p = u; + return o; +} /* **************************************************************** */ /* */ diff --git a/parse.y b/parse.y index 56a669d9..0c702e01 100644 --- a/parse.y +++ b/parse.y @@ -3035,6 +3035,7 @@ reset_parser () free_string_list (); #endif /* ALIAS || DPAREN_ARITHMETIC */ + /* This is where we resynchronize to the next newline on error/reset */ if (shell_input_line) { free (shell_input_line); diff --git a/tests/RUN-ONE-TEST b/tests/RUN-ONE-TEST index a5ab273d..d29259a9 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 2b131301..69ed1703 100644 --- a/variables.c +++ b/variables.c @@ -3212,6 +3212,21 @@ unbind_nameref (name) return 0; } +int +check_unbind_variable (name) + const char *name; +{ + SHELL_VAR *v; + + v = find_variable (name); + if (v && readonly_p (v)) + { + builtin_error (_("%s: cannot unset: readonly %s"), name, "variable"); + return -1; + } + return (unbind_variable (name)); +} + /* Unset the shell function named NAME. */ int unbind_func (name) diff --git a/variables.h b/variables.h index e16d0cc5..43cb725f 100644 --- a/variables.h +++ b/variables.h @@ -294,6 +294,7 @@ extern SHELL_VAR *bind_var_to_int __P((char *, intmax_t)); extern int assign_in_env __P((WORD_DESC *, int)); extern int unbind_variable __P((const char *)); +extern int check_unbind_variable __P((const char *)); extern int unbind_nameref __P((const char *)); extern int unbind_func __P((const char *)); extern int unbind_function_def __P((const char *));