Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Jun 2017 20:52:56 +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: r319575 - in head/bin/sh: . tests/errors
Message-ID:  <201706042052.v54KquQ1009352@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sun Jun  4 20:52:55 2017
New Revision: 319575
URL: https://svnweb.freebsd.org/changeset/base/319575

Log:
  sh: Fix INTOFF leak when a redirection on a compound command fails.
  
  Reported by:	bdrewery

Added:
  head/bin/sh/tests/errors/redirection-error8.0   (contents, props changed)
Modified:
  head/bin/sh/eval.c
  head/bin/sh/tests/errors/Makefile

Modified: head/bin/sh/eval.c
==============================================================================
--- head/bin/sh/eval.c	Sun Jun  4 19:58:14 2017	(r319574)
+++ head/bin/sh/eval.c	Sun Jun  4 20:52:55 2017	(r319575)
@@ -470,6 +470,7 @@ evalredir(union node *n, int flags)
 		if (e == EXERROR || e == EXEXEC) {
 			if (in_redirect) {
 				exitstatus = 2;
+				FORCEINTON;
 				return;
 			}
 		}

Modified: head/bin/sh/tests/errors/Makefile
==============================================================================
--- head/bin/sh/tests/errors/Makefile	Sun Jun  4 19:58:14 2017	(r319574)
+++ head/bin/sh/tests/errors/Makefile	Sun Jun  4 20:52:55 2017	(r319575)
@@ -29,6 +29,7 @@ ${PACKAGE}FILES+=		redirection-error4.0
 ${PACKAGE}FILES+=		redirection-error5.0
 ${PACKAGE}FILES+=		redirection-error6.0
 ${PACKAGE}FILES+=		redirection-error7.0
+${PACKAGE}FILES+=		redirection-error8.0
 ${PACKAGE}FILES+=		write-error1.0
 
 .include <bsd.test.mk>

Added: head/bin/sh/tests/errors/redirection-error8.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/sh/tests/errors/redirection-error8.0	Sun Jun  4 20:52:55 2017	(r319575)
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+$SH -c '{ { :; } </var/empty/x; } 2>/dev/null || kill -INT $$; echo continued'
+r=$?
+[ "$r" -gt 128 ] && [ "$(kill -l "$r")" = INT ]



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