Re: trap bug in recent versions of dash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 16, 2010 at 01:52:56PM +0200, Guido Berhoerster wrote:
> * Jilles Tjoelker <jilles@xxxxxxxx> [2010-08-15 22:05]:
> > On Wed, Aug 11, 2010 at 10:06:16AM +0200, Guido Berhoerster wrote:
> > > with the latest git version of dash trap actions are not
> > > evaluated in the context of a function.

> > I think dotrap()'s return value should be removed or at least ignored.
> > An "evalskip" (break/continue/return-function/return-file) should never
> > lead to an immediate exit. I'm not supplying a patch because I am not
> > entirely sure about the side effects this could have.

> OK, I'm not familiar with the source but it'd be nice to have it
> fixed before the next release since it is a regression breaking
> scripts.

If you want to try something, here is a patch. I have verified that the
only change to the results of FreeBSD sh's testsuite is that the test
builtins/break2.0 starts working (there are still 51 other broken
tests). There is no change in output from the posh testsuite (run with
  -C sh,posix,no-typeset,no-arrays,no-coprocs,no-herestrings,no-history
).

diff --git a/src/eval.c b/src/eval.c
index d5e5c95..e484bec 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -307,9 +307,9 @@ setstatus:
 		break;
 	}
 out:
-	if ((checkexit & exitstatus) ||
-	    (pendingsigs && dotrap()) ||
-	    (flags & EV_EXIT))
+	if (pendingsigs)
+		dotrap();
+	if ((flags & EV_EXIT) || (checkexit & exitstatus))
 		exraise(EXEXIT);
 }

-- 
Jilles Tjoelker
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux