zsh-workers
 help / color / mirror / code / Atom feed
* ERR_EXIT and pipelines
@ 2008-10-17 11:42 Marcin Owsiany
  2008-10-17 13:49 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Marcin Owsiany @ 2008-10-17 11:42 UTC (permalink / raw)
  To: zsh-workers

Hello,

I have recently found a problem with _bash_ that is described in the
following thread in bash-bug mailing list:
http://groups.google.com/group/gnu.bash.bug/browse_thread/thread/e37f5c7ddcc55eeb/57474f8d2f8efa59

In short, it's about the fact that either of the following lines make a
"set -e" script abort:
 true | false
 for a in 1; do false; done
but the following does not:
 true | for a in 1; do false; done

I thought that this inconsistency was a bug in bash, but as you can find
out in the thread, it is the first type of statements that behaves
incorrectly, according to bash maintainer's interpretation of SUS.

zshoptions manpage defines 'ERR_EXIT' sematics differently: more like I
would like it to work. It also works consistently in the above examples.

Since I like zsh behavior more (makes it easier to write reliable
scripts), I'm considering switching my program (cruft) to zsh. But
before I do it, can someone please confirm that what is written in the
manpage and how zsh behaves right now is indeed the intended behaviour,
and will not in forseeable future be changed to match bash's behaviour?

regards,
-- 
Marcin Owsiany <marcin@owsiany.pl>              http://marcin.owsiany.pl/
GnuPG: 1024D/60F41216  FE67 DA2D 0ACA FC5E 3F75  D6F6 3A0D 8AA0 60F4 1216
 
"Every program in development at MIT expands until it can read mail."
                                                              -- Unknown


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ERR_EXIT and pipelines
  2008-10-17 11:42 ERR_EXIT and pipelines Marcin Owsiany
@ 2008-10-17 13:49 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2008-10-17 13:49 UTC (permalink / raw)
  To: Marcin Owsiany; +Cc: zsh-workers

Marcin Owsiany wrote:
> I have recently found a problem with _bash_ that is described in the
> following thread in bash-bug mailing list:
> http://groups.google.com/group/gnu.bash.bug/browse_thread/thread/e37f5c7ddcc5
> 5eeb/57474f8d2f8efa59
> 
> In short, it's about the fact that either of the following lines make a
> "set -e" script abort:
>  true | false
>  for a in 1; do false; done
> but the following does not:
>  true | for a in 1; do false; done
> 
> I thought that this inconsistency was a bug in bash, but as you can find
> out in the thread, it is the first type of statements that behaves
> incorrectly, according to bash maintainer's interpretation of SUS.
> 
> zshoptions manpage defines 'ERR_EXIT' sematics differently: more like I
> would like it to work. It also works consistently in the above examples.
> 
> Since I like zsh behavior more (makes it easier to write reliable
> scripts), I'm considering switching my program (cruft) to zsh. But
> before I do it, can someone please confirm that what is written in the
> manpage and how zsh behaves right now is indeed the intended behaviour,
> and will not in forseeable future be changed to match bash's behaviour?

I'm not going to change the existing behaviour in native mode.  I might
conceivably change it when some additional option were set to put into
it some compatibility mode.  Currently no one has asked even for that.

zsh runs the last part of the pipeline in the current shell if it
consists only of shell commands, which is different from some other
shells.  This difference is allowed by the standard, although whether
knock-on differences, like the one you mention, are also allowed is a
different question.  Anyway, the native shell behaviour won't change.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-10-17 13:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-17 11:42 ERR_EXIT and pipelines Marcin Owsiany
2008-10-17 13:49 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).