From owner-freebsd-current@FreeBSD.ORG Mon Oct 11 18:13:42 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA6C710657C0; Mon, 11 Oct 2010 18:13:41 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id B866E8FC0A; Mon, 11 Oct 2010 18:13:41 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 5C1B146BA0; Mon, 11 Oct 2010 14:13:41 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 825788A027; Mon, 11 Oct 2010 14:13:40 -0400 (EDT) From: John Baldwin To: freebsd-current@freebsd.org Date: Mon, 11 Oct 2010 11:13:30 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <20101011131719.GA90530@hoeg.nl> In-Reply-To: <20101011131719.GA90530@hoeg.nl> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201010111113.30648.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Mon, 11 Oct 2010 14:13:40 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-0.3 required=4.2 tests=BAYES_00,DATE_IN_PAST_03_06 autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: Ed Schouten , delphij@freebsd.org Subject: Re: truss calls setpgid() X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Oct 2010 18:13:42 -0000 On Monday, October 11, 2010 9:17:19 am Ed Schouten wrote: > Hi all, > > I've been seeing this bug for a very long time, but I was too lazy to > figure out the root cause earlier. It is TTY related, but in this case > the TTY layer is not to blame. It does things correctly. > > When you run a command in truss which calls ioctls on TTYs, it just > locks up. This is because truss runs jobs in a separate process group. > This also means you cannot send signals to it: > > truss sleep 10000 > > Pressing ^C here won't work. > > I've fixed it locally like this: > > Index: usr.bin/truss/setup.c > =================================================================== > --- usr.bin/truss/setup.c (revision 213113) > +++ usr.bin/truss/setup.c (working copy) > @@ -78,7 +78,6 @@ > } > if (pid == 0) { /* Child */ > ptrace(PT_TRACE_ME, 0, 0, 0); > - setpgid (0, 0); > execvp(command[0], command); > err(1, "execvp %s", command[0]); > > Question: was this intentional? I'd rather not break stuff. It was added in the switch from procfs to ptrace(), but it's not clear why the child has a new process group. It doesn't look like truss ever tries to kill the entire group for example. -- John Baldwin