mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-13 23:20:49 +02:00
commit bash-20200803 snapshot
This commit is contained in:
@@ -757,3 +757,9 @@ declare -A A=(["*"]="X" ["@"]="X" )
|
||||
./array27.sub: line 69: A[*]: bad array subscript
|
||||
./array27.sub: line 69: A[@]: bad array subscript
|
||||
declare -A A
|
||||
declare -a bug4=([0]="" [1]="5" [2]="" [3]="1" [4]="")
|
||||
declare -a bug=([0]="" [1]="5" [2]="" [3]="1" [4]="")
|
||||
declare -a bug2=([0]="")
|
||||
declare -a bug3=([0]="" [1]="5" [2]="" [3]="1" [4]="")
|
||||
declare -a not_bug=([0]="no" [1]="nulls")
|
||||
declare -a workaround=([0]="")
|
||||
|
||||
@@ -424,3 +424,4 @@ ${THIS_SH} ./array24.sub
|
||||
${THIS_SH} ./array25.sub
|
||||
${THIS_SH} ./array26.sub
|
||||
${THIS_SH} ./array27.sub
|
||||
${THIS_SH} ./array28.sub
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
# 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/>.
|
||||
#
|
||||
|
||||
# tests for assigning empty string array elements without subscripts
|
||||
function foo()
|
||||
{
|
||||
local bug=("" "5" "" 1 "")
|
||||
declare -a bug2=("")
|
||||
declare -ga bug3=("" "5" "" 1 "")
|
||||
local not_bug=("no" "nulls")
|
||||
local workaround; workaround=("")
|
||||
|
||||
declare -p bug bug2 bug3 not_bug workaround
|
||||
}
|
||||
|
||||
declare -a bug4=("" "5" "" 1 "")
|
||||
declare -p bug4
|
||||
|
||||
foo
|
||||
+2
-1
@@ -14,6 +14,8 @@
|
||||
HISTFILE=$TMPDIR/newhistory-$$
|
||||
export HISTFILE
|
||||
|
||||
trap 'rm -f $HISTFILE' EXIT
|
||||
|
||||
HISTSIZE=32
|
||||
HISTFILESIZE=32
|
||||
echo
|
||||
@@ -43,4 +45,3 @@ echo
|
||||
printf "$input" | HISTSIZE= HISTFILE= ${THIS_SH} --norc -i 2>/dev/null
|
||||
echo
|
||||
printf "$input" | HISTSIZE=6 HISTFILE= ${THIS_SH} --norc -i 2>/dev/null
|
||||
|
||||
|
||||
@@ -260,6 +260,11 @@ declare -x v="x"
|
||||
declare -x v="t"
|
||||
declare -- v
|
||||
declare -x v
|
||||
ignoreeof on
|
||||
ignoreeof off
|
||||
ignoreeof on
|
||||
10
|
||||
match 1
|
||||
a=z
|
||||
a=b
|
||||
a=z
|
||||
|
||||
@@ -258,6 +258,7 @@ ${THIS_SH} ./varenv17.sub
|
||||
${THIS_SH} ./varenv18.sub
|
||||
${THIS_SH} ./varenv19.sub
|
||||
${THIS_SH} ./varenv20.sub
|
||||
${THIS_SH} ./varenv21.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,48 @@
|
||||
# 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/>.
|
||||
#
|
||||
# test behavior of `local -' inside shell functions
|
||||
|
||||
IGNOREEOF=0
|
||||
shopt -o ignoreeof
|
||||
|
||||
f()
|
||||
{
|
||||
local -
|
||||
set +o ignoreeof
|
||||
shopt -o ignoreeof
|
||||
}
|
||||
|
||||
f
|
||||
shopt -o ignoreeof
|
||||
echo $IGNOREEOF
|
||||
|
||||
unset -f f
|
||||
|
||||
f()
|
||||
{
|
||||
local -
|
||||
set -m -H +B
|
||||
set -u
|
||||
}
|
||||
|
||||
before="$-|$SHELLOPTS"
|
||||
f
|
||||
after="$-|$SHELLOPTS"
|
||||
|
||||
case "$after" in
|
||||
$before) echo match 1 ;;
|
||||
*) echo bad 1 ;;
|
||||
esac
|
||||
|
||||
unset -f f
|
||||
Reference in New Issue
Block a user