From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13632 invoked by alias); 27 Oct 2016 17:21:44 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39741 Received: (qmail 27166 invoked from network); 27 Oct 2016 17:21:44 -0000 X-Qmail-Scanner-Diagnostics: from kahlil.inlv.org by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(37.59.109.123):SA:0(-1.4/5.0):. Processed in 0.461426 secs); 27 Oct 2016 17:21:44 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=RP_MATCHES_RCVD autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: martijn@inlv.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at inlv.org does not designate permitted sender hosts) From: Martijn Dekker To: Zsh hackers list Subject: zsh silently abandons compound command on trying to write to a closed file descriptor Message-ID: <6f70f97d-56cf-d09a-581c-4578a3124460@inlv.org> Date: Thu, 27 Oct 2016 18:21:31 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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.