mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-26 15:23:09 +02:00
commit bash-20200319 snapshot
This commit is contained in:
@@ -7600,3 +7600,22 @@ variables.c
|
||||
affected by posix mode so we can restore them when we restore the
|
||||
old value of the variable after the command executes. Suggested by
|
||||
Martijn Dekker <martijn@inlv.org>
|
||||
|
||||
3/20
|
||||
----
|
||||
syntax.h
|
||||
- slashify_in_here_document: add `"' to this list, since POSIX says
|
||||
that backslashes in here documents behave like backslashes in
|
||||
double quotes, and backslash can quote a double quote in a double-
|
||||
quoted string. This means that given P=A,
|
||||
|
||||
cat <<EOF
|
||||
${P+\"$P\"}
|
||||
EOF
|
||||
|
||||
and
|
||||
|
||||
echo "${P+\"$P\"}"
|
||||
|
||||
should output the same thing. From a report from Dan Jacobson
|
||||
<jidanni@jidanni.org> back in 1/2019.
|
||||
|
||||
@@ -1244,6 +1244,7 @@ tests/posixexp4.sub f
|
||||
tests/posixexp5.sub f
|
||||
tests/posixexp6.sub f
|
||||
tests/posixexp7.sub f
|
||||
tests/posixexp8.sub f
|
||||
tests/posixexp2.tests f
|
||||
tests/posixexp2.right f
|
||||
tests/posixpat.tests f
|
||||
@@ -1439,6 +1440,8 @@ tests/varenv14.sub f
|
||||
tests/varenv15.sub f
|
||||
tests/varenv15.in f
|
||||
tests/varenv16.sub f
|
||||
tests/varenv17.sub f
|
||||
tests/varenv18.sub f
|
||||
tests/version f
|
||||
tests/version.mini f
|
||||
tests/vredir.tests f
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* syntax.h -- Syntax definitions for the shell */
|
||||
|
||||
/* Copyright (C) 2000, 2001, 2005, 2008,2009 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2000, 2001, 2005, 2008, 2009-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
/* Defines for use by mksyntax.c */
|
||||
|
||||
#define slashify_in_quotes "\\`$\"\n"
|
||||
#define slashify_in_here_document "\\`$"
|
||||
#define slashify_in_here_document "\\`$\""
|
||||
|
||||
#define shell_meta_chars "()<>;&|"
|
||||
#define shell_break_chars "()<>;&| \t\n"
|
||||
|
||||
+10
-1
@@ -11,7 +11,13 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
trap "rm 'a?' aa" EXIT
|
||||
: ${TMPDIR:=/var/tmp}
|
||||
|
||||
FN=$TMPDIR/bash-glob.$$
|
||||
mkdir $FN || { echo "glob4.sub: cannot mkdir $FN" >&2 ; exit 1; }
|
||||
builtin cd $FN || { echo "glob4.sub: cannot change directory to $FN" >&2 ; exit 1; }
|
||||
rm -f *
|
||||
|
||||
touch 'a?' aa
|
||||
|
||||
set -- a \?; IFS=\\; var=$*;
|
||||
@@ -30,3 +36,6 @@ printf "%s\n" ${var}
|
||||
PRE='\/'
|
||||
printf '<%s>\n' 'define'${PRE}'\
|
||||
/'
|
||||
|
||||
builtin cd $OLDPWD
|
||||
rm -rf $FN
|
||||
|
||||
+2
-2
@@ -14,9 +14,9 @@
|
||||
ORIGD=$PWD
|
||||
: ${TMPDIR:=/var/tmp}
|
||||
|
||||
SD=$TMPDIR/scratch-$$
|
||||
SD=$TMPDIR/bash-glob-$$
|
||||
[ -d $SD ] || mkdir $SD
|
||||
cd $SD
|
||||
builtin cd $SD || { echo "glob5.sub: cannot change directory to $SD" >&2 ; exit 1; }
|
||||
mkdir tmp
|
||||
|
||||
D=./tmp/a
|
||||
|
||||
+2
-1
@@ -17,7 +17,8 @@
|
||||
|
||||
ORIG=$PWD
|
||||
GLOBDIR=$TMPDIR/bash-glob-$$
|
||||
mkdir $GLOBDIR && cd $GLOBDIR
|
||||
mkdir $GLOBDIR || { echo "glob6.sub: cannot make directory $GLOBDIR" >&2 ; exit 1; }
|
||||
builtin cd $GLOBDIR || { echo "glob6.sub: cannot change directory to $GLOBDIR" >&2 ; exit 1; }
|
||||
|
||||
# does the pattern matcher allow backslashes as escape characters and remove
|
||||
# them as part of matching?
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
: ${TMPDIR:=/var/tmp}
|
||||
|
||||
TESTDIR=${TMPDIR}/glob-test-$$
|
||||
mkdir ${TESTDIR}
|
||||
cd $TESTDIR || {
|
||||
|
||||
@@ -279,5 +279,10 @@ argv[2] = <b>
|
||||
OK
|
||||
OK
|
||||
5: $'not\ttoo\nbad'
|
||||
./posixexp.tests: line 96: unexpected EOF while looking for matching `}'
|
||||
./posixexp.tests: line 97: syntax error: unexpected end of file
|
||||
"A"
|
||||
A
|
||||
argv[1] = <"A">
|
||||
argv[1] = <A>
|
||||
argv[1] = <A>
|
||||
./posixexp.tests: line 97: unexpected EOF while looking for matching `}'
|
||||
./posixexp.tests: line 98: syntax error: unexpected end of file
|
||||
|
||||
@@ -90,6 +90,7 @@ ${THIS_SH} ./posixexp4.sub
|
||||
${THIS_SH} ./posixexp5.sub
|
||||
${THIS_SH} ./posixexp6.sub
|
||||
${THIS_SH} ./posixexp7.sub
|
||||
${THIS_SH} ./posixexp8.sub
|
||||
|
||||
# this will be an error
|
||||
foo=bar
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
P=A
|
||||
|
||||
cat << EOF
|
||||
${P+\"$P\"}
|
||||
${P+"$P"}
|
||||
EOF
|
||||
|
||||
recho "${P+\"$P\"}"
|
||||
|
||||
recho "${P+"$P"}"
|
||||
recho ${P+"$P"}
|
||||
@@ -237,6 +237,22 @@ outside 2.0: foo=<unset>
|
||||
foo=foo environment foo=foo
|
||||
foo=<unset> environment foo=
|
||||
outside 2.1: foo=<unset>
|
||||
declare -- var="global"
|
||||
declare -- var
|
||||
declare -- var="local"
|
||||
declare -- var="global"
|
||||
declare -- var="local"
|
||||
declare -- var
|
||||
declare -- var="local"
|
||||
declare -- var
|
||||
declare -- var="local"
|
||||
declare -- var
|
||||
declare -- var="local"
|
||||
declare -- var="f1"
|
||||
declare -- var="local"
|
||||
declare -a arr=([0]="zero" [1]="one" [2]="two")
|
||||
declare -a arr=([0]="three" [1]="four" [2]="five")
|
||||
declare -a arr=([0]="zero" [1]="one" [2]="two")
|
||||
a=z
|
||||
a=b
|
||||
a=z
|
||||
|
||||
+2
-2
@@ -252,10 +252,10 @@ ${THIS_SH} ./varenv13.sub
|
||||
|
||||
# localvar_inherit
|
||||
${THIS_SH} ./varenv14.sub
|
||||
|
||||
${THIS_SH} ./varenv15.sub
|
||||
|
||||
${THIS_SH} ./varenv16.sub
|
||||
${THIS_SH} ./varenv17.sub
|
||||
${THIS_SH} ./varenv18.sub
|
||||
|
||||
# make sure variable scoping is done right
|
||||
tt() { typeset a=b;echo a=$a; };a=z;echo a=$a;tt;echo a=$a
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
# 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/>.
|
||||
#
|
||||
|
||||
# testing -I and local variable inheritance
|
||||
var=global
|
||||
|
||||
f()
|
||||
{
|
||||
local $1 var
|
||||
declare -p var
|
||||
|
||||
var=local
|
||||
declare -p var
|
||||
}
|
||||
|
||||
declare -I var
|
||||
declare -p var
|
||||
|
||||
f
|
||||
f -I
|
||||
unset var
|
||||
f
|
||||
f -I
|
||||
|
||||
f1()
|
||||
{
|
||||
var=$FUNCNAME
|
||||
|
||||
f
|
||||
f -I
|
||||
}
|
||||
|
||||
f1
|
||||
@@ -0,0 +1,43 @@
|
||||
# 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/>.
|
||||
#
|
||||
|
||||
# this uses value inheritance internally so that the self-reference in the
|
||||
# local variable declaration works right
|
||||
|
||||
arr=(zero one two)
|
||||
four=four
|
||||
|
||||
f()
|
||||
{
|
||||
local -a arr=( "${arr[@]}" )
|
||||
declare -p arr
|
||||
}
|
||||
|
||||
f
|
||||
|
||||
f1()
|
||||
{
|
||||
local -a arr=(three $four five)
|
||||
declare -p arr
|
||||
}
|
||||
f1
|
||||
|
||||
set -u
|
||||
name='arr[@]'
|
||||
f2()
|
||||
{
|
||||
local -a arr=("${!name}")
|
||||
declare -p arr
|
||||
}
|
||||
f2
|
||||
Reference in New Issue
Block a user