From owner-freebsd-stable@FreeBSD.ORG Tue Oct 23 20:42:48 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 A7BEDC24; Tue, 23 Oct 2012 20:42:48 +0000 (UTC) (envelope-from edschouten@gmail.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 45E8F8FC0A; Tue, 23 Oct 2012 20:42:47 +0000 (UTC) Received: by mail-ob0-f182.google.com with SMTP id wc20so5283871obb.13 for ; Tue, 23 Oct 2012 13:42:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=RO5XRzZRnmrtBTiqXgVfG3IIYKIgl8uoRrcTnmge4uw=; b=A57sjVZMch9ahI2ECdeWYi8PTSAWBNXvc2g0CMm/NhwdflKoJjkEn1zyQVqJHV6nsX XU9jPytcvuyW1jPzxDQZozjYzjHgTdE1MBb5DyXg5Rw7LcOzcTM1TungSa2QWbizj+P9 xAtpLJQom/RzLSYg4yWmY3UncA0W36KmvSinikemr4w0Wwqb0bC4NLSim6ldpjHzgmo8 83EyNb5h9mBaIDkb3iaseJARUSdHuDAP5t3rREBSTzQwS7wqV+IvTCjHNkDgM8sSgC1Y NPoXlDurvhnyodsuy8Kc6MKvE2QTt+gUJ22B9xRoEvAkeATS+Huk5AtzqJEwNEjgr4ax v2JQ== MIME-Version: 1.0 Received: by 10.182.1.72 with SMTP id 8mr10955898obk.61.1351024967256; Tue, 23 Oct 2012 13:42:47 -0700 (PDT) Sender: edschouten@gmail.com Received: by 10.76.151.39 with HTTP; Tue, 23 Oct 2012 13:42:47 -0700 (PDT) In-Reply-To: <20121023203928.GZ35915@deviant.kiev.zoral.com.ua> References: <20121023142703.GA79098@icarus.home.lan> <20121023203928.GZ35915@deviant.kiev.zoral.com.ua> Date: Tue, 23 Oct 2012 22:42:47 +0200 X-Google-Sender-Auth: Bn8vWRtmRs-cpmQ7qPiQyyStcn4 Message-ID: Subject: Re: pty/tty or signal strangeness, or grep/bsdgrep bug? From: Ed Schouten To: Konstantin Belousov Content-Type: text/plain; charset=UTF-8 Cc: Jeremy Chadwick , 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: Tue, 23 Oct 2012 20:42:49 -0000 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! -- Ed Schouten