From 52bf80a1c9ceda3e118d67b2683cdb3b402a1a18 Mon Sep 17 00:00:00 2001 From: jilles Date: Fri, 16 Oct 2009 16:17:57 +0000 Subject: [PATCH] sh: Show more information about syntax errors in command substitution: the line number where the command substitution started. This applies to both the $() and `` forms but is most useful for `` because the other line number is relative to the enclosed text there. (For older versions, -v can be used as a workaround.) --- bin/sh/parser.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/sh/parser.c b/bin/sh/parser.c index 9e861620e5f7..8dd1e7a72367 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -1308,11 +1308,16 @@ parsebackq: { struct jmploc *const savehandler = handler; int savelen; int saveprompt; + const int bq_startlinno = plinno; if (setjmp(jmploc.loc)) { if (str) ckfree(str); handler = savehandler; + if (exception == EXERROR) { + startlinno = bq_startlinno; + synerror("Error in command substitution"); + } longjmp(handler->loc, 1); } INTOFF;