commit bash-20201211 snapshot

This commit is contained in:
Chet Ramey
2020-12-18 15:26:49 -05:00
parent 3f17ceca10
commit 11262b0b72
20 changed files with 1451 additions and 2263 deletions
+30
View File
@@ -9185,3 +9185,33 @@ doc/{bash.1,bashref.texi}
Makefile.in
- bashline.o: add dependency on ${DEFDIR}/builtext.h. Report from
Fazal Majid <fazal@majid.org>
12/11
-----
builtins/wait.def
- wait_builtin: don't assign the variable given with -p if there are no
jobs to wait for. Report and fix from OÄuz <oguzismailuysal@gmail.com>
arrayfunc.c
- kvpair_assignment_p: return non-zero if argument L appears to be a
key-value pair associative array compound assignment
- expand_and_quote_kvpair_word: run a single word in a key-value pair
associative array compound assignment through the appropriate
expansions and single-quote the result
arrayfunc.h
- kvpair_assignment_p, expand_and_quote_kvpair_word: extern declarations
subst.c
- expand_oneword: detect whether VALUE appears to be a key-value
pair compound assignment and call the appropriate function to expand
each word in the resulting list. Fixes inconsistency reported by
oguzismailuysal@gmail.com
12/12
-----
subst.c
- command_substitute: don't reset pipeline_pgrp to shell_pgrp if we
are already forked to run a command (SUBSHELL_FORK). Fixes SIGINT
in command substitution in here-document in forked child issue
reported by oguzismailuysal@gmail.com
+1
View File
@@ -933,6 +933,7 @@ tests/assoc8.sub f
tests/assoc9.sub f
tests/assoc10.sub f
tests/assoc11.sub f
tests/assoc12.sub f
tests/attr.tests f
tests/attr.right f
tests/attr1.sub f
+5 -1
View File
@@ -855,7 +855,11 @@ install-headers: install-headers-dirs
${INSTALL_DATA} $(BUILTIN_SRCDIR)/"$$hf" $(DESTDIR)$(headersdir)/builtins/$$hf || exit 1; \
done
@for hf in $(CREATED_HEADERS) ; do \
${INSTALL_DATA} $(BUILD_DIR)/"$$hf" $(DESTDIR)$(headersdir)/$$hf || exit 1; \
if test -f $(BUILD_DIR)/"$$hf" ; then \
${INSTALL_DATA} $(BUILD_DIR)/"$$hf" $(DESTDIR)$(headersdir)/$$hf || exit 1; \
else \
${INSTALL_DATA} $(srcdir)/"$$hf" $(DESTDIR)$(headersdir)/$$hf || exit 1; \
fi ; \
done
-$(INSTALL_DATA) $(SDIR)/bash.pc $(DESTDIR)$(pkgconfigdir)/bash.pc
+22 -1
View File
@@ -597,6 +597,27 @@ assign_assoc_from_kvlist (var, nlist, h, flags)
free (aval);
}
}
/* Return non-zero if L appears to be a key-value pair associative array
compound assignment. */
int
kvpair_assignment_p (l)
WORD_LIST *l;
{
return (l && (l->word->flags & W_ASSIGNMENT) == 0 && l->word->word[0] != '['); /*]*/
}
char *
expand_and_quote_kvpair_word (w)
char *w;
{
char *t, *r;
t = w ? expand_assignment_string_to_string (w, 0) : 0;
r = sh_single_quote (t ? t : "");
free (t);
return r;
}
#endif
/* Callers ensure that VAR is not NULL. Associative array assignments have not
@@ -640,7 +661,7 @@ assign_compound_array_list (var, nlist, flags)
last_ind = (a && (flags & ASS_APPEND)) ? array_max_index (a) + 1 : 0;
#if ASSOC_KVPAIR_ASSIGNMENT
if (assoc_p (var) && nlist && (nlist->word->flags & W_ASSIGNMENT) == 0 && nlist->word->word[0] != '[') /*]*/
if (assoc_p (var) && kvpair_assignment_p (nlist))
{
iflags = flags & ~ASS_APPEND;
assign_assoc_from_kvlist (var, nlist, nhash, iflags);
+3
View File
@@ -67,6 +67,9 @@ extern SHELL_VAR *assign_array_var_from_string PARAMS((SHELL_VAR *, char *, int)
extern char *expand_and_quote_assoc_word PARAMS((char *, int));
extern void quote_compound_array_list PARAMS((WORD_LIST *, int));
extern int kvpair_assignment_p PARAMS((WORD_LIST *));
extern char *expand_and_quote_kvpair_word PARAMS((char *));
extern int unbind_array_element PARAMS((SHELL_VAR *, char *, int));
extern int skipsubscript PARAMS((const char *, int, int));
+3 -3
View File
@@ -213,11 +213,11 @@ wait_builtin (list)
}
status = wait_for_any_job (wflags, &pstat);
if (status < 0)
status = 127;
if (vname && status >= 0)
bind_var_to_int (vname, pstat.pid);
if (status < 0)
status = 127;
if (list)
unset_waitlist ();
WAIT_RETURN (status);
Vendored
+10 -10
View File
@@ -1,7 +1,7 @@
#! /bin/sh
# From configure.ac for Bash 5.1, version 5.022.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for bash 5.1-rc3.
# Generated by GNU Autoconf 2.69 for bash 5.1-maint.
#
# Report bugs to <bug-bash@gnu.org>.
#
@@ -581,8 +581,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bash'
PACKAGE_TARNAME='bash'
PACKAGE_VERSION='5.1-rc3'
PACKAGE_STRING='bash 5.1-rc3'
PACKAGE_VERSION='5.1-maint'
PACKAGE_STRING='bash 5.1-maint'
PACKAGE_BUGREPORT='bug-bash@gnu.org'
PACKAGE_URL=''
@@ -1427,7 +1427,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 5.1-rc3 to adapt to many kinds of systems.
\`configure' configures bash 5.1-maint to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1492,7 +1492,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bash 5.1-rc3:";;
short | recursive ) echo "Configuration of bash 5.1-maint:";;
esac
cat <<\_ACEOF
@@ -1693,7 +1693,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bash configure 5.1-rc3
bash configure 5.1-maint
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2402,7 +2402,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 5.1-rc3, which was
It was created by bash $as_me 5.1-maint, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2800,7 +2800,7 @@ ac_config_headers="$ac_config_headers config.h"
BASHVERS=5.1
RELSTATUS=rc3
RELSTATUS=maint
case "$RELSTATUS" in
alp*|bet*|dev*|rc*|releng*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
@@ -21057,7 +21057,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 5.1-rc3, which was
This file was extended by bash $as_me 5.1-maint, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -21123,7 +21123,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 5.1-rc3
bash config.status 5.1-maint
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
+1 -1
View File
@@ -24,7 +24,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_REVISION([for Bash 5.1, version 5.022])dnl
define(bashvers, 5.1)
define(relstatus, rc3)
define(relstatus, maint)
AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
+3
View File
@@ -5551,6 +5551,9 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out,
clear_fifo_list (); /* XXX - we haven't created any FIFOs */
#endif
/* reset shell_pgrp to pipeline_pgrp here for word expansions performed
by the redirections here? */
if (redirects && (do_redirections (redirects, RX_ACTIVE) != 0))
{
#if defined (PROCESS_SUBSTITUTION)
+1
View File
@@ -4534,6 +4534,7 @@ debug_print_pgrps ()
(long)original_pgrp, (long)shell_pgrp, (long)terminal_pgrp);
itrace("tcgetpgrp(%d) -> %ld, getpgid(0) -> %ld",
shell_tty, (long)tcgetpgrp (shell_tty), (long)getpgid(0));
itrace("pipeline_pgrp -> %ld", (long)pipeline_pgrp);
}
#endif
+488 -979
View File
File diff suppressed because it is too large Load Diff
+173 -331
View File
File diff suppressed because it is too large Load Diff
+308 -310
View File
File diff suppressed because it is too large Load Diff
+290 -622
View File
File diff suppressed because it is too large Load Diff
+15 -2
View File
@@ -6356,8 +6356,10 @@ command_substitute (string, quoted, flags)
#if defined (JOB_CONTROL)
old_pipeline_pgrp = pipeline_pgrp;
/* Don't reset the pipeline pgrp if we're already a subshell in a pipeline. */
if ((subshell_environment & SUBSHELL_PIPE) == 0)
/* Don't reset the pipeline pgrp if we're already a subshell in a pipeline or
we've already forked to run a disk command (and are expanding redirections,
for example). */
if ((subshell_environment & (SUBSHELL_FORK|SUBSHELL_PIPE)) == 0)
pipeline_pgrp = shell_pgrp;
cleanup_the_pipeline ();
#endif /* JOB_CONTROL */
@@ -11602,6 +11604,7 @@ expand_oneword (value, flags)
{
WORD_LIST *l, *nl;
char *t;
int kvpair;
if (flags == 0)
{
@@ -11616,11 +11619,21 @@ expand_oneword (value, flags)
{
/* Associative array */
l = parse_string_to_word_list (value, 1, "array assign");
#if ASSOC_KVPAIR_ASSIGNMENT
kvpair = kvpair_assignment_p (l);
#endif
/* For associative arrays, with their arbitrary subscripts, we have to
expand and quote in one step so we don't have to search for the
closing right bracket more than once. */
for (nl = l; nl; nl = nl->next)
{
#if ASSOC_KVPAIR_ASSIGNMENT
if (kvpair)
/* keys and values undergo the same set of expansions */
t = expand_and_quote_kvpair_word (nl->word->word);
else
#endif
if ((nl->word->flags & W_ASSIGNMENT) == 0)
t = sh_single_quote (nl->word->word ? nl->word->word : "");
else
+1 -1
View File
@@ -1,4 +1,4 @@
BUILD_DIR=/usr/local/build/chet/bash/bash-current
BUILD_DIR=/usr/local/build/bash/bash-current
THIS_SH=$BUILD_DIR/bash
PATH=$PATH:$BUILD_DIR
+18
View File
@@ -258,3 +258,21 @@ declare -A a=([")"]="rparen" ["\""]="dquote" ["]"]="rbrace" ["\\"]="bs" )
declare -A a=([")"]="rparen" ["\""]="dquote" ["]"]="rbrace" ["\\"]="bs" )
declare -Arx foo=([two]="2" [three]="3" [one]="1" )
./assoc11.sub: line 90: foo: readonly variable
declare -A v1=(["1 2"]="3" )
declare -A v2=(["1 2"]="3" )
declare -A v3=(["1 2"]="3" )
declare -A v1=(["1 2"]="3 4 5" )
declare -A v2=(["1 2"]="3 4 5" )
declare -A v3=(["1 2"]="3 4 5" )
declare -A v1=(["1 2"]="3 4 5" )
declare -A v2=(["1 2"]="3 4 5" )
declare -A v3=(["1 2"]="3 4 5" )
declare -A v1=(["1 2"]="3 4 5" )
declare -A v2=(["1 2"]="3 4 5" )
declare -A v3=(["1 2"]="3 4 5" )
declare -A v1=(["20 40 80"]="xtra" ["1 2"]="3 4 5" )
declare -A v2=(["20 40 80"]="xtra" ["1 2"]="3 4 5" )
declare -A v3=(["1 2"]="3 4 5" ["\$xtra"]="xtra" )
declare -A v1=(["20 40 80"]="new xtra" ["1 2"]="3 4 5" )
declare -A v2=(["20 40 80"]="new xtra" ["1 2"]="3 4 5" )
declare -A v3=(["1 2"]="3 4 5" ["\$xtra"]="new xtra" )
+3
View File
@@ -244,3 +244,6 @@ ${THIS_SH} ./assoc10.sub
# test assigning associative arrays using compound key/value pair assignments
${THIS_SH} ./assoc11.sub
# more kvpair associative array assignment tests
${THIS_SH} ./assoc12.sub
+74
View File
@@ -0,0 +1,74 @@
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
foo='1 2'
bar='3 4 5'
xtra='20 40 80'
declare -A v1=( $foo 3 )
declare -p v1
declare -A v2=( [$foo]=3 )
declare -p v2
declare -A v3
v3=( $foo 3 )
declare -p v3
unset v1 v2 v3
declare -A v1=( $foo $bar )
declare -p v1
declare -A v2=( [$foo]=$bar )
declare -p v2
declare -A v3
v3=( $foo $bar )
declare -p v3
unset v1 v2 v3
declare -A v1=( "$foo" $bar )
declare -p v1
declare -A v2=( ["$foo"]=$bar )
declare -p v2
declare -A v3
v3=( "$foo" $bar )
declare -p v3
unset v1 v2 v3
declare -A v1=( "$foo" "$bar" )
declare -p v1
declare -A v2=( ["$foo"]="$bar" )
declare -p v2
declare -A v3
v3=( "$foo" "$bar" )
declare -p v3
v1+=( $xtra xtra )
v2+=( "$xtra" xtra )
v3+=( '$xtra' xtra )
declare -p v1 v2 v3
v1+=( [$xtra]='new xtra' )
v2+=( ["$xtra"]='new xtra' )
v3+=( ['$xtra']='new xtra' )
declare -p v1 v2 v3
+2 -2
View File
@@ -23,12 +23,12 @@ SUFFIX=`${THIS_SH} -c 'echo $(( $RANDOM + $BASHPID ))'`
BASH_TSTOUT=${TMPDIR}/bashtst-$SUFFIX # for now
export BASH_TSTOUT
trap 'rm -f $BASH_TSTOUT' 0 1 2 3 15
trap 'rm -f $BASH_TSTOUT ; exit' 1 2 3 15
trap 'rm -f $BASH_TSTOUT' 0
PATH=.:$PATH # just to get recho/zecho/printenv if not run via `make tests'
export PATH
# unset BASH_ENV only if it is set
[ "${BASH_ENV+set}" = "set" ] && unset BASH_ENV
# can't reliably do it for SHELLOPTS; SHELLOPTS is readonly in bash