From 088e699c182acf62e96bbdc23e7f44425e256471 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 20 Dec 2009 20:51:20 +0000 Subject: [PATCH] MFC r198173: sh: show more info 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 54a80a715d0..b898d7a3990 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -1310,6 +1310,7 @@ parsebackq: { struct jmploc *const savehandler = handler; int savelen; int saveprompt; + const int bq_startlinno = plinno; savepbq = parsebackquote; if (setjmp(jmploc.loc)) { @@ -1317,6 +1318,10 @@ parsebackq: { ckfree(str); parsebackquote = 0; handler = savehandler; + if (exception == EXERROR) { + startlinno = bq_startlinno; + synerror("Error in command substitution"); + } longjmp(handler->loc, 1); } INTOFF;