zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: PATCH Re: piping question
Date: Sat, 04 Oct 2014 21:03:20 -0700	[thread overview]
Message-ID: <141004210320.ZM22343@torch.brasslantern.com> (raw)
In-Reply-To: <141004140148.ZM7815@torch.brasslantern.com>

On Oct 4,  2:01pm, Bart Schaefer wrote:
}
} For who may be interested, the parent zsh is holding open the file
} descriptor that serves as the read end of the pipe.  This happens only
} if you backgrou[n]d the entire pipeline, e.g.
} 
}    cat /dev/zero | xmost &
} 
} So I think we still have a few bugs along the lines of workers/32171 and
} 32176 and perhaps 31919.

This seems to take care of it.  PWS, should I push before 5.0.7?

diff --git a/Src/jobs.c b/Src/jobs.c
index 83a4d96..bd95afb 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -1627,8 +1627,10 @@ spawnjob(void)
     }
     if (!hasprocs(thisjob))
 	deletejob(jobtab + thisjob, 0);
-    else
+    else {
 	jobtab[thisjob].stat |= STAT_LOCKED;
+	pipecleanfilelist(jobtab[thisjob].filelist);
+    }
     thisjob = -1;
 }
 
diff --git a/Test/A05execution.ztst b/Test/A05execution.ztst
index 8d256ff..ca97f4f 100644
--- a/Test/A05execution.ztst
+++ b/Test/A05execution.ztst
@@ -217,6 +217,21 @@ F:This similar test was triggering a reproducible failure with pipestatus.
 F:This test checks for a file descriptor leak that could cause the left
 F:side of a pipe to block on write after the right side has exited
 
+  { setopt MONITOR } 2>/dev/null
+  if [[ -o MONITOR ]]
+  then
+   ( while :; do print "This is a line"; done ) | () : &
+   sleep 1
+   jobs -l
+  else
+   print -u $ZTST_fd "Skipping pipe leak test, requires MONITOR option"
+   print "[0] 0 0"
+  fi
+0:Bug regression: piping to anonymous function; piping to backround function
+*>\[<->\] <-> <->
+F:This test checks for two different bugs, a parser segfault piping to an
+F:anonymous function, and a descriptor leak when backgrounding a pipeline
+
   print "autoload_redir() { print Autoloaded ksh style; } >autoload.log" >autoload_redir
   autoload -Uk autoload_redir
   autoload_redir


  reply	other threads:[~2014-10-05  4:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1412259225.3798.0@numa-i>
     [not found] ` <CAHYJk3Rx9iBLgeeKcnnu4N-56CqsgNyNhJof5+_M8H0Y0BBi9Q@mail.gmail.com>
     [not found]   ` <141003082330.ZM15100__40912.263657856$1412349949$gmane$org@torch.brasslantern.com>
2014-10-04 15:50     ` Christian Neukirchen
2014-10-04 18:17       ` Bart Schaefer
2014-10-04 19:29         ` Christian Neukirchen
2014-10-04 21:01           ` Bart Schaefer
2014-10-05  4:03             ` Bart Schaefer [this message]
2014-10-05 17:20               ` PATCH " Peter Stephenson
2014-10-05 12:17       ` Mikael Magnusson
2014-10-05 15:10         ` Christian Neukirchen
2014-10-05 17:04         ` Bart Schaefer
2014-10-05 20:40           ` Mikael Magnusson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=141004210320.ZM22343@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).