From 440da97ed79841b55f0b61e4108a336b61642bff Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 5 Aug 2018 14:29:58 +0200 Subject: ash: expand: Fix ghost fields with unquoted $@/$* Upstream commit: Date: Fri, 23 Mar 2018 18:58:47 +0800 expand: Fix ghost fields with unquoted $@/$* You're right. The proper fix to this is to ensure that nulonly is not set in varvalue for $*. It should only be set for $@ when it's inside double quotes. In fact there is another bug while we're playing with $@/$*. When IFS is set to a non-whitespace character such as :, $* outside quotes won't remove empty fields as it should. This patch fixes both problems. Reported-by: Martijn Dekker Suggested-by: Harald van Dijk Signed-off-by: Herbert Xu function old new delta argstr 1111 1113 +2 evalvar 571 569 -2 varvalue 579 576 -3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 2/-5) Total: -3 bytes Signed-off-by: Denys Vlasenko --- shell/hush_test/hush-vars/var_wordsplit_ifs5.right | 1 + shell/hush_test/hush-vars/var_wordsplit_ifs5.tests | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 shell/hush_test/hush-vars/var_wordsplit_ifs5.right create mode 100755 shell/hush_test/hush-vars/var_wordsplit_ifs5.tests (limited to 'shell/hush_test/hush-vars') diff --git a/shell/hush_test/hush-vars/var_wordsplit_ifs5.right b/shell/hush_test/hush-vars/var_wordsplit_ifs5.right new file mode 100644 index 0000000..46ffcec --- /dev/null +++ b/shell/hush_test/hush-vars/var_wordsplit_ifs5.right @@ -0,0 +1 @@ +Zero:0 diff --git a/shell/hush_test/hush-vars/var_wordsplit_ifs5.tests b/shell/hush_test/hush-vars/var_wordsplit_ifs5.tests new file mode 100755 index 0000000..d382116 --- /dev/null +++ b/shell/hush_test/hush-vars/var_wordsplit_ifs5.tests @@ -0,0 +1,4 @@ +IFS= +set -- +set -- $@ $* +echo Zero:$# -- cgit v1.1