From: Zefram <zefram@fysh.org>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zefram <zefram@fysh.org>,
Felix Rosencrantz <f_rosencrantz@yahoo.com>,
zsh-workers@sunsite.dk
Subject: Re: Test failure in redirect.
Date: Tue, 5 Feb 2002 02:46:22 +0000 [thread overview]
Message-ID: <20020205024622.GA24127@fysh.org> (raw)
In-Reply-To: <1020205023130.ZM28214@candle.brasslantern.com>
Bart Schaefer wrote:
>The "print" command has to execute, e.g. in case it's given -P and there
>are side-effects of the prompt expansion due to the PROMPT_SUBST option,
>but it must not produce any output and it definitely shouldn't return
>nonzero.
The print command's purpose is to write certain characters to stdout.
In this case, it is unable to perform that operation, because stdout
isn't connected to anything. Why should the treatment of that case
differ from the case where it is unable to perform the intended operation
due to stdout being on a full filesystem? It seems to me that an error
message warning of the failure is appropriate in either case. Is there
any precedent for echo/print being silent about a closed stdout but
complaining about other error conditions?
The only argument I see for not treating a closed stdout as an error
when one attempts to write to it is to allow >&- to be used to throw
away output. What's wrong with >/dev/null? Is there a significant
amount of code that uses >&- instead of >/dev/null? I argue that such
code is broken.
>E.g. here's bash:
>
>[schaefer@zagzig schaefer]$ echo foo >&-
>[schaefer@zagzig schaefer]$ echo $?
>0
>[schaefer@zagzig schaefer]$
I get results inconsistent with that:
zefram@bowl:~> echo foo >&-; echo $?
1
zefram@bowl:~> echo foo >/dev/full; echo $?
1
zefram@bowl:~> echo foo >/dev/null; echo $?
0
zefram@bowl:~> echo $BASH_VERSION
2.05a.0(1)-release
How does your version handle >/dev/full? I get identical results from
pdksh, by the way (i.e., >&- and >/dev/full both treated as errors,
$?=1 but no error message).
-zefram
next prev parent reply other threads:[~2002-02-05 2:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-31 6:41 Felix Rosencrantz
2002-02-04 18:45 ` Bart Schaefer
2002-02-04 21:03 ` Zefram
2002-02-05 2:31 ` Bart Schaefer
2002-02-05 2:46 ` Zefram [this message]
2002-02-05 5:22 ` 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=20020205024622.GA24127@fysh.org \
--to=zefram@fysh.org \
--cc=f_rosencrantz@yahoo.com \
--cc=schaefer@brasslantern.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).