Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Dec 2009 20:51:20 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r200760 - stable/8/bin/sh
Message-ID:  <200912202051.nBKKpKEv074655@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sun Dec 20 20:51:20 2009
New Revision: 200760
URL: http://svn.freebsd.org/changeset/base/200760

Log:
  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.)

Modified:
  stable/8/bin/sh/parser.c
Directory Properties:
  stable/8/bin/sh/   (props changed)

Modified: stable/8/bin/sh/parser.c
==============================================================================
--- stable/8/bin/sh/parser.c	Sun Dec 20 19:45:46 2009	(r200759)
+++ stable/8/bin/sh/parser.c	Sun Dec 20 20:51:20 2009	(r200760)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912202051.nBKKpKEv074655>