[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug#8938: make timeout and CTRL-C

From: Pádraig Brady
Subject: Re: bug#8938: make timeout and CTRL-C
Date: Sat, 02 Jul 2011 22:24:22 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20100227 Thunderbird/3.0.3

On 29/06/11 10:55, Pádraig Brady wrote:
> On 28/06/11 20:10, Alan Curry wrote:
>> =?ISO-8859-1?Q?P=E1draig_Brady?= writes:
>>> I'm still not convinced we need to be messing with tcsetpgrp()
>>> but you're right in that the disconnect between the timeout
>>> process group and that of whatever starts `timeout` should be bridged.
>>> I'm testing the attached patch at the moment (which I'll split into 2).
>>> It only creates a separate group for the child that `timeout` execs,
>>> leaving the timeout process in the original group to propagate signals down.
>>> I'll need to do lots of testing with this before I commit.
>> With this patch the child is guaranteed to not be in the foreground (as far
>> as the tty knows) so it will be getting SIGTTIN and possibly SIGTTOU on tty
>> operations.
> Oh right. This will immediately put dd in sTop state:
>   timeout 10 dd
> That was one of the main reasons I didn't split the groups
> in the first place. I should read my own comments :)
> I'm very wary of changing the foreground group (with tcsetpgrp),
> which would fix this, but in turn may cause other issues.
>> I don't think there's anything that will make every scenario happy. (Except
>> for a recursive-kill that doesn't use pgrps!).
> Yes, an ideal solution is elusive.
> Maybe `make` needs to handle things differently?
> If you put the following in a Makefile, how should make respond to Ctrl-C?
> all:
>       setsid sleep 10

I've been doing a quick test here with a version of timeout that
calls tcsetpgrp() in the child background group, and it
works for these cases. However I still don't think we should be
grabbing the foreground group, and instead this
responsibility should be passed down?

Given the above setsid make example (which hangs for 10s
ignoring Ctrl-C, I'm leaning towards `make` needing to
be more shell like, or at least forward the SIGINT etc.
to the job, and not assume jobs run in the foreground group).

There is also the suggestion from Paul Eggert, to add
an option to timeout, so that it doesn't create a separate group,
and so only times out the exec'd process and nothing beneath that.
We might call this --single (process/group).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]