Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Zsh does not follow POSIX when return is called during the action of a trap



On Wed, 12 Mar 2014 09:52:10 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Mar 12,  8:36am, Eduardo A. Bustamante Lopez wrote:
> }
> } Hi! I first reported this bug to bug-bash, but since it also applies
> } to zsh, I wanted you to know about it.
> 
> Have you tried this with the POSIX_TRAPS option set?
> 
> Zsh does not in general conform to POSIX at all unless you run it with
> the appropriate compatibility settings.

I was going to mention that.  I think it still needs some work --- which
I know how to do in this case.  N.B. you can test this with the line

[ x$ZSH_VERSION != x ] && emulate sh

at the top of the "code" variable.

However, I'm trying to work out what happens with the case

|  trap '(exit BEFORE-RETURN); return EXPLICIT-RETURN-VALUE' SIGNAL
|
|  fn() {
|    (exit BEFORE-ACTION); -block here waiting for signal-
|  }

Should this exit with EXPLICIT-RETURN_VALUE or BEFORE-ACTION?  The
latter is easier to implement but my guess (without ploughing through
the standard) is EXPLICIT-RETURN-VALUE is right here.

pws



Messages sorted by: Reverse Date, Date, Thread, Author