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

Re: PATCH: zsh-4.2.1: unset does not follow spec



On Thu, 23 Sep 2004, Oliver Kiddle wrote:

> The specification looks fairly clear to me (zsh is wrong)

On Thu, 23 Sep 2004, Geoff Clare wrote:
> 
> I would say that a non-zero exit for "unset" is definitely an error, but 
> the standard is unclear as to whether "unset" is required to treat an 
> attempt to unset a variable that was not previously set as an ordinary 
> error (as opposed to a "utility syntax error", which is definitely not 
> allowed).
> 
> -- 
> Geoff Clare, opengroup.org

I don't really have a strong opinion either way (I can't remember EVER
testing the exit status of "unset" but I suppose it could affect the
shell in the case of "setopt errexit"), but I don't think it's as cut
and dried as it should be.

(Back to Oliver)
On Thu, 23 Sep 2004, Oliver Kiddle wrote:
> 
> > (Is it time for "emulate posix"?)
> 
> Possibly.
> 
> How would it differ from "emulate sh"?

At the moment, it might not.  If, however, we were to discover a case 
where POSIX specifies behavior that differs from historic /bin/sh 
behavior, we might want a plain way to get either one.

Also, although "emulate" has so far been limited to setting options, it 
might be worth considering whether it should also modify the environment, 
e.g., exporting POSIXLY_CORRECT or UNIX95 or whatever.  However, what it 
exported would depend on compile-time configuration, which although it 
could be OS-specific could not be architecture-specific, making trouble
on binary-compatible platforms that use different techniques to achieve
POSIX conformance.  So, I'm not sure.



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