ash: expand: Ensure result is escaped in cvtnum
Upstream commit: Date: Fri, 1 Jun 2018 18:25:29 +0800 expand: Ensure result is escaped in cvtnum The minus sign generated from arithmetic expansion is currently unquoted which causes anomalies when the result is used in where the quoting matters. This patch fixes it by explicitly calling memtodest on the result in cvtnum. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
2
shell/ash_test/ash-quoting/negative_arith.right
Normal file
2
shell/ash_test/ash-quoting/negative_arith.right
Normal file
@ -0,0 +1,2 @@
|
||||
tempfile0.tmp tempfile9.tmp
|
||||
tempfile0.tmp tempfile1.tmp tempfile9.tmp
|
8
shell/ash_test/ash-quoting/negative_arith.tests
Executable file
8
shell/ash_test/ash-quoting/negative_arith.tests
Executable file
@ -0,0 +1,8 @@
|
||||
>tempfile0.tmp
|
||||
>tempfile1.tmp
|
||||
>tempfile9.tmp
|
||||
# The [...] is interpreted as: "any of the chars 0, -, and 9"
|
||||
echo tempfile[0"$((-9))"].tmp
|
||||
# The [...] is [0-9], interpreted as: "any digit"
|
||||
echo tempfile[0$((-9))].tmp
|
||||
rm tempfile?.tmp
|
Reference in New Issue
Block a user