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 31324 invoked from network); 5 May 2020 22:20:02 -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 22:20:02 -0000 Received: (qmail 1842 invoked by alias); 5 May 2020 22:19:51 -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: 45787 Received: (qmail 12487 invoked by uid 1010); 5 May 2020 22:19:51 -0000 X-Qmail-Scanner-Diagnostics: from mail-ot1-f49.google.com 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(209.85.210.49):SA:0(-1.9/5.0):. Processed in 2.745723 secs); 05 May 2020 22:19:51 -0000 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.210.49 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pdrcc0ATGXMY0zW2ZHMGW+/yPsKGXDFwUg12Qri8Ves=; b=RsRBBWUNG+C/O19NNv2DXkmqKFRhU7yFlqneghN6g1zpu3Fh4HcTypTsWb0F7bYfC8 n3usHLpqrjd79QlrGsG6MaakKhMc054YPSB7UkajCTORn7mrSyYmhygQFfeoV34taGYt XsMHowBhAV7ofUbz8tgJgbuml6iU/5X4qr16kO2PwkPDOHdB92fTQ4ZmrLUjJPN/FIOX GvopS2++RFpIqFwdDyJL1vP4PRS5+SN7IbuoeUQl6KdG/Vjxdkj26V+8yI65fDM6wyP0 D7B6KZ5YAEbTUZcwwhec1pAB8mTQA1coslcoXgrtTxC3OTQvq1z5INNOWaKJLe6elluF aEVA== X-Gm-Message-State: AGi0PuaFAYcqLShbEwxVmP+xfhyrKlk2Cek9cEEUJ3ewRg3if6bifF+s qmoX3wuQTSG0V3XS3ma0jYFRX1F1YBSiC5XjzMkxgA== X-Google-Smtp-Source: APiQypIM5aU5qXcbF+8nNbyyJVKVfUqhYMkSe87Wm/AqC4pQb3Cerg45zipVtf/XF2WJiQKgFTPt4PNXr/hUQpQ8Q4A= X-Received: by 2002:a9d:6644:: with SMTP id q4mr4179364otm.229.1588717156480; Tue, 05 May 2020 15:19:16 -0700 (PDT) MIME-Version: 1.0 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> <600054363.204367.1588697277901@mail2.virginmedia.com> In-Reply-To: <600054363.204367.1588697277901@mail2.virginmedia.com> From: Bart Schaefer Date: Tue, 5 May 2020 15:19:05 -0700 Message-ID: Subject: Re: Feature request: ZSH_XTRACEFD variable To: Peter Stephenson Cc: "zsh-workers@zsh.org" Content-Type: text/plain; charset="UTF-8" (Peter, for some reason Gmail is classifying all email from ntlworld.com as spam, with the notation that it "can't guarantee that this message came from ntlworld.com") On Tue, May 5, 2020 at 9:48 AM Peter Stephenson wrote: > > > 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 FILE. In that case we should be doing the fopen() on a dup() of the descriptor, and fclose()ing the FILE. If it is important that fileno(xtrerr) == $ZSH_XTRACEFD, then we should 1) dup() the descriptor to save a copy 2) fopen() the original 3) after fclose(), dup2() the copy back to the original 4) close() the copy However, I'm not sure it's necessary to be that convoluted.