zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: echo > * and EMFILE
Date: Tue, 13 Feb 2007 17:28:31 +0000	[thread overview]
Message-ID: <200702131728.l1DHSVb0008430@news01.csr.com> (raw)
In-Reply-To: <070213091133.ZM4614@torch.brasslantern.com>

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 <pws@csr.com>                  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


  reply	other threads:[~2007-02-13 17:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-12 22:32 Stephane Chazelas
2007-02-13 10:53 ` Peter Stephenson
2007-02-13 17:11   ` Bart Schaefer
2007-02-13 17:28     ` Peter Stephenson [this message]
2007-02-14  7:53       ` 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=200702131728.l1DHSVb0008430@news01.csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /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).