All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jilles Tjoelker <jilles@stack.nl>
To: Harald van Dijk <harald@gigawatt.nl>
Cc: dash@vger.kernel.org, Herbert Xu <herbert@gondor.apana.org.au>,
	jrnieder@gmail.com
Subject: [PATCH] [PARSER] Remove backslash before } in double-quotes in variable
Date: Sun, 21 Nov 2010 14:42:22 +0100	[thread overview]
Message-ID: <20101121134222.GC17293@stack.nl> (raw)
In-Reply-To: <4CE71991.3020108@gigawatt.nl>

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.
---
 src/parser.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/parser.c b/src/parser.c
index be20ff7..25f22fd 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -916,6 +916,9 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs)
 						c != '$' && (
 							c != '"' ||
 							eofmark != NULL
+						) && (
+							c != '}' ||
+							varnest == 0
 						)
 					) {
 						USTPUTC('\\', out);
-- 
1.7.3.2


  parent reply	other threads:[~2010-11-21 13:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-13 16:28 Quoted closing brace in variable default expansion Harald van Dijk
2010-11-13 16:41 ` Jonathan Nieder
2010-11-13 17:29   ` Harald van Dijk
2010-11-19 13:54     ` Herbert Xu
2010-11-20  0:43       ` Harald van Dijk
2010-11-20 20:57         ` Cristian Ionescu-Idbohrn
2010-11-21 13:42         ` Jilles Tjoelker [this message]
2010-11-21 16:35           ` [PATCH] [PARSER] Remove backslash before } in double-quotes in variable Jonathan Nieder
2010-11-23 18:46           ` Harald van Dijk
2011-03-10  8:59           ` Herbert Xu
2011-03-11 18:32             ` Jilles Tjoelker
2010-11-13 17:51   ` Quoted closing brace in variable default expansion Jilles Tjoelker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101121134222.GC17293@stack.nl \
    --to=jilles@stack.nl \
    --cc=dash@vger.kernel.org \
    --cc=harald@gigawatt.nl \
    --cc=herbert@gondor.apana.org.au \
    --cc=jrnieder@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.