GNU logs - #15781, boring messages


Message sent to bug-coreutils@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#15781: timeout: Child gets SIGTTOU when run from a shell script
Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady <pbrady@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-coreutils@HIDDEN
Resent-Date: Fri, 01 Nov 2013 13:43:03 +0000
Resent-Message-ID: <handler.15781.B.138331336325346 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 15781
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords: 
To: "Richard W.M. Jones" <rjones@HIDDEN>
Cc: 15781 <at> debbugs.gnu.org
X-Debbugs-Original-Cc: Report bugs to <bug-coreutils@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.138331336325346
          (code B ref -1); Fri, 01 Nov 2013 13:43:03 +0000
Received: (at submit) by debbugs.gnu.org; 1 Nov 2013 13:42:43 +0000
Received: from localhost ([127.0.0.1]:56948 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VcEzq-0006aj-8w
	for submit <at> debbugs.gnu.org; Fri, 01 Nov 2013 09:42:42 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58578)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <pbrady@HIDDEN>) id 1VcDIt-0003ru-Io
 for submit <at> debbugs.gnu.org; Fri, 01 Nov 2013 07:54:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <pbrady@HIDDEN>) id 1VcDIf-0007uy-Pa
 for submit <at> debbugs.gnu.org; Fri, 01 Nov 2013 07:54:10 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:38849)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <pbrady@HIDDEN>) id 1VcDIf-0007uu-MS
 for submit <at> debbugs.gnu.org; Fri, 01 Nov 2013 07:54:01 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:60278)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <pbrady@HIDDEN>) id 1VcDIZ-0006A9-JU
 for bug-coreutils@HIDDEN; Fri, 01 Nov 2013 07:54:01 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <pbrady@HIDDEN>) id 1VcDIT-0007sX-II
 for bug-coreutils@HIDDEN; Fri, 01 Nov 2013 07:53:55 -0400
Received: from mx1.redhat.com ([209.132.183.28]:37402)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <pbrady@HIDDEN>) id 1VcDIT-0007sG-A8
 for bug-coreutils@HIDDEN; Fri, 01 Nov 2013 07:53:49 -0400
Received: from int-mx01.intmail.prod.int.phx2.redhat.com
 (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rA1BrlPb031041
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
 for <bug-coreutils@HIDDEN>; Fri, 1 Nov 2013 07:53:47 -0400
Received: from [10.36.116.27] (ovpn-116-27.ams2.redhat.com [10.36.116.27])
 by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id
 rA1BriND029378
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
 Fri, 1 Nov 2013 07:53:46 -0400
Message-ID: <52739648.1070901@HIDDEN>
Date: Fri, 01 Nov 2013 11:53:44 +0000
From: =?UTF-8?Q?P=C3=A1draig?= Brady <pbrady@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:17.0) Gecko/20130110 Thunderbird/17.0.2
MIME-Version: 1.0
References: <20131101081028.GA18071@HIDDEN>
In-Reply-To: <20131101081028.GA18071@HIDDEN>
X-Enigmail-Version: 1.6
Content-Type: text/plain; charset=ISO-8859-1
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id
 rA1BrlPb031041
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Mailman-Approved-At: Fri, 01 Nov 2013 09:42:40 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

On 11/01/2013 08:10 AM, Richard W.M. Jones wrote:
> Grab the tiny 'run' and 'test.c' attachments from here:
>=20
> https://bugzilla.redhat.com/show_bug.cgi?id=3D1025269#c5
>=20
> $ cd /tmp
> $ gcc -Wall test.c -o test
> $ ./test                             # this is ok
> $ timeout 4h ./test                  # this is ok
>=20
> $ cat ./run
> #!/bin/bash -
> timeout 4h ./test
>=20
> $ ./run                              # this HANGS
>=20
> The run script simply runs the same timeout command as before, from a
> shell script, but this time the test child process gets SIGTTOU and
> suspends itself, resulting in a hang.
>=20
> I was able to fix this by *removing* the following lines in
> src/timeout.c:
>=20
>        /* exec doesn't reset SIG_IGN -> SIG_DFL.  */
>        signal (SIGTTIN, SIG_DFL);
>        signal (SIGTTOU, SIG_DFL);
>=20
> In other words, leave SIGTTOU as SIG_IGN in the child process (which
> seems to make sense -- since the child is a backgrounded process, but
> we want it to be able to print things, we don't want it to get SIGTTOU
> signals when it outputs to the terminal).
>=20
> Anyway, I don't understand why this only happens when run from a shell
> script, and not from a terminal.  Presumably bash does something
> strange with SIGTTOU.

Probably something to do with job control
If you `set -m` first in the script,
then the test binary doesn't hang.

> Also I don't understand from looking at the kernel code why it's
> sending SIGTTOU in one case but not the other.  The relevant code is
> in drivers/tty/tty_io.c:tty_check_change but AFAICT it should send the
> signal in both cases.
>=20
> Rich.
>=20

Ugh these signals are really hairy to think about,
there are all sorts of edge cases here.

I did a version of timeout once that put the child in it's own group,
and noted in that version that I needed to leave SIGTTOU as IGN
as tcsetpgrp(0, getpid()) caused SIGTTOU to be sent and I wasn't sure why.

Maybe we should be resetting SIGTT{OU,IN} to what it was
previously set to, rather than SIG_DFL?

P=E1draig.




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.503 (Entity 5.503)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: =?UTF-8?Q?P=C3=A1draig?= Brady <pbrady@HIDDEN>
Subject: bug#15781: Acknowledgement (timeout: Child gets SIGTTOU when run
 from a shell script)
Message-ID: <handler.15781.B.138331336325346.ack <at> debbugs.gnu.org>
References: <52739648.1070901@HIDDEN>
X-Gnu-PR-Message: ack 15781
X-Gnu-PR-Package: coreutils
Reply-To: 15781 <at> debbugs.gnu.org
Date: Fri, 01 Nov 2013 13:43:04 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-coreutils@HIDDEN

If you wish to submit further information on this problem, please
send it to 15781 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
15781: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D15781
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 1 Nov 2013 13:54:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 01 09:54:45 2013
Received: from localhost ([127.0.0.1]:56969 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VcFBV-0006to-H2
	for submit <at> debbugs.gnu.org; Fri, 01 Nov 2013 09:54:45 -0400
Received: from mail4.vodafone.ie ([213.233.128.170]:51061)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <P@HIDDEN>) id 1VcFBS-0006tX-Mm
 for control <at> debbugs.gnu.org; Fri, 01 Nov 2013 09:54:43 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: ApUBAEayc1JtTemc/2dsb2JhbAANTJA4sD+CcwEBCIE0gxoBAQSBCQsNFBYPCQMCAQIBRRMIAQGICKoJkzCPXxaEGAOebo5L
Received: from unknown (HELO [192.168.1.79]) ([109.77.233.156])
 by mail3.vodafone.ie with ESMTP; 01 Nov 2013 13:54:26 +0000
Message-ID: <5273B291.1070703@HIDDEN>
Date: Fri, 01 Nov 2013 13:54:25 +0000
From: =?ISO-8859-1?Q?P=E1draig_Brady?= <P@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:17.0) Gecko/20130110 Thunderbird/17.0.2
MIME-Version: 1.0
To: control <at> debbugs.gnu.org
Subject: Re: bug#15781: timeout: Child gets SIGTTOU when run from a shell
 script
References: <20131101081028.GA18071@HIDDEN> <52739648.1070901@HIDDEN>
In-Reply-To: <52739648.1070901@HIDDEN>
X-Enigmail-Version: 1.6
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

forcemerge 15781 15779
stop





Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.