From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26849 invoked by alias); 20 Jan 2015 11:39:53 -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: 19756 Received: (qmail 28896 invoked from network); 20 Jan 2015 11:39:50 -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: cbfec7f5-b7fc86d0000066b7-8d-54be3e8310a5 To: undisclosed-recipients: ; Date: Tue, 20 Jan 2015 11:39:43 +0000 From: Peter Stephenson Cc: Zsh Users Subject: Re: warning about closing an already closed file descriptor Message-id: <20150120113943.27f2d110@pwslap01u.europe.root.pri> In-reply-to: <20150120110203.GI979@isis.sigpipe.cz> References: <1469711.vAe1BPIYVt@kdudka.brq.redhat.com> <20150119145935.5eee77ee@pwslap01u.europe.root.pri> <20150119172850.1bffc197@pwslap01u.europe.root.pri> <20150120110203.GI979@isis.sigpipe.cz> 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+NgFprJLMWRmVeSWpSXmKPExsVy+t/xa7rNdvtCDH6/4rPYcXIlowOjx6qD H5gCGKO4bFJSczLLUov07RK4Mlb3b2UpWMlZcfjscaYGxhnsXYycHBICJhIbzp9ghrDFJC7c W88GYgsJLGWUuP+XA8QWEZCRmDv7MWsXIxdInEmiYd0eJpAEi4CqxImXc8Aa2AQMJaZums0I YjMLKErsnvwVzBYWcJG4s/ot2AJeAXuJP3/6wWxOAWOJxg2/mCGGnmaUmDX/DAtIgl9AX+Lq 309MEBfZS8y8coYRollQ4sfkeywQC7QkNm9rYoWw5SU2r3nLPIFRcBaSsllIymYhKVvAyLyK UTS1NLmgOCk910ivODG3uDQvXS85P3cTIyQ4v+5gXHrM6hCjAAejEg/vCee9IUKsiWXFlbmH GCU4mJVEeM+a7wsR4k1JrKxKLcqPLyrNSS0+xMjEwSnVwLiaa5vP/IkLDz//1GVmk14Tv+1/ jvTs4jPqCjqV/Ls95cQ8gx0kPtQvtXrYsFmt+Yl2fc0a+49SbpVXeU/cDmUQMk8US5hv4nn3 yrw1irsefNmYLvLsxZwbK+1u3uplbGGePn1V27M5fzbynn8n59yysIT7acB/rbz4Y0FP7/A4 zM2abcd6z0aJpTgj0VCLuag4EQAhXXrBLAIAAA== On Tue, 20 Jan 2015 12:02:03 +0100 Roman Neuhauser wrote: > > - ({ exec 3<&- } 2>/dev/null > > - exec 3<&- > > - read foo <&-) > > + (exec {varid}<&0 > > + exec {varid}<&- > > + print About to close a second time >&2 > > + read {varid}<&-) > > sorry if i'm talking out of my ass, but does this mean that > the non-{varid} syntax is now without a test? For closing fd's, yes. There's no output to test --- though there is a status, so we could still test that. And I suppose the lack of an error message is itself a test... pws diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst index cb67788..13f1f7c 100644 --- a/Test/A04redirect.ztst +++ b/Test/A04redirect.ztst @@ -152,11 +152,16 @@ >hello >goodbye + ({exec 3<&- } 2>/dev/null + exec 3<&- + read foo <&-) +1:'<&-' redirection with numeric fd (no error message on failure) + (exec {varid}<&0 exec {varid}<&- print About to close a second time >&2 read {varid}<&-) -1:'<&-' redirection +1:'<&-' redirection with fd in variable (error message on failure) ?About to close a second time *?\(eval\):*: failed to close file descriptor *