zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: [PATCH] typeset: set $? on incidental error
Date: Fri, 15 Jan 2016 15:49:44 +0000	[thread overview]
Message-ID: <20160115154944.716a03da@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <5699082D.4040105@gmx.com>

On Fri, 15 Jan 2016 09:54:37 -0500
Eric Cook <llua@gmx.com> wrote:
> But typeset should exit > 0 when it does fail to assign a parameter.

This looks about the minimal fix for this.

This is already a hard error, so will cause other stuff later in the
command to fail, however the error wasn't propagated properly within the
command handler.

pws

diff --git a/Src/builtin.c b/Src/builtin.c
index e1a7990..dd20f9e 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2213,6 +2213,8 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
 				 mkarray(NULL), 0)))
 		return NULL;
 	}
+	if (errflag)
+	    return NULL;
 	pm->node.flags |= (on & PM_READONLY);
 	if (OPT_ISSET(ops,'p'))
 	    paramtab->printnode(&pm->node, PRINT_TYPESET);
diff --git a/Test/B02typeset.ztst b/Test/B02typeset.ztst
index 681fe73..d6d2421 100644
--- a/Test/B02typeset.ztst
+++ b/Test/B02typeset.ztst
@@ -706,3 +706,8 @@
 >typeset -a array=( '' two '' four )
 >typeset -a array=( one '' three )
 >no really nothing here
+
+  readonly isreadonly=yes
+  typeset isreadonly=still
+1:typeset returns status 1 if setting readonly variable
+?(eval):2: read-only variable: isreadonly


  reply	other threads:[~2016-01-15 15:49 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-14  0:13 Daniel Shahaf
2016-01-14  4:58 ` Bart Schaefer
2016-01-14  5:24 ` Eric Cook
2016-01-15  6:26   ` Daniel Shahaf
2016-01-15 14:46     ` Mikael Magnusson
2016-01-15 14:54       ` Eric Cook
2016-01-15 15:49         ` Peter Stephenson [this message]
     [not found]       ` <20160118022557.GE3979@tarsus.local2>
2016-01-18  4:38         ` Mikael Magnusson
2016-01-18 13:33           ` Mikael Magnusson
2016-01-20  7:47           ` Daniel Shahaf
2016-01-20 15:00             ` Eric Cook
2016-01-23 23:53               ` Daniel Shahaf
2016-01-24  3:32                 ` Eric Cook
2016-01-26 22:50                   ` Daniel Shahaf
2016-01-27  4:15                     ` Error status of "repeat" (was Re: [PATCH] typeset: set $? on incidental error) Bart Schaefer
2016-01-27  4:38                       ` Bart Schaefer
2016-01-27  9:52                       ` Peter Stephenson
2016-01-29  9:18                         ` Daniel Shahaf
2016-01-29  9:29                           ` Peter Stephenson
2016-01-29 10:25                             ` Daniel Shahaf
2016-01-27  4:17                     ` [PATCH] typeset: set $? on incidental error Bart Schaefer
2016-01-29  9:18                       ` Daniel Shahaf
2016-01-30  7:46                         ` typeset docs flow " Daniel Shahaf
2016-01-30 19:47                           ` Bart Schaefer
2016-01-31  0:49                             ` Jun T.
2016-01-31 17:03                               ` Bart Schaefer
2016-02-01  3:23                                 ` Jun T.
2016-02-01  5:41                                   ` Bart Schaefer
2016-01-21 14:22             ` Vincent Lefevre

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=20160115154944.716a03da@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).