From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17513 invoked by alias); 7 Jan 2011 10:01:14 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28590 Received: (qmail 11545 invoked from network); 7 Jan 2011 10:01:09 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) X-Authentication-Warning: pwslap01u.europe.root.pri: pws owned process doing -bs To: zsh-workers@zsh.org (Zsh hackers list) Subject: PATCH: return status from read X-Mailer: MH-E 8.2; nmh 1.3; GNU Emacs 23.2.1 Date: Fri, 07 Jan 2011 10:00:49 +0000 Message-ID: <9843.1294394449@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 07 Jan 2011 10:00:55.0531 (UTC) FILETIME=[C674ABB0:01CBAE51] Content-Type: text/plain MIME-Version: 1.0 X-Scanned-By: MailControl A_10_80_00 (www.mailcontrol.com) on 10.68.0.132 Checking up on something reported on the Austin group list, I found that the read builtin doesn't return a non-zero status when there's an error assigning a parameter, even though the error flag is correctly set, which is plain inconsistent. You could argue that the builtin handler should turn a status 0 into a 1 if errflag is set on return from the builtin, but that's a bit murky. Index: Src/builtin.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v retrieving revision 1.245 diff -p -u -r1.245 builtin.c --- Src/builtin.c 15 Oct 2010 18:56:17 -0000 1.245 +++ Src/builtin.c 7 Jan 2011 09:55:29 -0000 @@ -5710,7 +5710,7 @@ bin_read(char *name, char **args, Option } return 1; } - return 0; + return errflag; } /**/ Index: Test/B04read.ztst =================================================================== RCS file: /cvsroot/zsh/zsh/Test/B04read.ztst,v retrieving revision 1.4 diff -p -u -r1.4 B04read.ztst --- Test/B04read.ztst 24 Jul 2009 18:35:53 -0000 1.4 +++ Test/B04read.ztst 7 Jan 2011 09:55:29 -0000 @@ -88,3 +88,8 @@ print ${#line} 0:read with trailing metafied characters >24 + + (typeset -r foo + read foo) << Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom