diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2004-07-29 15:09:51 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2004-07-29 15:09:51 +0000 |
commit | 640bbab78f56c2a51fb3ee1d0f83e3bf0418d8be (patch) | |
tree | 8d78905ddc9bd8e2674bedce6bcdfda10ba6c1da /Src | |
parent | efe2876d927b5d028031a6023b622be44c5d5b8a (diff) | |
download | zsh-640bbab78f56c2a51fb3ee1d0f83e3bf0418d8be.tar.gz zsh-640bbab78f56c2a51fb3ee1d0f83e3bf0418d8be.tar.xz zsh-640bbab78f56c2a51fb3ee1d0f83e3bf0418d8be.zip |
20221: $LINENO in trap '...' DEBUG was wrong.
Diffstat (limited to 'Src')
-rw-r--r-- | Src/exec.c | 6 | ||||
-rw-r--r-- | Src/signals.c | 11 |
2 files changed, 12 insertions, 5 deletions
diff --git a/Src/exec.c b/Src/exec.c index ee0752035..d1c3bb98e 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -787,7 +787,8 @@ execsimple(Estate state) if (errflag) return (lastval = 1); - if (code) + /* In evaluated traps, don't modify the line number. */ + if ((!intrap || trapisfunc) && code) lineno = code - 1; code = wc_code(*state->pc++); @@ -1258,7 +1259,8 @@ execpline2(Estate state, wordcode pcode, if (breaks || retflag) return; - if (WC_PIPE_LINENO(pcode)) + /* In evaluated traps, don't modify the line number. */ + if ((!intrap || trapisfunc) && WC_PIPE_LINENO(pcode)) lineno = WC_PIPE_LINENO(pcode) - 1; if (pline_level == 1) { diff --git a/Src/signals.c b/Src/signals.c index 064feb480..6c6c28159 100644 --- a/Src/signals.c +++ b/Src/signals.c @@ -943,6 +943,11 @@ endtrapscope(void) /**/ int intrap; +/* Is the current trap a function? */ + +/**/ +int trapisfunc; + /**/ void dotrapargs(int sig, int *sigtr, void *sigfn) @@ -1001,19 +1006,19 @@ dotrapargs(int sig, int *sigtr, void *sigfn) zaddlinknode(args, num); trapreturn = -1; /* incremented by doshfunc */ + trapisfunc = isfunc = 1; + sfcontext = SFC_SIGNAL; doshfunc(name, sigfn, args, 0, 1); sfcontext = osc; freelinklist(args, (FreeFunc) NULL); zsfree(name); - isfunc = 1; } else { trapreturn = -2; /* not incremented, used at current level */ + trapisfunc = isfunc = 0; execode(sigfn, 1, 0); - - isfunc = 0; } runhookdef(AFTERTRAPHOOK, NULL); |