summaryrefslogtreecommitdiff
path: root/shell/ash_test/ash-quoting/negative_arith.tests
diff options
context:
space:
mode:
authorDenys Vlasenko2020-02-21 16:30:44 +0100
committerDenys Vlasenko2020-02-21 16:30:44 +0100
commit45dd87aac05ddf8bbfb110fde85ef875f3adfb65 (patch)
tree2d18a0cc2abd0e15f4163f5dc1ce928739b8097d /shell/ash_test/ash-quoting/negative_arith.tests
parentda2e46dff6576c29fa1d379c943bb7943aa6e7ce (diff)
downloadbusybox-45dd87aac05ddf8bbfb110fde85ef875f3adfb65.zip
busybox-45dd87aac05ddf8bbfb110fde85ef875f3adfb65.tar.gz
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>
Diffstat (limited to 'shell/ash_test/ash-quoting/negative_arith.tests')
-rwxr-xr-xshell/ash_test/ash-quoting/negative_arith.tests8
1 files changed, 8 insertions, 0 deletions
diff --git a/shell/ash_test/ash-quoting/negative_arith.tests b/shell/ash_test/ash-quoting/negative_arith.tests
new file mode 100755
index 0000000..8e47ca1
--- /dev/null
+++ b/shell/ash_test/ash-quoting/negative_arith.tests
@@ -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