[patch] #40508 - keep ssh subprocess in same process group

Martin Pool mbp at sourcefrog.net
Wed Apr 26 12:57:13 BST 2006


On 26/04/2006, at 7:21 PM, Jan Hudec wrote:

> On Wed, Apr 26, 2006 at 14:59:46 +1000, Robert Collins wrote:
>> On Wed, 2006-04-26 at 14:56 +1000, Martin Pool wrote:
>>> This patch fixes #40508, and has an alternative fix for #5987.   
>>> See the
>>> diff for details/justification.  I will put this in 0.8 if it's
>>> approved.
>>
>> this seems incomplete :
>> we want to free locks on remote servers when we recieve:
>> SIGHUP
>> SIGINT
>>
>> A quick look through kill -l doesn't suggest any others - but its
>> definately not just INT to ignore.
>
> It should really catch most signals and change them to exceptions so
> finaly sections get run. According to signal(7) fatal signals that are
> considered 'normal' (result in plain termination) are:
>
> (POSIX1) HUP, INT, PIPE, ALRM, TERM, USR1, USR2, (SuSv2/3) POLL, PROF,
> VTALARM, (other) EMT, STKFLT, IO, PWR, LOST, UNUSED.

I was pleasantly surprised to discover that you can simply hook  
SIGHUP to a Python function, raise KeyboardInterrupt from there, and  
it goes to the right place.  Although SIGINT is treated specially by  
Python by default the mechanism can accommodate any of them.
>
> Some of them really seem bogus to terminate on (like SIGIO or  
> SIGPOLL),
> but it is that way in Linux.
>
> And then there are the signals that normally cause core dump:
>
> (POSIX1) QUIT, ILL, ABRT, FPE, SEGV, (SuSv2/3) BUS, SYS, TRAP, XCPU,
> XFSZ, (other) IOT.
>
> (I excluded KILL, which can't be trapped)
>

> From these, at least HUP, INT, PIPE, TERM, USR1, USR2, PWR (where
> defined) and maybe QUIT are likely to occur occasionally and should be
> trapped.

SIGPIPE is already turned into IOException with errno=EPIPE by  
Python.  I suppose unwinding on receipt of the others is the most  
reasonable thing.

-- 
Martin







More information about the bazaar mailing list