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

Re: Possible bug in zsh



On Thu, Jan 01, 2004 at 03:38:56PM -0800, Wayne Davison wrote:
> On Mon, Dec 29, 2003 at 01:21:22AM -0800, Wayne Davison wrote:
> > false; if eval ''; then echo one; fi    [...fails...]
> > true; if eval ''; then echo two; fi     [...succeeds...]
> 
> I'm hoping that someone more familiar with the exec internals will jump
> in here, but in the meantime, here's the change I made back on Monday to
> fix this bug:
> 
> --- Src/builtin.c	13 Nov 2003 14:34:38 -0000	1.109
> +++ Src/builtin.c	29 Dec 2003 09:50:52 -0000
> @@ -4155,6 +4155,7 @@
>  	errflag = 0;
>  	return 1;
>      }
> +    lastval = 0;
>      execode(prog, 1, 0);
>      if (errflag) {
>  	lastval = errflag;
> 
> I'm not sure it's the best fix, though, as it might be better to change
> one of the lower functions down in the execode() calling chain instead
> of changing bin_eval().  It does fix the bug, though.
> 
> ..wayne..

Thanks for the responses Wayne.  I will archive this in case I need it
in the future.  For now, it looks like there are also other
incompatibilities in running the init scripts (well, at least one so
far) that also prevent using zsh as sh in FreeBSD.  So, I think I will put
that idea on hold for now and stick with the native /bin/sh.

I temporarily modified the init script code which got around the eval
problem and discovered that some of the scripts use "set -T" which is not
implemented in zsh.  The FreeBSD sh man page says this about it.

<manual>

-T trapsasync

    When waiting for a child, execute traps immediately.  If this option
    is not set, traps are executed after the child exits, as specified in
    IEEE Std 1003.2 (``POSIX.2'') This nonstandard option is useful for
    putting guarding shells around children that block signals.  The
    surrounding shell may kill the child or it may just return control to
    the tty and leave the child alone, like this:

        sh -T -c "trap 'exit 1' 2 ; some-blocking-program"

</manual>

Regards,
Vincent

-- 
Vincent Stemen
Avoid the VeriSign/Network Solutions domain registration trap!
http://www.InetAddresses.net



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