mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-13 07:00:49 +02:00
commit bash-20171222 snapshot
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
BUILD_DIR=/usr/local/build/bash/bash-current
|
||||
BUILD_DIR=/usr/local/build/chet/bash/bash-current
|
||||
THIS_SH=$BUILD_DIR/bash
|
||||
PATH=$PATH:$BUILD_DIR
|
||||
|
||||
|
||||
@@ -14,3 +14,33 @@ printf '<%s>' "$a" "$b" "$c" "$d" "$e" "$f" ; echo
|
||||
unset f g
|
||||
f=${*,,} g=${*@Q}
|
||||
printf '<%s>' "$f" "$g" ; echo
|
||||
|
||||
unset -v a b c d e f g
|
||||
unset var
|
||||
|
||||
# resetting IFS here
|
||||
|
||||
IFS=$' \t\n'
|
||||
|
||||
printf '%s\n' "${*:1}"
|
||||
var=${*:1}; printf '%s\n' "$var"
|
||||
var="${*:1}"; printf '%s\n' "$var"
|
||||
|
||||
unset var
|
||||
recho ${var-${*}}
|
||||
recho ${var-${*:1}}
|
||||
recho "${var-${*:1}}"
|
||||
recho ${var-"${*:1}"}
|
||||
|
||||
unset var
|
||||
recho ${var=${*}}
|
||||
printf 'var=%s\n' "$var"
|
||||
unset var
|
||||
recho ${var=${*:1}}
|
||||
printf 'var=%s\n' "$var"
|
||||
|
||||
a=${*:1}
|
||||
recho "$a"
|
||||
|
||||
: ${b=${*:1}}
|
||||
recho "$b"
|
||||
|
||||
@@ -560,3 +560,20 @@ argv[2] = <>
|
||||
<12><12><12><12><12><12>
|
||||
<12><12><12><12><12><12>
|
||||
<12><'1''2'>
|
||||
1 2
|
||||
1 2
|
||||
1 2
|
||||
argv[1] = <1>
|
||||
argv[2] = <2>
|
||||
argv[1] = <1>
|
||||
argv[2] = <2>
|
||||
argv[1] = <1 2>
|
||||
argv[1] = <1 2>
|
||||
argv[1] = <1>
|
||||
argv[2] = <2>
|
||||
var=1 2
|
||||
argv[1] = <1>
|
||||
argv[2] = <2>
|
||||
var=1 2
|
||||
argv[1] = <1 2>
|
||||
argv[1] = <1 2>
|
||||
|
||||
+175
-6
@@ -63,16 +63,22 @@ argv[2] = <2>
|
||||
argv[1] = <1>
|
||||
argv[2] = <2>
|
||||
argv[1] = <12>
|
||||
argv[1] = <1>
|
||||
argv[2] = <2>
|
||||
argv[1] = <1 2>
|
||||
argv[1] = <1>
|
||||
argv[2] = <2>
|
||||
argv[1] = <1 2>
|
||||
argv[1] = <1 2>
|
||||
argv[1] = <1 2>
|
||||
argv[1] = <1 2>
|
||||
argv[1] = <1 2>
|
||||
argv[1] = <12>
|
||||
argv[1] = <12>
|
||||
argv[1] = <12>
|
||||
argv[1] = <12>
|
||||
argv[1] = <12>
|
||||
argv[1] = <12>
|
||||
argv[1] = <1 2>
|
||||
argv[1] = <1 2>
|
||||
argv[1] = <12>
|
||||
argv[1] = <12>
|
||||
normal IFS
|
||||
argv[1] = <abc>
|
||||
argv[2] = <def>
|
||||
@@ -106,5 +112,168 @@ argv[2] = <def ghi>
|
||||
argv[3] = <jkl >
|
||||
argv[1] = < abc def ghi jkl >
|
||||
argv[1] = < abc def ghi jkl >
|
||||
./posixexp.tests: line 80: unexpected EOF while looking for matching `}'
|
||||
./posixexp.tests: line 81: syntax error: unexpected end of file
|
||||
|
||||
001: IFS = (unset): unset -v foo; set -- ${foo=$*}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
002: IFS = (unset): unset -v foo; set -- ${foo="$*"}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
003: IFS = (unset): unset -v foo; set -- "${foo=$*}"
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
004: IFS = (unset): foo=; set -- ${foo:=$*}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
005: IFS = (unset): foo=; set -- ${foo:="$*"}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
006: IFS = (unset): foo=; set -- "${foo:=$*}"
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
007: IFS = (unset): unset -v foo; set -- ${foo=$@}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
008: IFS = (unset): unset -v foo; set -- ${foo="$@"}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
009: IFS = (unset): unset -v foo; set -- "${foo=$@}"
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
010: IFS = (unset): foo=; set -- ${foo:=$@}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
011: IFS = (unset): foo=; set -- ${foo:="$@"}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
012: IFS = (unset): foo=; set -- "${foo:=$@}"
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
013: IFS = (null): unset -v foo; set -- ${foo=$*}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
014: IFS = (null): unset -v foo; set -- ${foo="$*"}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
015: IFS = (null): unset -v foo; set -- "${foo=$*}"
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
016: IFS = (null): foo=; set -- ${foo:=$*}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
017: IFS = (null): foo=; set -- ${foo:="$*"}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
018: IFS = (null): foo=; set -- "${foo:=$*}"
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
019: IFS = (null): unset -v foo; set -- ${foo=$@}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
020: IFS = (null): unset -v foo; set -- ${foo="$@"}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
021: IFS = (null): unset -v foo; set -- "${foo=$@}"
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
022: IFS = (null): foo=; set -- ${foo:=$@}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
023: IFS = (null): foo=; set -- ${foo:="$@"}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
024: IFS = (null): foo=; set -- "${foo:=$@}"
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
025: IFS = x: unset -v foo; set -- ${foo=$*}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
026: IFS = x: unset -v foo; set -- ${foo="$*"}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
027: IFS = x: unset -v foo; set -- "${foo=$*}"
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
028: IFS = x: foo=; set -- ${foo:=$*}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
029: IFS = x: foo=; set -- ${foo:="$*"}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
030: IFS = x: foo=; set -- "${foo:=$*}"
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
031: IFS = x: unset -v foo; set -- ${foo=$@}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
032: IFS = x: unset -v foo; set -- ${foo="$@"}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
033: IFS = x: unset -v foo; set -- "${foo=$@}"
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
034: IFS = x: foo=; set -- ${foo:=$@}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
035: IFS = x: foo=; set -- ${foo:="$@"}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
036: IFS = x: foo=; set -- "${foo:=$@}"
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
037: IFS = sp ht nl: unset -v foo; set -- ${foo=$*}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
038: IFS = sp ht nl: unset -v foo; set -- ${foo="$*"}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
039: IFS = sp ht nl: unset -v foo; set -- "${foo=$*}"
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
040: IFS = sp ht nl: foo=; set -- ${foo:=$*}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
041: IFS = sp ht nl: foo=; set -- ${foo:="$*"}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
042: IFS = sp ht nl: foo=; set -- "${foo:=$*}"
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
043: IFS = sp ht nl: unset -v foo; set -- ${foo=$@}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
044: IFS = sp ht nl: unset -v foo; set -- ${foo="$@"}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
045: IFS = sp ht nl: unset -v foo; set -- "${foo=$@}"
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
046: IFS = sp ht nl: foo=; set -- ${foo:=$@}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
047: IFS = sp ht nl: foo=; set -- ${foo:="$@"}
|
||||
soh stx etx del / soh stx etx del
|
||||
|
||||
048: IFS = sp ht nl: foo=; set -- "${foo:=$@}"
|
||||
soh stx etx del / soh stx etx del
|
||||
argv[1] = <^A^B^C^?>
|
||||
argv[1] = <^A^B^C^?>
|
||||
argv[1] = <^A^B^C^?>
|
||||
argv[1] = <^A^B^C^?>
|
||||
argv[1] = <^A^B^C^?>
|
||||
argv[1] = <^A^B^C^?>
|
||||
argv[1] = <^A^B^C^?>
|
||||
argv[1] = <^A^B^C^?>
|
||||
argv[1] = <a>
|
||||
argv[2] = <b>
|
||||
argv[1] = <a>
|
||||
argv[2] = <b>
|
||||
argv[1] = <a>
|
||||
argv[2] = <b>
|
||||
argv[1] = <a>
|
||||
argv[2] = <b>
|
||||
[ abc def ghi jkl / abc def ghi jkl ]
|
||||
[ abc def ghi jkl ]
|
||||
[ abc def ghi jkl / abc def ghi jkl / abc def ghi jkl ]
|
||||
./posixexp.tests: line 82: unexpected EOF while looking for matching `}'
|
||||
./posixexp.tests: line 83: syntax error: unexpected end of file
|
||||
|
||||
@@ -74,6 +74,8 @@ rm -f $TMPDIR/sh
|
||||
|
||||
${THIS_SH} ./posixexp3.sub
|
||||
${THIS_SH} ./posixexp4.sub
|
||||
${THIS_SH} ./posixexp5.sub
|
||||
${THIS_SH} ./posixexp6.sub
|
||||
|
||||
# this will be an error
|
||||
foo=bar
|
||||
|
||||
@@ -25,11 +25,28 @@ recho ${var-"$*"}
|
||||
|
||||
unset -v a b c d
|
||||
# Posix interp 221
|
||||
# there should never be any word splitting because IFS is null
|
||||
recho ${a=$@}
|
||||
recho "$a"
|
||||
recho $a
|
||||
recho ${b="$@"}
|
||||
recho "$b"
|
||||
recho $b
|
||||
recho ${c=$*}
|
||||
recho "$c"
|
||||
recho $c
|
||||
recho ${d="$*"}
|
||||
recho "$d"
|
||||
recho $d
|
||||
|
||||
unset -v a b c d
|
||||
a=$@
|
||||
recho $a
|
||||
b="$@"
|
||||
recho $b
|
||||
c=$*
|
||||
recho $c
|
||||
d="$*"
|
||||
recho $d
|
||||
|
||||
unset -v parameter a b c d
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
# test suite contribution from Martijn Dekker
|
||||
|
||||
defaultIFS=$IFS
|
||||
set -o errexit -o noglob
|
||||
(set -o pipefail) 2>/dev/null && set -o pipefail
|
||||
teststring=$(printf '\1\2\3\177')
|
||||
n=0
|
||||
|
||||
trim_od() {
|
||||
od -a | sed -n '1 { s/^0*[[:blank:]]*//; s/[[:blank:]]*$//; p; }'
|
||||
}
|
||||
|
||||
doTest() {
|
||||
set -- "$teststring"
|
||||
eval "$testcmd"
|
||||
case ${IFS+s}${IFS:+n} in
|
||||
( sn ) i=$(printf %s "$IFS" | trim_od) ;;
|
||||
( s ) i='(null)' ;;
|
||||
( '' ) i='(unset)' ;;
|
||||
( * ) echo 'internal error!' >&2; exit 125 ;;
|
||||
esac
|
||||
printf '\n%03d: IFS = %s: %s\n' "$((n+=1))" "$i" "$testcmd"
|
||||
printf %s "$*${foo+/}${foo-}" | trim_od
|
||||
}
|
||||
|
||||
doAllTests() {
|
||||
for testcmd in \
|
||||
'unset -v foo; set -- ${foo=$*}' \
|
||||
'unset -v foo; set -- ${foo="$*"}' \
|
||||
'unset -v foo; set -- "${foo=$*}"' \
|
||||
\
|
||||
'foo=; set -- ${foo:=$*}' \
|
||||
'foo=; set -- ${foo:="$*"}' \
|
||||
'foo=; set -- "${foo:=$*}"' \
|
||||
\
|
||||
'unset -v foo; set -- ${foo=$@}' \
|
||||
'unset -v foo; set -- ${foo="$@"}' \
|
||||
'unset -v foo; set -- "${foo=$@}"' \
|
||||
\
|
||||
'foo=; set -- ${foo:=$@}' \
|
||||
'foo=; set -- ${foo:="$@"}' \
|
||||
'foo=; set -- "${foo:=$@}"'
|
||||
do
|
||||
doTest "$testcmd"
|
||||
done
|
||||
}
|
||||
|
||||
unset -v IFS; doAllTests
|
||||
IFS=''; doAllTests
|
||||
IFS='x'; doAllTests
|
||||
IFS=$defaultIFS; doAllTests
|
||||
@@ -0,0 +1,57 @@
|
||||
var=$'\01\02\03\177'
|
||||
|
||||
bar=${unset:-$var}
|
||||
recho "$bar"
|
||||
unset -v bar
|
||||
bar=${unset:-"$var"}
|
||||
recho "$bar"
|
||||
|
||||
foo=${parameter:=$var}
|
||||
|
||||
recho "$foo"
|
||||
recho "$parameter"
|
||||
|
||||
unset -v foo parameter
|
||||
|
||||
foo=${parameter:="$var"}
|
||||
|
||||
recho "$foo"
|
||||
recho "$parameter"
|
||||
|
||||
unset -v foo parameter
|
||||
|
||||
foo="${parameter:=$var}"
|
||||
|
||||
recho "$foo"
|
||||
recho "$parameter"
|
||||
|
||||
unset -v foo parameter
|
||||
|
||||
recho ${parameter:=a\ b}
|
||||
unset -v parameter
|
||||
|
||||
recho ${parameter:="a b"}
|
||||
unset -v parameter
|
||||
|
||||
v='a b'
|
||||
|
||||
recho ${parameter:=$v}
|
||||
unset -v parameter
|
||||
|
||||
recho ${parameter:="$v"}
|
||||
unset -v parameter
|
||||
|
||||
# unsetting IFS here
|
||||
|
||||
set " abc " " def ghi " "jkl "
|
||||
unset -v IFS var
|
||||
var=${var-$*}/${var-$*}
|
||||
printf '[%s]\n' "$var"
|
||||
|
||||
unset -v var
|
||||
: ${var=$*}
|
||||
printf '[%s]\n' "$var"
|
||||
|
||||
unset -v var
|
||||
: ${var:=$*/$*/${var-$*}}
|
||||
printf '[%s]\n' "$var"
|
||||
+17
-11
@@ -1,13 +1,19 @@
|
||||
./rsh.tests: line 9: cd: restricted
|
||||
./rsh.tests: line 10: PATH: readonly variable
|
||||
./rsh.tests: line 11: SHELL: readonly variable
|
||||
./rsh.tests: line 12: /bin/sh: restricted: cannot specify `/' in command names
|
||||
./rsh.tests: line 14: .: ./source.sub3: restricted
|
||||
./rsh.tests: line 17: /tmp/restricted: restricted: cannot redirect output
|
||||
./rsh.tests: line 21: /tmp/restricted: restricted: cannot redirect output
|
||||
./rsh.tests: line 26: command: -p: restricted
|
||||
./rsh.tests: line 28: set: +r: invalid option
|
||||
./rsh1.sub: line 9: /bin/sh: restricted
|
||||
./rsh1.sub: line 11: sh: not found
|
||||
./rsh1.sub: line 12: a: command not found
|
||||
./rsh2.sub: line 10: hash: /bin/sh: restricted
|
||||
./rsh2.sub: line 12: hash: sh: not found
|
||||
./rsh2.sub: line 13: a: command not found
|
||||
./rsh.tests: line 12: cd: restricted
|
||||
./rsh.tests: line 13: PATH: readonly variable
|
||||
./rsh.tests: line 14: SHELL: readonly variable
|
||||
./rsh.tests: line 15: /bin/sh: restricted: cannot specify `/' in command names
|
||||
./rsh.tests: line 17: .: ./source.sub3: restricted
|
||||
./rsh.tests: line 20: /tmp/restricted: restricted: cannot redirect output
|
||||
./rsh.tests: line 24: /tmp/restricted: restricted: cannot redirect output
|
||||
./rsh.tests: line 29: command: -p: restricted
|
||||
./rsh.tests: line 31: set: +r: invalid option
|
||||
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
|
||||
./rsh.tests: line 29: set: restricted: invalid option name
|
||||
./rsh.tests: line 31: exec: restricted
|
||||
./rsh.tests: line 32: set: restricted: invalid option name
|
||||
./rsh.tests: line 34: exec: restricted
|
||||
./rsh.tests: after exec
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
# adding builtins dynamically with enable -f
|
||||
# importing function definitions from environment
|
||||
|
||||
${THIS_SH} ./rsh1.sub
|
||||
${THIS_SH} ./rsh2.sub
|
||||
|
||||
set -r
|
||||
|
||||
cd /
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
cd ${TMPDIR:-/tmp}
|
||||
cp /bin/sh .
|
||||
|
||||
PATH=/rbin:/usr/local/rbin
|
||||
hash -p /bin/rm rm
|
||||
|
||||
set -r
|
||||
|
||||
BASH_CMDS[x]=/bin/sh
|
||||
|
||||
BASH_CMDS[a]="sh"
|
||||
a -c 'echo hello'
|
||||
|
||||
rm -f sh a
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,17 @@
|
||||
cd ${TMPDIR:-/tmp}
|
||||
cp /bin/sh .
|
||||
ln sh a
|
||||
|
||||
PATH=/rbin:/usr/local/rbin
|
||||
hash -p /bin/rm rm
|
||||
|
||||
set -r
|
||||
|
||||
hash -p /bin/sh sh
|
||||
|
||||
hash -p sh a
|
||||
a -c 'echo hello'
|
||||
|
||||
rm -f sh a
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user