diff options
author | Denys Vlasenko | 2016-10-02 02:46:56 +0200 |
---|---|---|
committer | Denys Vlasenko | 2016-10-02 02:46:56 +0200 |
commit | 0aaaa50b4551ab5912ccd95d66d633844eac6d85 (patch) | |
tree | 1a1f9e34c690051a678fb048064e4e98cca3536b /shell/hush_test | |
parent | 42eeb255c1c5f35373d3e7bfa892e4f864cf1266 (diff) | |
download | busybox-0aaaa50b4551ab5912ccd95d66d633844eac6d85.zip busybox-0aaaa50b4551ab5912ccd95d66d633844eac6d85.tar.gz |
ash: expand: Fixed "$@" expansion when EXP_FULL is false
Upstream commit:
Date: Thu, 1 Jan 2015 07:53:10 +1100
expand: Fixed "$@" expansion when EXP_FULL is false
The commit 3c06acdac0b1ba0e0acdda513a57ee6e31385dce ([EXPAND]
Split unquoted $@/$* correctly when IFS is set but empty) broke
the case where $@ is in quotes and EXP_FULL is false.
In that case we should still emit IFS as field splitting is not
performed.
Reported-by: Juergen Daubert <jue@jue.li>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush_test')
-rw-r--r-- | shell/hush_test/hush-vars/var_wordsplit_ifs1.right | 16 | ||||
-rwxr-xr-x | shell/hush_test/hush-vars/var_wordsplit_ifs1.tests | 21 |
2 files changed, 37 insertions, 0 deletions
diff --git a/shell/hush_test/hush-vars/var_wordsplit_ifs1.right b/shell/hush_test/hush-vars/var_wordsplit_ifs1.right index efdafc7..cf583d0 100644 --- a/shell/hush_test/hush-vars/var_wordsplit_ifs1.right +++ b/shell/hush_test/hush-vars/var_wordsplit_ifs1.right @@ -22,4 +22,20 @@ Testing: IFS="" "$*" Testing: IFS="" "$@" .abc. .d e. +Testing: !IFS v=$* +v='abc d e' +Testing: !IFS v=$@ +v='abc d e' +Testing: !IFS v="$*" +v='abc d e' +Testing: !IFS v="$@" +v='abc d e' +Testing: IFS="" v=$* +v='abcd e' +Testing: IFS="" v=$@ +v='abcd e' +Testing: IFS="" v="$*" +v='abcd e' +Testing: IFS="" v="$@" +v='abcd e' Finished diff --git a/shell/hush_test/hush-vars/var_wordsplit_ifs1.tests b/shell/hush_test/hush-vars/var_wordsplit_ifs1.tests index 532ab99..a62afc6 100755 --- a/shell/hush_test/hush-vars/var_wordsplit_ifs1.tests +++ b/shell/hush_test/hush-vars/var_wordsplit_ifs1.tests @@ -18,4 +18,25 @@ IFS=""; for a in "$*"; do echo ".$a."; done echo 'Testing: IFS="" "$@"' IFS=""; for a in "$@"; do echo ".$a."; done +echo 'Testing: !IFS v=$*' +unset IFS; v=$*; echo "v='$v'" +echo 'Testing: !IFS v=$@' +unset IFS; v=$@; echo "v='$v'" +echo 'Testing: !IFS v="$*"' +unset IFS; v="$*"; echo "v='$v'" +echo 'Testing: !IFS v="$@"' +unset IFS; v="$@"; echo "v='$v'" + +echo 'Testing: IFS="" v=$*' +IFS=""; v=$*; echo "v='$v'" +echo 'Testing: IFS="" v=$@' +IFS=""; v=$@; echo "v='$v'" +echo 'Testing: IFS="" v="$*"' +IFS=""; v="$*"; echo "v='$v'" +echo 'Testing: IFS="" v="$@"' +IFS=""; v="$@"; echo "v='$v'" + +# Note: in IFS="" v=$@ and IFS="" v="$@" cases, bash produces "abc d e" +# We produce "abcd e" + echo Finished |