Subject: bug#15779: timeout: Child gets SIGTTOU when run from a shell script

From: "Richard W.M. Jones" <[email-masked]>
Date: Fri, 1 Nov 2013 14:30:33 +0000

On Fri, Nov 01, 2013 at 01:48:45PM +0000, Pádraig Brady wrote:
> The initial messages to bug-coreutils have disappeared somewhere in
> the ether.  Anyway the context is that if a process being controlled
> by timeout gets a SIGTTOU, then it will be stopped.

I don't think this is strictly accurate.

The issue I have is that timeout behaves differently when running
directly from the command line versus run from the command line via an
intermediate shell script.

  interactive -> timeout -> command   # OK
  interactive -> bash script -> timeout -> command   # SIGTTOU sent

SIGTTOU is sent in the latter case, causing the process under test to
hang (ie. T state) until the timeout happens.

This makes timeout useless for our purposes which is to cause a test
to time out if it runs for longer than 4 hours.

> I think that since the child wants to "interact" with the tty, that
> adding the --foreground option to the timeout command is appropriate
> here?  The caveat is that children of the monitored command will not
> be timed out.

Annoyingly, for reasons not well understood, this bug only manifests
itself on RHEL 6.  Although my minimal test case mentioned in
https://bugzilla.redhat.com/show_bug.cgi?id=1025269 works even
upstream, the original bug we are trying to avoid only happens on RHEL 6
(no idea why that is .. possibly qemu doesn't play funny games with
the tty upstream?)

'timeout' in RHEL 6 doesn't have --foreground.  Therefore I have
disabled timeout completely on RHEL 6 builds of libguestfs.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW