From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20050 invoked from network); 6 May 2000 18:45:30 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 6 May 2000 18:45:30 -0000 Received: (qmail 550 invoked by alias); 6 May 2000 18:45:20 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11237 Received: (qmail 527 invoked from network); 6 May 2000 18:45:19 -0000 From: "Bart Schaefer" Message-Id: <1000506184503.ZM6391@candle.brasslantern.com> Date: Sat, 6 May 2000 18:45:03 +0000 In-Reply-To: Comments: In reply to Tanaka Akira "Re: fg/bg on FreeBSD." (May 7, 2:48am) References: <1000506170828.ZM2063@candle.brasslantern.com> X-Mailer: Z-Mail (5.0.0 30July97) To: Tanaka Akira , zsh-workers@sunsite.auc.dk Subject: Re: fg/bg on FreeBSD. MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On May 7, 2:48am, Tanaka Akira wrote: } Subject: Re: fg/bg on FreeBSD. } } In article <1000506170828.ZM2063@candle.brasslantern.com>, } "Bart Schaefer" writes: } } > Why is the PGID of sleep different on FreeBSD? Did it change after the } > sleep was started because the echo exited? } } Possibly. But NetBSD has no problem... Yes, what I'm wondering is whether this is a FreeBSD bug. } | Z:akr@dhcp21% ktrace -i zsh -f } | dhcp21% sleep 100|sleep 200 } | ^Z } | zsh: suspended sleep 100 | sleep 200 } | dhcp21% jobs -l } | [1] + 29245 suspended sleep 100 | } | 29246 suspended sleep 200 } | dhcp21% ps j29245; ps j29246 } | USER PID PPID PGID SESS JOBC STAT TT TIME COMMAND } | akr 29245 29244 29245 94d480 2 T p3 0:00.00 sleep 100 } | USER PID PPID PGID SESS JOBC STAT TT TIME COMMAND } | akr 29246 29244 29245 94d480 2 T p3 0:00.00 sleep 200 } } PGID is first sleep's PID. It's good. } } | dhcp21% bg } | [1] + continued sleep 100 | sleep 200 } | dhcp21% ps j29245; ps j29246 } | USER PID PPID PGID SESS JOBC STAT TT TIME COMMAND } | akr 29245 29244 29245 94d480 2 I p3 0:00.00 sleep 100 } | USER PID PPID PGID SESS JOBC STAT TT TIME COMMAND } | akr 29246 29244 29245 94d480 2 I p3 0:00.00 sleep 200 } } It's successfully resumed. OK, now, can you "fg" it, wait for the first sleep (but not the second) to exit, then ^Z again and check the PGIDs? If the PGID is going to change every time the group leader exits, then we've got a problem -- we can't simply record the group leader's PID and keep using it unless we arrange for a group leader that's guaranteed to stay alive for the whole pipeline. Another test to try: echo | sleep 100 | sleep 200 If you ^Z this, do both sleeps get the same PGID, or do they each become their own process group? (I'm hoping the latter, for sanity, otherwise it's a guessing game as to what PID becomes the leader.) -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com