From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13951 invoked by alias); 7 Aug 2011 21:44:19 -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: X-Seq: 29653 Received: (qmail 12882 invoked from network); 7 Aug 2011 21:44:17 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110807144359.ZM27903@torch.brasslantern.com> Date: Sun, 07 Aug 2011 14:43:59 -0700 In-reply-to: <20110807185002.6a042cab@pws-pc.ntlworld.com> Comments: In reply to Peter Stephenson "Re: How to misplace an entire pipeline" (Aug 7, 6:50pm) References: <110805203111.ZM32508@torch.brasslantern.com> <20110807185002.6a042cab@pws-pc.ntlworld.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: How to misplace an entire pipeline MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Aug 7, 6:50pm, Peter Stephenson wrote: } } This is code I don't go near Obviously somebody went near it at some point not as long ago as Sven, because it behaved differently in 4.2.x. Zsh does still know about the pipeline, because if you explicitly wait for the subjobs by PID it does block rather than saying "not a child of this shell". findproc() is able to see them (so it's not related to the recent go-round with that.) (By the way, arguably "wait" ought to continue the job if it's stopped, which it does if you wait for it by job number but does not if you wait for it by PID.) Starting from torch% sleep 10 | sleep 20 | true Then hit ^Z, then torch% ps ax | grep slee 27868 pts/2 T 0:00 sleep 10 27869 pts/2 T 0:00 sleep 20 27873 pts/2 S+ 0:00 grep slee torch% wait 27868 Here we are in bin_fg right after the findproc(): (gdb) p *j $4 = {gleader = 27868, other = 0, stat = 1139, pwd = 0x0, procs = 0x9f83070, auxprocs = 0x0, filelist = 0x0, stty_in_env = 0, ty = 0x0} (gdb) p *p $5 = {next = 0x9f83128, pid = 27868, text = "sleep 10", '\0' , status = 5247, ti = {ru_utime = { tv_sec = 0, tv_usec = 0}, ru_stime = {tv_sec = 0, tv_usec = 1999}, ru_maxrss = 0, ru_ixrss = 0, ru_idrss = 0, ru_isrss = 0, ru_minflt = 242, ru_majflt = 0, ru_nswap = 0, ru_inblock = 0, ru_oublock = 0, ru_msgsnd = 0, ru_msgrcv = 0, ru_nsignals = 0, ru_nvcsw = 3, ru_nivcsw = 0}, bgtime = {tv_sec = 1312751280, tv_usec = 828721}, endtime = {tv_sec = 1312751282, tv_usec = 474423}} If I wait for the "sleep 20" instead: (gdb) p *j $2 = {gleader = 27868, other = 0, stat = 1139, pwd = 0x0, procs = 0x9f83070, auxprocs = 0x0, filelist = 0x0, stty_in_env = 0, ty = 0x0} (gdb) p *p $3 = {next = 0x0, pid = 27869, text = "sleep 20", '\0' , status = 5247, ti = {ru_utime = {tv_sec = 0, tv_usec = 0}, ru_stime = { tv_sec = 0, tv_usec = 999}, ru_maxrss = 0, ru_ixrss = 0, ru_idrss = 0, ru_isrss = 0, ru_minflt = 242, ru_majflt = 0, ru_nswap = 0, ru_inblock = 0, ru_oublock = 0, ru_msgsnd = 0, ru_msgrcv = 0, ru_nsignals = 0, ru_nvcsw = 3, ru_nivcsw = 1}, bgtime = { tv_sec = 1312751280, tv_usec = 829868}, endtime = {tv_sec = 1312751282, tv_usec = 474440}} Notice that at some point "sleep 10" was made the process group leader for the whole pipeline. Now, here's an interesting tidbit: torch% jobs %?foo jobs: job not found: ?foo torch% jobs %?sleep jobs: %?sleep: no such job Note the difference? The latter message means that getjob() found the pipeline, but either it's _not_ STAT_INUSE or it _is_ STAT_NOPRINT. So I think what we have here is a simple failure to communicate. Unfortunately I can't chase this any further this afternoon.