From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8694 invoked by alias); 19 Jan 2015 15:09:47 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19746 Received: (qmail 7856 invoked from network); 19 Jan 2015 15:09:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f4-b7f126d000001e9a-75-54bd1bda5105 Date: Mon, 19 Jan 2015 14:59:35 +0000 From: Peter Stephenson To: Zsh Users Subject: Re: warning about closing an already closed file descriptor Message-id: <20150119145935.5eee77ee@pwslap01u.europe.root.pri> In-reply-to: <1469711.vAe1BPIYVt@kdudka.brq.redhat.com> References: <1469711.vAe1BPIYVt@kdudka.brq.redhat.com> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGLMWRmVeSWpSXmKPExsVy+t/xq7q3pPeGGKzarG+x4+RKRgdGj1UH PzAFMEZx2aSk5mSWpRbp2yVwZSx5u4utYA53xfKOxawNjJ84uhg5OSQETCTuP9zGBGGLSVy4 t56ti5GLQ0hgKaPEhgtvWSCcRUwS/6etgspsY5T40raRDaSFRUBV4vH0F2DtbAKGElM3zWYE sUUEFCXO/PoGFhcWcJG4s/otM4jNK2Av8Xb5ETCbU8Bc4svkm2C2kICZxJOFrWD1/AL6Elf/ foI6yV5i5pUzjBC9ghI/Jt9jAbGZBbQkNm9rYoWw5SU2r3kLNUdd4sbd3ewTGIVmIWmZhaRl FpKWBYzMqxhFU0uTC4qT0nMN9YoTc4tL89L1kvNzNzFCwvbLDsbFx6wOMQpwMCrx8Grk7AkR Yk0sK67MPcQowcGsJMIb8AUoxJuSWFmVWpQfX1Sak1p8iJGJg1OqgVE4ffHsFT5pXBOTGWfc rXt9Z/G8cLUvF568eTj5aS//AnHbtg85d6/3SU66Efc+rXl/ueWEmOCKe/3XXT6+XGOv9OCI VZ/HW/uZoVOYFI5YLJk2//TsXs2/vyufTyo71fh86psvVXFatzS1RbzfRWy847p1T/ycz5+i v3tuunRly9dVMx1S7ubvUmIpzkg01GIuKk4EAAqOyuA5AgAA On Mon, 19 Jan 2015 14:33:25 +0100 Kamil Dudka wrote: > zsh prints a warning if an already closed file descriptor is to be closed. > While this is technically correct, the other shells I tried (ksh and bash) > do not print any such warning: > > $ bash -c '(true <&-) <&-' > $ ksh -c '(true <&-) <&-' > $ zsh -c '(true <&-) <&-' > zsh:1: failed to close file descriptor 0: bad file descriptor > > The warning was introduced by the following commit: > http://sourceforge.net/p/zsh/code/ci/45913f43 > > ... and it causes problems when porting legacy scripts to a newer version > of zsh. Is there any way to suppress the warning? > > If not, how can one achieve compatibility with other shells (including > older versions of zsh)? The problem that change fixed wasn't really intended to have a visible effect, apart from closing f.d.s the shell didn't know about. If it's more useful without the message than with it, it can be removed. The shell doesn't make it particularly convenient to test first, either (you can test something that isn't quite the point by means that aren't quite intended for it). Does anyone want to own up to using the message for debugging? We can special case the {varid}<&- syntax --- that might be useful since it implies the user was previously in direct control of the f.d. so is ikely to be interested in an error if closing it failed. pws