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

Bug#761596: autopkgtest: overrides default SIGINT handler

Martin Pitt [2014-09-15 16:57 +0200]:
> No, it's not intentional. adt-run installs a few signal handlers to
> ensure proper testbed cleanup after cancelling a test, but that's not
> the case for SIGINT. I've already spent two hours trying to debug
> this, but I'll keep digging. I put your perl script into the test
> suite and confirm the problem.

Ah, like always admitting that you don't have a clue always helps. So
it's bash which is the problem here. Adding

  print "SIGINT: ", $SIG{INT}, "\n";

to the test script shows that bash appears to set SIGINT to SIG_IGN
for backgrounded jobs. It appears that this is even described in the

Foreground subprocesses work as expected:

|  $ bash -c './sigint.pl'
|  Use of uninitialized value in print at ./sigint.pl line 3.
|  P: killing
|  P: waiting
|  P: done

But backgrounded ones don't:

| $ bash -c './sigint.pl & wait' 
| P: killing
| P: waiting
| [hangs]

adt-run calls the test script in a rather complicated manner so that
it can slide in a cleanup handler:

        script += 'touch %(o)s %(e)s; ' \
                  '%(t)s 2> >(tee -a %(e)s >&2) > >(tee -a %(o)s) & TPID=$!; ' \
                  'trap "kill $TPID || true; rm -rf $ADTTMP" TERM; ' \
                  'wait $TPID;' \

Without this, SIGTERMing adt-run will cause eternal hangs as the child
process of adt-run (i. e. the auxverb running the actual test) won't
be killed.

I'll see to rewiring this to support SIGTERM cleanup while keeping
default signal handlers.

Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)

Reply to: