Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Oct 2009 16:17:57 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r198173 - head/bin/sh
Message-ID:  <200910161617.n9GGHvpt008234@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Fri Oct 16 16:17:57 2009
New Revision: 198173
URL: http://svn.freebsd.org/changeset/base/198173

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

Modified:
  head/bin/sh/parser.c

Modified: head/bin/sh/parser.c
==============================================================================
--- head/bin/sh/parser.c	Fri Oct 16 12:42:02 2009	(r198172)
+++ head/bin/sh/parser.c	Fri Oct 16 16:17:57 2009	(r198173)
@@ -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;



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