commit bash-20130301 snapshot

This commit is contained in:
Chet Ramey
2013-03-26 20:51:22 -04:00
parent 8eb22ee966
commit c7e43312f9
220 changed files with 45368 additions and 801 deletions
+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
+9
View File
@@ -0,0 +1,9 @@
BUILD_DIR=/usr/local/build/chet/bash/bash-current
THIS_SH=$BUILD_DIR/bash
PATH=$PATH:$BUILD_DIR
export THIS_SH PATH
rm -f /tmp/xx
/bin/sh "$@"
+4
View File
@@ -207,6 +207,10 @@ case "$@" in
*) echo bad 4;;
esac
# tests for the effect of quoting $* and $@ in an assignment context (plus
# arrays) -- bugs through bash 4.2
${THIS_SH} ./dollar-at-star1.sub
# tests for special expansion of "$*" and "${array[*]}" when used with other
# expansions -- bugs through bash-2.05b
${THIS_SH} ./dollar-star1.sub
+23
View File
@@ -0,0 +1,23 @@
# from dan douglas
expassign()
{
typeset -a a
a=("$@")
typeset var asn
while IFS= read -r asn; do
IFS=: command eval "$asn"
printf '%-14s... %s\n' "$asn" "$var"
done <<\EOF
var=${a[*]}
var="${a[*]}"
var=$*
var="$*"
var=${a[@]}
var="${a[@]}"
var=$@
var="$@"
EOF
}
expassign one:::two three:::four
+8
View File
@@ -95,6 +95,14 @@ ok 1
ok 2
ok 3
ok 4
var=${a[*]} ... one:::two:three:::four
var="${a[*]}" ... one:::two:three:::four
var=$* ... one:::two:three:::four
var="$*" ... one:::two:three:::four
var=${a[@]} ... one:::two three:::four
var="${a[@]}" ... one:::two three:::four
var=$@ ... one:::two three:::four
var="$@" ... one:::two three:::four
xa|xb|xc
xa|xb|xc
a|b|c
+7 -6
View File
@@ -4,28 +4,29 @@ aa bb cc dd ee
after exec1.sub with args: 0
after exec1.sub without args: 0
./execscript: line 20: notthere: command not found
after exec1.sub: one two three
./execscript: line 21: notthere: command not found
127
/tmp/bash: notthere: No such file or directory
127
/bin/sh: /bin/sh: cannot execute binary file
126
./execscript: line 39: /: Is a directory
./execscript: line 40: /: Is a directory
126
/: /: is a directory
126
./execscript: line 46: .: /: is a directory
./execscript: line 47: .: /: is a directory
1
126
0
this is bashenv
./exec3.sub: line 3: /tmp/bash-notthere: No such file or directory
127
./execscript: line 70: notthere: No such file or directory
./execscript: line 71: notthere: No such file or directory
127
./execscript: line 73: notthere: No such file or directory
./execscript: line 74: notthere: No such file or directory
127
./execscript: line 76: notthere: command not found
./execscript: line 77: notthere: command not found
127
this is sh
this is sh
+1
View File
@@ -12,6 +12,7 @@ echo calling exec1.sub
echo after exec1.sub with args: $?
./exec1.sub
echo after exec1.sub without args: $?
echo after exec1.sub: "$@"
# set up a fixed path so we know notthere will not be found
PATH=/usr/bin:/bin:/usr/local/bin:
+126
View File
@@ -0,0 +1,126 @@
export LC_ALL=C
export LANG=C
if [ $UID -eq 0 ]; then
echo "execscript: the test suite should not be run as root" >&2
fi
set -- one two three
echo before exec1.sub: "$@"
echo calling exec1.sub
./exec1.sub aa bb cc dd ee
echo after exec1.sub with args: $?
./exec1.sub
echo after exec1.sub without args: $?
# set up a fixed path so we know notthere will not be found
PATH=/usr/bin:/bin:/usr/local/bin:
export PATH
notthere
echo $?
# this is iffy, since the error messages may vary from system to system
# and /tmp might not exist
ln -s ${THIS_SH} /tmp/bash 2>/dev/null
if [ -f /tmp/bash ]; then
/tmp/bash notthere
else
${THIS_SH} notthere
fi
echo $?
rm -f /tmp/bash
# /bin/sh should be there on all systems
${THIS_SH} /bin/sh
echo $?
# try executing a directory
/
echo $?
${THIS_SH} /
echo $?
# try sourcing a directory
. /
echo $?
# try sourcing a binary file -- post-2.04 versions don't do the binary file
# check, and will probably fail with `command not found', or status 127
# bash-4.1 and later check for 256 NUL characters and fail as binary files
# if there are more than that, it's probably binary
. ${THIS_SH} 2>/dev/null
echo $?
# post-bash-2.05 versions allow sourcing non-regular files
. /dev/null
echo $?
# kill two birds with one test -- test out the BASH_ENV code
echo echo this is bashenv > /tmp/bashenv
export BASH_ENV=/tmp/bashenv
${THIS_SH} ./exec3.sub
rm -f /tmp/bashenv
unset BASH_ENV
# we're resetting the $PATH to empty, so this should be last
PATH=
notthere
echo $?
command notthere
echo $?
command -p notthere
echo $?
# but -p should guarantee that we find all the standard utilities, even
# with an empty or unset $PATH
command -p sh -c 'echo this is $0'
unset PATH
command -p sh -c 'echo this is $0'
# a bug in bash before bash-2.01 caused PATH to be set to the empty string
# when command -p was run with PATH unset
echo ${PATH-unset}
echo "echo ok" | ${THIS_SH} -t
${THIS_SH} ./exec2.sub
echo $?
${THIS_SH} ./exec4.sub
# try exec'ing a command that cannot be found in $PATH
${THIS_SH} ./exec5.sub
# this was a bug in bash versions before bash-2.04
${THIS_SH} -c 'cat </dev/null | cat >/dev/null' >&-
# checks for proper return values in subshell commands with inverted return
# values
${THIS_SH} ./exec6.sub
# checks for properly deciding what constitutes an executable file
${THIS_SH} ./exec7.sub
${THIS_SH} -i ./exec8.sub
${THIS_SH} ./exec9.sub
true | `echo true` &
echo after
# Problem with bash at least back to version 3.0
${THIS_SH} -c 'VAR=0; VAR=1 command exec; exit ${VAR}'
# problem with bash through bash-4.1
(
exec /var/empty/nosuch
echo bad
) 2>/dev/null
[ $? = 127 ] || echo FAIL: bad exit status $? at $LINENO
+50
View File
@@ -0,0 +1,50 @@
:; ./shx
sh:
<&$fd ok
nlbq Mon Aug 3 02:45:00 EDT 1992
bang geoff
quote 712824302
setbq defmsgid=<1992Aug3.024502.6176@host>
bgwait sleep done... wait 6187
bash:
<&$fd ok
nlbq Mon Aug 3 02:45:09 EDT 1992
bang geoff
quote 712824311
setbq defmsgid=<1992Aug3.024512.6212@host>
bgwait sleep done... wait 6223
ash:
<&$fd shx1: 4: Syntax error: Bad fd number
nlbq Mon Aug 3 02:45:19 EDT 1992
bang geoff
quote getdate: `"now"' not a valid date
setbq defmsgid=<1992Aug3.` echo 024521
bgwait sleep done... wait 6241
ksh:
<&$fd ok
nlbq ./shx: 6248 Memory fault - core dumped
bang geoff
quote getdate: `"now"' not a valid date
setbq defmsgid=<1992Aug3.024530.6257@host>
bgwait no such job: 6265
wait 6265
sleep done...
zsh:
<&$fd ok
nlbq Mon Aug 3 02:45:36 EDT 1992
bang shx3: event not found: /s/ [4]
quote 712824337
setbq defmsgid=<..6290@host>
bgwait shx7: unmatched " [9]
sleep done...
:;
+10
View File
@@ -0,0 +1,10 @@
#! /bin/sh
for cmd in sh bash ash ksh zsh
do
echo
echo $cmd:
for demo in shx?
do
$cmd $demo
done
done