From: Vincent Stemen <vince.lists@hightek.org>
To: zsh-workers@zsh.org
Subject: Re: sh compatibility issue
Date: Tue, 22 Feb 2011 19:08:17 -0600 [thread overview]
Message-ID: <20110223010817.GA36733@quark.hightek.org> (raw)
In-Reply-To: <20110222200259.2aab2dcc@pws-pc.ntlworld.com>
On Tue, Feb 22, 2011 at 08:02:59PM +0000, Peter Stephenson wrote:
> On Sun, 20 Feb 2011 16:39:29 -0500
> Chet Ramey <chet.ramey@case.edu> wrote:
> > On 2/20/11 2:11 PM, Peter Stephenson wrote:
> > >> On a related note, here is another quite insidious sh compatibility
> > >> issue:
> > >> sh -c 'exec </nonexistent/a; echo wrong'
> > >> This should not print "wrong" because exec is a special builtin and
> > >> redirection errors on special builtins are fatal. Most shells get this
> > >> right nowadays (bash only in POSIX mode) but zsh gets it wrong. Even
> > >> set -o posixbuiltins
> > >> does not help.
> > >
> > > I think it does need to be fatal, but not because it's a special builtin
> > > --- it looks like that's only a "may" rather than a "shall" --- but
> > > because there is a rule for exec:
> >
> > No, that's actually a `shall'. Section 2.8.1, special builtin, redirection
> > error.
>
> Thanks, didn't follow the link... it looks like the "may" here means
> "may be required to". The table shows essentially all errors for
> special builtins are fatal.
>
> I didn't actually test for a special builtin in the previous patch,
> either. Here's a revised patch with more careful tests.
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.
$ /usr/bin/zsh -c 'exec </nonexistent/a; echo wrong'
zsh:1: no such file or directory: /nonexistent/a
wrong
$ /usr/bin/zsh -c 'emulate sh; exec </nonexistent/a; echo wrong'
zsh:1: no such file or directory: /nonexistent/a
next prev parent reply other threads:[~2011-02-23 1:08 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 [this message]
2011-02-23 1:51 ` Bart Schaefer
2011-02-23 2:30 ` Vincent Stemen
2011-02-23 9:25 ` Peter Stephenson
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=20110223010817.GA36733@quark.hightek.org \
--to=vince.lists@hightek.org \
--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).