From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 29324 invoked from network); 5 Jul 2020 15:06:32 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 5 Jul 2020 15:06:32 -0000 Received: (qmail 4364 invoked by alias); 5 Jul 2020 15:06:22 -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: Sender: zsh-workers@zsh.org X-Seq: 46183 Received: (qmail 7673 invoked by uid 1010); 5 Jul 2020 15:06:22 -0000 X-Qmail-Scanner-Diagnostics: from out4-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25857. spamassassin: 3.4.4. Clear:RC:0(66.111.4.28):SA:0(-2.6/5.0):. Processed in 4.933705 secs); 05 Jul 2020 15:06:22 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedruddugdekiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfggtggugfgfsehtkedttd dtreejnecuhfhrohhmpeffrghnihgvlhcuufhhrghhrghfuceougdrshesuggrnhhivghl rdhshhgrhhgrfhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpedvhfejteeufefggeevje fftdevueekheejteekveeuveevudefledtieduieehtdenucfkphepjeelrddujeeirdef ledrieelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epugdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgv X-ME-Proxy: Date: Sun, 5 Jul 2020 15:05:35 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: =(...) on LHS of pipeline leaks tempfiles Message-ID: <20200705150535.GA21561@tarpaulin.shahaf.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.10.1 (2018-07-13) In «command true =(true) =(true) | :», the tempfiles created by the two =(…) substitutions aren't removed. Test case: diff --git a/Test/D03procsubst.ztst b/Test/D03procsubst.ztst index 68a68ef6e..3d4931e48 100644 --- a/Test/D03procsubst.ztst +++ b/Test/D03procsubst.ztst @@ -160,3 +160,12 @@ $ZTST_testdir/../Src/zsh -df -o shfileexpansion -c 'cat =(echo hi)' 0:EQUALS expansion followed by =(...) (sh ordering) should work >hi + + () { + local TMPPREFIX=$PWD/tmp + command true =(true) =(true) | : + print -rC1 -- $TMPPREFIX*(N) + } +0f:external command with =(...) on LHS of pipeline cleans up its tempfiles +# (Expected result: no output.) + Its output: /home/daniel/src/zsh/./Test/D03procsubst.ztst: starting. --- /tmp/zsh.ztst.21317/ztst.out 2020-07-05 14:51:27.564872915 +0000 +++ /tmp/zsh.ztst.21317/ztst.tout 2020-07-05 14:51:27.576872865 +0000 @@ -0,0 +1,2 @@ +/tmp/zsh/Test/procsubst.tmp/tmp7CIMPd +/tmp/zsh/Test/procsubst.tmp/tmpEiQwks Test /home/daniel/src/zsh/./Test/D03procsubst.ztst failed: output differs from expected as shown above for: () { local TMPPREFIX=$PWD/tmp command true =(true) =(true) | : for i in $TMPPREFIX*(N) ; do print -r -- $i; done } Was testing: external command with =(...) cleans up its tempfiles I did find this bit in the manual: Another problem arises any time a job with a substitution that requires a temporary file is disowned by the shell, including the case where `tt(&!)' or `tt(&|)' appears at the end of a command containing a substitution. In that case the temporary file will not be cleaned up as the shell no longer has any memory of the job. A workaround is to use a subshell, for example, example(LPAR()mycmd =(myoutput)RPAR() &!) but it didn't seem applicable. Cheers, Daniel