From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: Failure of "typeset" and exit status
Date: Wed, 13 May 2015 09:39:45 +0100 [thread overview]
Message-ID: <20150513093945.749366aa@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <150512215919.ZM13985@torch.brasslantern.com>
On Tue, 12 May 2015 21:59:19 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> Now, the other question is, why is it a fatal error to attempt to change
> a variable that is explicitly read-only, but only a warning to attempt
> to change UID, GID, etc. when you do not have permission to do so?
So you're worried about this
% (){ local UID && print Still going; }
(anon): failed to change user ID: operation not permitted
Still going
and the other typeset stuff isn't relevant here.
As far as the *shell* is concerned, you *do* have permission to change
it. It just happens to be attached to a system call that failed. The
UID was succesfully made local, and printing it successfully reflects
your current UID.
I don't really have any feel for how to treat failures of this kind.
Here's one possibility: in that case, there's no explicit set to UID so
maybe we should make it local and leave it alone --- I'm not sure how to
detect a case like this, though. Then if you explicitly assign to it
(in our out of typeset) and *that* fails, return status 1. Whether this
is a hard error is really up to convenience, since there's no obvious
prior art: is it more useful forcing people to use a subshell to test
for the assignment failure to ensure attempts to set UID are picked up
safely, or to require them to test the command status?
pws
next prev parent reply other threads:[~2015-05-13 8:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-12 2:43 Bart Schaefer
2015-05-12 8:42 ` Peter Stephenson
2015-05-12 9:12 ` Peter Stephenson
2015-05-13 4:59 ` Bart Schaefer
2015-05-13 8:39 ` Peter Stephenson [this message]
2015-05-13 15:48 ` Bart Schaefer
2015-05-13 16:38 ` Peter Stephenson
2015-05-13 17:50 ` Bart Schaefer
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=20150513093945.749366aa@pwslap01u.europe.root.pri \
--to=p.stephenson@samsung.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).