From owner-freebsd-stable@FreeBSD.ORG Wed Oct 24 02:40:29 2012 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B81A780B for ; Wed, 24 Oct 2012 02:40:29 +0000 (UTC) (envelope-from jdc@koitsu.strangled.net) Received: from qmta13.emeryville.ca.mail.comcast.net (qmta13.emeryville.ca.mail.comcast.net [IPv6:2001:558:fe2d:44:76:96:27:243]) by mx1.freebsd.org (Postfix) with ESMTP id 84B428FC14 for ; Wed, 24 Oct 2012 02:40:29 +0000 (UTC) Received: from omta14.emeryville.ca.mail.comcast.net ([76.96.30.60]) by qmta13.emeryville.ca.mail.comcast.net with comcast id Epvk1k0051HpZEsADqgV9r; Wed, 24 Oct 2012 02:40:29 +0000 Received: from koitsu.strangled.net ([67.180.84.87]) by omta14.emeryville.ca.mail.comcast.net with comcast id EqgU1k00F1t3BNj8aqgUud; Wed, 24 Oct 2012 02:40:29 +0000 Received: by icarus.home.lan (Postfix, from userid 1000) id 15E9673A1A; Tue, 23 Oct 2012 19:40:28 -0700 (PDT) Date: Tue, 23 Oct 2012 19:40:28 -0700 From: Jeremy Chadwick To: Ed Schouten Subject: Re: pty/tty or signal strangeness, or grep/bsdgrep bug? Message-ID: <20121024024028.GA90747@icarus.home.lan> References: <20121023142703.GA79098@icarus.home.lan> <20121023203928.GZ35915@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Konstantin Belousov , freebsd-stable@freebsd.org, jhb@freebsd.org X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Oct 2012 02:40:30 -0000 On Tue, Oct 23, 2012 at 10:42:47PM +0200, Ed Schouten wrote: > Hi Kostik, > > 2012/10/23 Konstantin Belousov : > > This is reproducable with the cat(1) as well. The telling part is that > > the backgrounded process stays on the "ttyin" cv. The code for e.g. > > tty read currently is structured as follows: > > check for background process reading from CTTY, send SIGTTYIN > > loop { > > sleep waiting for input > > process input > > } > > The problem is that the SIGCONT does not remove the sleeping process from > > the sleep queue, so the sleep is not interrupted with error. Instead, the > > process is woken up later when input is available. > > > > Old tty code did the recheck for background state inside the loop after > > the sleep. > > Exactly. Was just debugging this as well and came to the same > conclusion. Will try to come up with a decent patch tomorrow evening. > > Thanks for reporting the issue! No problem folks. Would you like me to file a PR for this so we can track it/for historical purposes? -- | Jeremy Chadwick jdc@koitsu.org | | UNIX Systems Administrator http://jdc.koitsu.org/ | | Mountain View, CA, US | | Making life hard for others since 1977. PGP 4BD6C0CB |