diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-10-01 20:35:10 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-10-01 20:35:10 +0200 |
commit | c4d4380a0700542796887b2e6dbd41e9a7916997 (patch) | |
tree | fd6010b5cc072a098e868dfd9bec105ca9bbabcd /shell/ash_test | |
parent | a2633aa8197a866a7c00406f7eb7e9c9b4554166 (diff) | |
download | busybox-w32-c4d4380a0700542796887b2e6dbd41e9a7916997.tar.gz busybox-w32-c4d4380a0700542796887b2e6dbd41e9a7916997.tar.bz2 busybox-w32-c4d4380a0700542796887b2e6dbd41e9a7916997.zip |
ash: [EXPAND] Split unquoted $@/$* correctly when IFS is set but empty
Upstream commit:
Date: Wed, 8 Oct 2014 15:24:23 +0800
[EXPAND] Split unquoted $@/$* correctly when IFS is set but empty
Currently we do not field-split $@/$* when it isn't quoted and IFS
is set but empty. This is obviously wrong. This patch fixes this.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash_test')
-rw-r--r-- | shell/ash_test/ash-vars/var_wordsplit_ifs1.right | 25 | ||||
-rwxr-xr-x | shell/ash_test/ash-vars/var_wordsplit_ifs1.tests | 21 |
2 files changed, 46 insertions, 0 deletions
diff --git a/shell/ash_test/ash-vars/var_wordsplit_ifs1.right b/shell/ash_test/ash-vars/var_wordsplit_ifs1.right new file mode 100644 index 000000000..efdafc70f --- /dev/null +++ b/shell/ash_test/ash-vars/var_wordsplit_ifs1.right | |||
@@ -0,0 +1,25 @@ | |||
1 | Testing: !IFS $* | ||
2 | .abc. | ||
3 | .d. | ||
4 | .e. | ||
5 | Testing: !IFS $@ | ||
6 | .abc. | ||
7 | .d. | ||
8 | .e. | ||
9 | Testing: !IFS "$*" | ||
10 | .abc d e. | ||
11 | Testing: !IFS "$@" | ||
12 | .abc. | ||
13 | .d e. | ||
14 | Testing: IFS="" $* | ||
15 | .abc. | ||
16 | .d e. | ||
17 | Testing: IFS="" $@ | ||
18 | .abc. | ||
19 | .d e. | ||
20 | Testing: IFS="" "$*" | ||
21 | .abcd e. | ||
22 | Testing: IFS="" "$@" | ||
23 | .abc. | ||
24 | .d e. | ||
25 | Finished | ||
diff --git a/shell/ash_test/ash-vars/var_wordsplit_ifs1.tests b/shell/ash_test/ash-vars/var_wordsplit_ifs1.tests new file mode 100755 index 000000000..532ab992e --- /dev/null +++ b/shell/ash_test/ash-vars/var_wordsplit_ifs1.tests | |||
@@ -0,0 +1,21 @@ | |||
1 | set -- abc "d e" | ||
2 | |||
3 | echo 'Testing: !IFS $*' | ||
4 | unset IFS; for a in $*; do echo ".$a."; done | ||
5 | echo 'Testing: !IFS $@' | ||
6 | unset IFS; for a in $@; do echo ".$a."; done | ||
7 | echo 'Testing: !IFS "$*"' | ||
8 | unset IFS; for a in "$*"; do echo ".$a."; done | ||
9 | echo 'Testing: !IFS "$@"' | ||
10 | unset IFS; for a in "$@"; do echo ".$a."; done | ||
11 | |||
12 | echo 'Testing: IFS="" $*' | ||
13 | IFS=""; for a in $*; do echo ".$a."; done | ||
14 | echo 'Testing: IFS="" $@' | ||
15 | IFS=""; for a in $@; do echo ".$a."; done | ||
16 | echo 'Testing: IFS="" "$*"' | ||
17 | IFS=""; for a in "$*"; do echo ".$a."; done | ||
18 | echo 'Testing: IFS="" "$@"' | ||
19 | IFS=""; for a in "$@"; do echo ".$a."; done | ||
20 | |||
21 | echo Finished | ||