help / color / Atom feed
* =(...) on LHS of pipeline leaks tempfiles
@ 2020-07-05 15:05 Daniel Shahaf
  0 siblings, 0 replies; only message in thread
From: Daniel Shahaf @ 2020-07-05 15:05 UTC (permalink / raw)
  To: zsh-workers

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
+  () {
+    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 @@
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.



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-05 15:05 =(...) on LHS of pipeline leaks tempfiles Daniel Shahaf


Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git