From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 22023 invoked from network); 5 May 2020 16:48:45 -0000 Received-SPF: pass (primenet.com.au: domain of zsh.org designates 203.24.36.2 as permitted sender) receiver=inbox.vuxu.org; client-ip=203.24.36.2 envelope-from= Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 5 May 2020 16:48:45 -0000 Received: (qmail 18000 invoked by alias); 5 May 2020 16:48:37 -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: List-Unsubscribe: X-Seq: 45784 Received: (qmail 7327 invoked by uid 1010); 5 May 2020 16:48:37 -0000 X-Qmail-Scanner-Diagnostics: from smtpq1.tb.ukmail.iss.as9143.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25801. spamassassin: 3.4.4. Clear:RC:0(212.54.57.96):SA:0(-2.7/5.0):. Processed in 2.39877 secs); 05 May 2020 16:48:37 -0000 X-Envelope-From: p.w.stephenson@ntlworld.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _mailcloud.virginmedia.com designates 212.54.57.96 as permitted sender) X-Env-Mailfrom: p.w.stephenson@ntlworld.com X-Env-Rcptto: zsh-workers@zsh.org X-SourceIP: 172.25.160.133 X-CNFS-Analysis: v=2.3 cv=FoieA1jq c=1 sm=1 tr=0 a=ShKnLeKYHz8gHcl3UCxcnw==:117 a=KEnZaF_ea6UA:10 a=IkcTkHD0fZMA:10 a=DoY9bV0jb9AA:10 a=pGLkceISAAAA:8 a=sseYlG9Bdx_nx47MXZMA:9 a=QEXdDO2ut3YA:10 X-Authenticated-Sender: p.w.stephenson@ntlworld.com Date: Tue, 5 May 2020 17:47:57 +0100 (BST) From: Peter Stephenson To: zsh-workers@zsh.org Message-ID: <600054363.204367.1588697277901@mail2.virginmedia.com> In-Reply-To: References: <1563722540.4311.24.camel@samsung.com> <1565710707.5633.11.camel@samsung.com> <309829031.4459446.1587391766024@mail2.virginmedia.com> <20200503000658.6fddb904@tarpaulin.shahaf.local2> <20200503210618.5c639014@tarpaulin.shahaf.local2> <505277422.148264.1588581302888@mail2.virginmedia.com> <20200505000331.59294412@tarpaulin.shahaf.local2> Subject: Re: Feature request: ZSH_XTRACEFD variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v7.8.4-Rev69 X-Originating-IP: 165.225.81.56 X-Originating-Client: open-xchange-appsuite X-CMAE-Envelope: MS4wfGD0qPE9AO3W/4XYn1W/os/tNxm8ap9VZc4ultCQxXg8LGHKCmymU5TJrXEDHBpPaJZ4FRAg1YO8VtSY4ASP5Ly46xBK4MlNLyViJYPO9NRRVBsZrX0G xZzFtCjS7b4jY9I0zqimUFBgaSG+Q6ojkoNxC4e7wWWL+AJ9dxwiG+QuSAvCXlBKIABABKm7UVIpNgMQJRIXVH+j+beDk/YSjHc= > On 05 May 2020 at 17:36 Timoth=C3=A9e Mazzucotelli wrote: >=20 >=20 > > > I wrote such a test and noticed that file descriptors were being > > > closed each time ZSH_XTRACEFD was (re)assigned, even as a local > > > variable. So I removed the code lines closing the previous file > > > descriptor in xtracefdsetfn, and it seemed to work well. > > > > This re-introduces the file descriptor leak I was at pains to remove. > > It apparently works because the test isn't sensitive to the leak --- > > that's hard to fix in a standard way, i.e. with1out having some limit y= ou > > can rely on on file descriptors being created. >=20 > After thinking about it more, do we really want to close the file > descriptors? > I mean, when assigning ZSH_XTRACEFD, the file descriptor it points to > must already exist, i.e. the users must create it themselves, explicitly. > We never implicitly create file descriptors for this feature, > so why would we implicitly close them? The problem is if we fopen() the file descriptor to use stdio as output, we= can either leak the entire FILE, not opened by the user, or we can close the entire FI= LE. That's unless you can get away with assigning fileno(file) an invalid file = descriptor, or there's some other interface I don't know about. I don't think we want to go down the road of not using stdio for stderr, it= seems like too much of a waste. pws