summaryrefslogtreecommitdiff
path: root/shell/ash_test/ash-vars
diff options
context:
space:
mode:
authorDenys Vlasenko2016-10-01 20:35:10 +0200
committerDenys Vlasenko2016-10-01 20:35:10 +0200
commitc4d4380a0700542796887b2e6dbd41e9a7916997 (patch)
treefd6010b5cc072a098e868dfd9bec105ca9bbabcd /shell/ash_test/ash-vars
parenta2633aa8197a866a7c00406f7eb7e9c9b4554166 (diff)
downloadbusybox-c4d4380a0700542796887b2e6dbd41e9a7916997.zip
busybox-c4d4380a0700542796887b2e6dbd41e9a7916997.tar.gz
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/ash-vars')
-rw-r--r--shell/ash_test/ash-vars/var_wordsplit_ifs1.right25
-rwxr-xr-xshell/ash_test/ash-vars/var_wordsplit_ifs1.tests21
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 0000000..efdafc7
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_wordsplit_ifs1.right
@@ -0,0 +1,25 @@
+Testing: !IFS $*
+.abc.
+.d.
+.e.
+Testing: !IFS $@
+.abc.
+.d.
+.e.
+Testing: !IFS "$*"
+.abc d e.
+Testing: !IFS "$@"
+.abc.
+.d e.
+Testing: IFS="" $*
+.abc.
+.d e.
+Testing: IFS="" $@
+.abc.
+.d e.
+Testing: IFS="" "$*"
+.abcd e.
+Testing: IFS="" "$@"
+.abc.
+.d e.
+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 0000000..532ab99
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_wordsplit_ifs1.tests
@@ -0,0 +1,21 @@
+set -- abc "d e"
+
+echo 'Testing: !IFS $*'
+unset IFS; for a in $*; do echo ".$a."; done
+echo 'Testing: !IFS $@'
+unset IFS; for a in $@; do echo ".$a."; done
+echo 'Testing: !IFS "$*"'
+unset IFS; for a in "$*"; do echo ".$a."; done
+echo 'Testing: !IFS "$@"'
+unset IFS; for a in "$@"; do echo ".$a."; done
+
+echo 'Testing: IFS="" $*'
+IFS=""; for a in $*; do echo ".$a."; done
+echo 'Testing: IFS="" $@'
+IFS=""; for a in $@; do echo ".$a."; done
+echo 'Testing: IFS="" "$*"'
+IFS=""; for a in "$*"; do echo ".$a."; done
+echo 'Testing: IFS="" "$@"'
+IFS=""; for a in "$@"; do echo ".$a."; done
+
+echo Finished