On Sun, Feb 27, 2005 at 08:18:09PM +0000, Gerrit Pape wrote: > > Hi Herbert, this does fine with the subshell. Unfortunately I stumbled > across another problem with these patches as well as with the previous > single one. After the EXEVAL exception is raised in the or list, dash > stops processing the script after a newline:
Thanks for catching this. Since trapping exceptions is causing all these problems, let's use evalskip instead. Please give this one a go and see if you can break it again :) Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
===== error.h 1.26 vs edited ===== --- 1.26/src/error.h 2005-02-25 21:15:30 +11:00 +++ edited/error.h 2005-02-28 20:59:58 +11:00 @@ -75,7 +75,6 @@ #define EXEXEC 3 /* command execution failed */ #define EXEXIT 4 /* exit the shell */ #define EXSIG 5 /* trapped signal in wait(1) */ -#define EXEVAL 6 /* exit the shell due to set -e */ /* ===== eval.c 1.101 vs edited ===== --- 1.101/src/eval.c 2005-02-28 20:58:38 +11:00 +++ edited/eval.c 2005-02-28 20:59:59 +11:00 @@ -325,8 +325,8 @@ dotrap(); if (flags & EV_EXIT) exraise(EXEXIT); - if (checkexit & exitstatus) - exraise(EXEVAL); + if ((checkexit & exitstatus) && evalskip != SKIPFILE) + evalskip = SKIPEVAL; } @@ -711,14 +711,12 @@ int spclbltin; int execcmd; int status; - int oldlvl; char **nargv; /* First expand the arguments. */ TRACE(("evalcommand(0x%lx, %d) called\n", (long)cmd, flags)); setstackmark(&smark); back_exitstatus = 0; - oldlvl = shlvl; cmdentry.cmdtype = CMDBUILTIN; cmdentry.u.cmd = &bltin; @@ -874,12 +872,6 @@ i = exception; if (i == EXEXIT) goto raise; - if (i == EXEVAL) { - if (oldlvl == shlvl) - goto trap; - else - goto raise; - } status = 2; j = 0; @@ -895,7 +887,6 @@ raise: longjmp(handler->loc, 1); } -trap: FORCEINTON; } break; @@ -941,6 +932,8 @@ commandname = savecmdname; exsig = 0; handler = savehandler; + if (evalskip == SKIPEVAL) + evalskip = 0; return i; } ===== eval.h 1.8 vs edited ===== --- 1.8/src/eval.h 2003-10-29 21:22:45 +11:00 +++ edited/eval.h 2005-02-28 20:59:59 +11:00 @@ -66,3 +66,4 @@ #define SKIPCONT 2 #define SKIPFUNC 3 #define SKIPFILE 4 +#define SKIPEVAL 5 ===== main.c 1.35 vs edited ===== --- 1.35/src/main.c 2005-02-25 21:15:30 +11:00 +++ edited/main.c 2005-02-28 21:00:09 +11:00 @@ -139,7 +139,6 @@ break; case EXEXIT: - case EXEVAL: state = 0; /* fall through */ default: