From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20370 invoked from network); 13 Feb 2007 17:28:59 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.7 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 13 Feb 2007 17:28:59 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 88773 invoked from network); 13 Feb 2007 17:28:54 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 13 Feb 2007 17:28:54 -0000 Received: (qmail 27888 invoked by alias); 13 Feb 2007 17:28:51 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23170 Received: (qmail 27879 invoked from network); 13 Feb 2007 17:28:50 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 13 Feb 2007 17:28:50 -0000 Received: (qmail 88387 invoked from network); 13 Feb 2007 17:28:50 -0000 Received: from cluster-c.mailcontrol.com (168.143.177.190) by a.mx.sunsite.dk with SMTP; 13 Feb 2007 17:28:43 -0000 Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly13c.srv.mailcontrol.com (MailControl) with ESMTP id l1DHSbHF022482 for ; Tue, 13 Feb 2007 17:28:38 GMT Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.1830); Tue, 13 Feb 2007 17:28:37 +0000 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.13.8/8.13.4) with ESMTP id l1DHSVgm008433 for ; Tue, 13 Feb 2007 17:28:31 GMT Received: from csr.com (pws@localhost) by news01.csr.com (8.13.8/8.13.8/Submit) with ESMTP id l1DHSVb0008430 for ; Tue, 13 Feb 2007 17:28:31 GMT Message-Id: <200702131728.l1DHSVb0008430@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: Zsh hackers list Subject: Re: echo > * and EMFILE In-reply-to: <070213091133.ZM4614@torch.brasslantern.com> References: <20070212223239.GA4812@sc.homeunix.net> <200702131053.l1DArKoK003124@news01.csr.com> <070213091133.ZM4614@torch.brasslantern.com> Comments: In-reply-to Bart Schaefer message dated "Tue, 13 Feb 2007 09:11:33 -0800." Date: Tue, 13 Feb 2007 17:28:31 +0000 From: Peter Stephenson X-OriginalArrivalTime: 13 Feb 2007 17:28:37.0485 (UTC) FILETIME=[653191D0:01C74F94] Content-Type: text/plain MIME-Version: 1.0 X-Scanned-By: MailControl A-07-06-80 (www.mailcontrol.com) on 10.67.0.123 Bart Schaefer wrote: > The next question is what is best from the user's point of view. > Suppose the example were something like > > print $SECONDS > * > > If we call zerr() and closemnodes(), then an error message is printed > once but the command never actually executes, so the files that it was > possible to open are truncated to zero size. If we call zwarn() and > not closemnodes(), then hundreds of error messages are printed, the > command goes ahead, some files get $SECONDS and some remain unchanged. > Which is preferable? Probably the former. Failing to open an output channel should in general be a fatal error, at least for the command that's executing. That seems to be how it works currently: % { echo foo; echo Done 1 >&2; } >/noaccess; echo Done 2 zsh: permission denied: /noaccess Done 2 Multios have the inevitable property that a failure can't be atomic, i.e. you can't necessarily have either the state before, or a success. I think we just have to live with aborting as early as possible as a bit better than getting further but still not doing what the user asked. In the case of a warning you don't even get a non-zero status, so in a function or script---even a carefully written one designed to bail out at the first sniff of an error---you might not notice until far too late. (How careful a script or function actually is if it's so cavalier with multios is another question.) However, what the user actually wants depends on the context, so it's possible you can come up with cases where the other alternative is better. -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview