commit bash-20130125 snapshot

This commit is contained in:
Chet Ramey
2013-02-05 16:44:34 -05:00
parent f0c4de40a4
commit 1a81420a36
25 changed files with 421 additions and 66 deletions
+4
View File
@@ -245,4 +245,8 @@ ${THIS_SH} ./dollar-at5.sub
# tests for expansions of $* when $1 == ""; problem through bash-4.2
${THIS_SH} ./dollar-star6.sub
# tests for expansions of $* (unquoted) when IFS changes (e.g., ${IFS:=-})
# problem through bash-4.2
${THIS_SH} ./dollar-star7.sub
exit 0
+30
View File
@@ -0,0 +1,30 @@
# if IFS side effects in ${IFS=} assignments take place, how do you cope with
# later changes to IFS in the same set of expansions? You've already
# committed to using the first character of the (old) IFS to expand $* in
# the previous expansions, and changing it to not include ' ', for instance,
# results in the first couple of ${*} below not being split at all
set -f -- a b c
unset -v IFS
printf '<%s> ' ${*}${IFS=}${*}${IFS:=-}"${*}"
echo
printf "after 1: IFS "
echo "${IFS-unset}"
recho "$*"
set -f -- a 'b c' d
unset -v IFS
printf '<%s> ' ${*}${IFS=}${*}${IFS:=-}"${*}"
echo
printf "after 2: IFS "
echo "${IFS-unset}"
recho "$*"
unset -v IFS
recho $*
recho "$*"
IFS=' '
recho $*
recho "$*"
+16
View File
@@ -237,3 +237,19 @@ argv[1] = <A^?R>
argv[1] = <AwR>
argv[1] = <AwR>
argv[1] = <A^?R>
<a> <b> <ca> <b> <c-a-b-c>
after 1: IFS -
argv[1] = <a-b-c>
<a> <b> <c> <da> <b c> <d-a-b c-d>
after 2: IFS -
argv[1] = <a-b c-d>
argv[1] = <a>
argv[2] = <b>
argv[3] = <c>
argv[4] = <d>
argv[1] = <a b c d>
argv[1] = <a>
argv[2] = <b>
argv[3] = <c>
argv[4] = <d>
argv[1] = <a b c d>
+16
View File
@@ -189,3 +189,19 @@ argv[1] = <c>
argv[1] = <c>
argv[1] = <c>
argv[1] = <c>
argv[1] = <correct>
argv[2] = <>
argv[1] = <correct>
argv[2] = <>
argv[1] = <correct>
argv[2] = <>
argv[1] = <XwrongX>
argv[2] = <>
argv[1] = <correct>
argv[2] = <a>
argv[1] = <XwrongX>
argv[2] = <a>
argv[1] = <correct>
argv[2] = <a>
argv[1] = <correct>
argv[2] = <a>
+14
View File
@@ -14,3 +14,17 @@ recho """"c""""""
recho """"""""c
recho c""""""""
# BASH BUG: spurious DEL characters appear on empty variable interpolation.
# BASH 4.2.8(1)-release
a=''
recho correct "$a" # correct empty output line
recho correct "$a""$a" # correct empty output line
recho correct "$a""$a""$a" # correct empty output line
recho XwrongX "$a""$a""$a""$a" # spurious two DEL chars appear at line end
recho correct a"$a" # correct single "a" on line
recho XwrongX a"$a""$a" # spurious DEL char appears at line end
recho correct a"$a$a" # correct single "a" on line
recho correct a"$a$a$a$a" # correct single "a" on line
+10
View File
@@ -75,6 +75,16 @@ command substitution
trap: 8
+[9] echo 4
4
exit subshell 1
current shell
exit subshell 2
current shell
current shell
current shell
outside 1
outside 2
outside 3
outside 4
caught a child death
caught a child death
caught a child death
+2
View File
@@ -68,6 +68,8 @@ trap '' USR2
${THIS_SH} ./trap3.sub
${THIS_SH} ./trap4.sub
#
# show that setting a trap on SIGCHLD is not disastrous.
#
+17
View File
@@ -0,0 +1,17 @@
# make sure subshells at the end of pipelines run any exit traps they set
: | { trap 'echo exit subshell 1' EXIT; exit; }; echo current shell
: | { trap 'echo exit subshell 2' EXIT; exit; }; echo current shell
: | { trap 'echo exit subshell 3' EXIT; exit; } | : ; echo current shell
: | { trap 'echo exit subshell 4' EXIT; exit; } | : ; echo current shell
trap 'echo inherited exit trap' EXIT
: | { exit; } ; echo outside 1
: | ( exit; ) ; echo outside 2
: | { exit; } | : ; echo outside 3
: | ( exit; ) | : ; echo outside 4
trap - EXIT
+4
View File
@@ -60,6 +60,10 @@ FIN: asdf fdsa, asdf fdsa
g: v = , w =
f: v = , w =
FIN: v = two, w = one
declare -Ar FOOBAR='([foo]="bar" )'
declare -Ar FOOBAR='([foo]="bar" )'
declare -ar FOOBAR2='([0]="bar")'
declare -ar FOOBAR2='([0]="bar")'
a=z
a=b
a=z
+3
View File
@@ -208,5 +208,8 @@ $THIS_SH ./varenv3.sub
# scoping problems with declare -g through bash-4.2
${THIS_SH} ./varenv4.sub
# more scoping and declaration problems with -g and arrays through bash-4.2
${THIS_SH} ./varenv5.sub
# make sure variable scoping is done right
tt() { typeset a=b;echo a=$a; };a=z;echo a=$a;tt;echo a=$a
+16
View File
@@ -0,0 +1,16 @@
function foobar {
declare -rgA FOOBAR=([foo]=bar)
declare -p FOOBAR
}
foobar
declare -p FOOBAR
unset -f foobar
foobar() {
declare -rga FOOBAR2=([foo]=bar)
declare -p FOOBAR2
}
foobar
declare -p FOOBAR2