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>
This commit is contained in:
25
shell/ash_test/ash-vars/var_wordsplit_ifs1.right
Normal file
25
shell/ash_test/ash-vars/var_wordsplit_ifs1.right
Normal file
@@ -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
|
21
shell/ash_test/ash-vars/var_wordsplit_ifs1.tests
Executable file
21
shell/ash_test/ash-vars/var_wordsplit_ifs1.tests
Executable file
@@ -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
|
Reference in New Issue
Block a user