1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
From e2df6dcefedb2cc6b1d0559154a871587ed2748d Mon Sep 17 00:00:00 2001
From: Jilles Tjoelker <jilles@stack.nl>
Date: Sun, 21 Nov 2010 14:42:22 +0100
Subject: [PATCH 2/6] [PARSER] Remove backslash before } in double-quotes in
variable
The backslash prevents the closing brace from terminating the
substitution, therefore it should be removed.
FreeBSD sh test expansion/plus-minus2.0 starts working, no other tests
are affected.
Example:
printf "%s\n" ${$+\}} ${$+"\}"} "${$+\}}"
should print } three times, without backslashes.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
src/parser.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/parser.c b/src/parser.c
index 572cbcd..33bb77d 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -926,6 +926,9 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs)
c != '$' && (
c != '"' ||
eofmark != NULL
+ ) && (
+ c != '}' ||
+ varnest == 0
)
) {
USTPUTC('\\', out);
--
2.1.0
|