zsh-workers
 help / color / mirror / code / Atom feed
From: Martijn Dekker <martijn@inlv.org>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: zsh silently abandons compound command on trying to write to a closed file descriptor
Date: Thu, 27 Oct 2016 18:21:31 +0100	[thread overview]
Message-ID: <6f70f97d-56cf-d09a-581c-4578a3124460@inlv.org> (raw)

zsh misbehaves if a redirection produces an error due to writing to a
closed file descriptor. For instance,

    echo hi >&- || echo oops

doesn't output "oops" as expected. But the shell is not exited, only the
current compound command is apparently abandoned -- silently, without an
error message or even a non-zero exit status.

Test script:

	echo hi >&- || ! echo oops
	echo $?

'zsh test.sh' and 'zsh -o posixbuiltins test.sh' both output 0 (and
nothing else). Expected output is an error message followed by "oops"
followed by 1.

Relevant POSIX text is at:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_08_01

Thanks,

- M.


             reply	other threads:[~2016-10-27 17:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-27 17:21 Martijn Dekker [this message]
2016-10-27 20:01 ` 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=6f70f97d-56cf-d09a-581c-4578a3124460@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).