ash: [EXPAND] Do not split quoted VSLENGTH and VSTRIM
Upstream patch: Date: Wed, 8 Oct 2014 15:42:08 +0800 [EXPAND] Do not split quoted VSLENGTH and VSTRIM Currently VSLENGTH and VSTRIM* are field-split even within quotes. This is obviously wrong. This patch fixes that. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
3
shell/ash_test/ash-vars/var_wordsplit_ifs2.right
Normal file
3
shell/ash_test/ash-vars/var_wordsplit_ifs2.right
Normal file
@ -0,0 +1,3 @@
|
||||
Unquoted:<1>
|
||||
Unquoted:<3>
|
||||
Quoted:<123>
|
13
shell/ash_test/ash-vars/var_wordsplit_ifs2.tests
Executable file
13
shell/ash_test/ash-vars/var_wordsplit_ifs2.tests
Executable file
@ -0,0 +1,13 @@
|
||||
# 123 chars long
|
||||
a="\
|
||||
01234567890123456789\
|
||||
01234567890123456789\
|
||||
01234567890123456789\
|
||||
01234567890123456789\
|
||||
01234567890123456789\
|
||||
0123456789\
|
||||
0123456789\
|
||||
012"
|
||||
|
||||
IFS=2; for v in ${#a}; do echo Unquoted:"<$v>"; done
|
||||
IFS=2; for v in "${#a}"; do echo Quoted:"<$v>"; done
|
12
shell/ash_test/ash-vars/var_wordsplit_ifs3.right
Normal file
12
shell/ash_test/ash-vars/var_wordsplit_ifs3.right
Normal file
@ -0,0 +1,12 @@
|
||||
Unquoted%:<q>
|
||||
Unquoted%:<w>
|
||||
Unquoted%:<e>
|
||||
Unquoted%:<r>
|
||||
Unquoted%:<t>
|
||||
Unquoted#:<w>
|
||||
Unquoted#:<e>
|
||||
Unquoted#:<r>
|
||||
Unquoted#:<t>
|
||||
Unquoted#:<y>
|
||||
Quoted%:<q w e r t >
|
||||
Quoted#:< w e r t y>
|
5
shell/ash_test/ash-vars/var_wordsplit_ifs3.tests
Executable file
5
shell/ash_test/ash-vars/var_wordsplit_ifs3.tests
Executable file
@ -0,0 +1,5 @@
|
||||
a="q w e r t y"
|
||||
for v in ${a%y}; do echo Unquoted%:"<$v>"; done
|
||||
for v in ${a#q}; do echo Unquoted#:"<$v>"; done
|
||||
for v in "${a%y}"; do echo Quoted%:"<$v>"; done
|
||||
for v in "${a#q}"; do echo Quoted#:"<$v>"; done
|
Reference in New Issue
Block a user