aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell/ash.c6
-rw-r--r--shell/ash_test/ash-quoting/quote_in_varexp1.right2
-rwxr-xr-xshell/ash_test/ash-quoting/quote_in_varexp1.tests2
3 files changed, 8 insertions, 2 deletions
diff --git a/shell/ash.c b/shell/ash.c
index d82eba15f..ed1a4416c 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -12467,10 +12467,12 @@ parsesub: {
pungetc();
}
- if (newsyn == ARISYNTAX && subtype > VSNORMAL)
+ if (newsyn == ARISYNTAX)
newsyn = DQSYNTAX;
- if (newsyn != synstack->syntax) {
+ if ((newsyn != synstack->syntax || synstack->innerdq)
+ && subtype != VSNORMAL
+ ) {
synstack_push(&synstack,
synstack->prev ?: alloca(sizeof(*synstack)),
newsyn);
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:$?