zsh-workers
 help / color / mirror / code / Atom feed
From: Martijn Dekker <martijn@inlv.org>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: [bug?] Invalid file descriptor ignored
Date: Mon, 29 Feb 2016 07:44:52 +0100	[thread overview]
Message-ID: <56D3E8E4.6090007@inlv.org> (raw)

There is some strange and inconsistent behaviour when trying to write to
a non-open file descriptor. I think the following three test cases
should at least return a non-zero status, but only the third one does:

% echo hi 1>&-; echo $?
0
% { echo hi; } 1>&-; echo $?
zsh: write error: bad file descriptor
0
% echo hi 2>&- 1>&2; echo $?
zsh: 2: bad file descriptor
1

Other shells behaviour, FWIW: All other shells return a non-zero status
for all three cases. (d)ash, bash, yash produce an error message for the
first two cases but not the third. ksh88, ksh93 and {pd,m}ksh are silent
on all three.

Thanks,

- M.


             reply	other threads:[~2016-02-29  6:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29  6:44 Martijn Dekker [this message]
2016-02-29  9:39 ` Peter Stephenson
2016-02-29 19:21   ` 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=56D3E8E4.6090007@inlv.org \
    --to=martijn@inlv.org \
    --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).