From f50e14632f7be56da7a38937c887f77812803f70 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 2 Apr 2018 21:00:59 +0200 Subject: ash: parser: Fix parameter expansion inside inner double quotes Upstream email: parser: Fix parameter expansion inside inner double quotes The parsing of parameter expansion inside inner double quotes breaks because we never look for ENDVAR while innerdq is true. echo "${x#"${x+''}"''} This patch fixes it by pushing the syntax stack if innerdq is true and we enter a new parameter expansion. This patch also fixes a corner case where a bad substitution error occurs within arithmetic expansion. Reported-by: Denys Vlasenko Fixes: ab1cecb40478 (" parser: Add syntax stack for recursive...") Signed-off-by: Herbert Xu function old new delta readtoken1 2880 2898 +18 Signed-off-by: Denys Vlasenko --- shell/ash_test/ash-quoting/quote_in_varexp1.right | 2 ++ shell/ash_test/ash-quoting/quote_in_varexp1.tests | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 shell/ash_test/ash-quoting/quote_in_varexp1.right create mode 100755 shell/ash_test/ash-quoting/quote_in_varexp1.tests (limited to 'shell/ash_test') diff --git a/shell/ash_test/ash-quoting/quote_in_varexp1.right b/shell/ash_test/ash-quoting/quote_in_varexp1.right new file mode 100644 index 000000000..99a0aea7c --- /dev/null +++ b/shell/ash_test/ash-quoting/quote_in_varexp1.right @@ -0,0 +1,2 @@ +'' +Ok:0 diff --git a/shell/ash_test/ash-quoting/quote_in_varexp1.tests b/shell/ash_test/ash-quoting/quote_in_varexp1.tests new file mode 100755 index 000000000..1b97b0556 --- /dev/null +++ b/shell/ash_test/ash-quoting/quote_in_varexp1.tests @@ -0,0 +1,2 @@ +x="''''"; echo "${x#"${x+''}"''}" +echo Ok:$? -- cgit v1.2.3