zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: sh compatibility issue
Date: Wed, 23 Feb 2011 09:25:06 +0000	[thread overview]
Message-ID: <20110223092506.200da440@pws-pc.ntlworld.com> (raw)
In-Reply-To: <AANLkTinqaQorhmAU9HDf2smS-K1BcGjg4QwhfNLpctQo@mail.gmail.com>

On Tue, 22 Feb 2011 17:51:18 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Tuesday, February 22, 2011, Vincent Stemen <vince.lists@hightek.org> wrote:
> >
> > I don't think it worked.  With this patch added, the bahaviour did not
> > change from the previous patch.  Fatal error in sh mode not not in zsh
> > mode.
> 
> That's intentional.  Zsh is not a POSIX shell unless you tell it to
> be, so in zsh mode it behaves the way zsh always has.
> 
> As I understand it, the patch should change the behavior of other
> special builtins (in addition to exec), but only when POSIXBUILTINS is
> set.

Bart's right, sorry, I wasn't clear enough.  Yes, this is the
long-standing policy.

If we'd been designing zsh from scratch now, there would be no point in
all these small areas where it's a bit different from POSIX by accident
rather than design.  As it is, given the shell's manifold differences in
native mode, there's no point squeezing extra POSIX-compliance out of
native mode at the expense of backward compatibility.

By the way, one small tweak which should be rarely visible: now I've
upped the ante, there may be cases where we're forked at the point we
need to exit.

Index: Src/exec.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.190
diff -p -u -r1.190 exec.c
--- Src/exec.c	22 Feb 2011 20:09:20 -0000	1.190
+++ Src/exec.c	23 Feb 2011 09:21:32 -0000
@@ -3306,8 +3306,10 @@ execcmd(Estate state, int input, int out
 	 */
 	if (redir_err || errflag) {
 	    if (!isset(INTERACTIVE)) {
-		/* We've already _exit'ed if forked */
-		exit(1);
+		if (forked)
+		    _exit(1);
+		else
+		    exit(1);
 	    }
 	    errflag = 1;
 	}
-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


  parent reply	other threads:[~2011-02-23  9:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-18  3:55 Vincent Stemen
2011-02-18 10:30 ` Peter Stephenson
2011-02-18 22:45   ` Vincent Stemen
2011-02-19 23:05   ` Jilles Tjoelker
2011-02-20  0:41     ` Vincent Stemen
2011-02-20 19:11     ` Peter Stephenson
2011-02-20 20:17       ` Peter Stephenson
2011-02-20 21:12         ` Vincent Stemen
     [not found]       ` <4D618A11.3050406@case.edu>
2011-02-22 20:02         ` Peter Stephenson
2011-02-23  1:08           ` Vincent Stemen
2011-02-23  1:51             ` Bart Schaefer
2011-02-23  2:30               ` Vincent Stemen
2011-02-23  9:25               ` Peter Stephenson [this message]
2011-03-04 13:36           ` Jilles Tjoelker
2011-03-06 20:26             ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110223092506.200da440@pws-pc.ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).