Subject: | Very weird bug of `prove' w.r.t. trapped signals and fd redirections in TAP producers |
Date: | Sat, 10 Sep 2011 00:33:04 +0200 |
To: | bug-test-harness [...] rt.cpan.org |
From: | Stefano Lattarini <stefano.lattarini [...] gmail.com> |
Hello.
I've recently encountered a very strange issue with prove 3.17 on
Solaris 10 and Debian GNU/Linux (it took me half a day to produce
this almost-minimal test case!).
Here is the problematic data:
$ cat > t <<'END'
trap 'exit $?' 0
trap "echo 'caught signal SIGINT' >&9; exit 1" 2
trap "echo 'caught signal SIGPIPE' >&9; exit 1" 13
set -x
sleep 5
echo 1..0
END
And here is what happens on the two systems...
=============
Solaris 10
=============
Some system info:
$ uname -rmsv
SunOS 5.10 Generic_144489-06 i86pc
$ prove --version
TAP::Harness v3.17 and Perl v5.12.2
$ bash --version
GNU bash, version 3.2.51(1)-release (i386-pc-solaris2.10)
Copyright (C) 2007 Free Software Foundation, Inc.
How to reproduce the issue:
$ prove -e bash ./t 9>&2 # Wait a couple of seconds, then hit Ctrl-C
./t .. + sleep 5
^Ccaught signal SIGINT
caught signal SIGPIPE
caught signal SIGPIPE
Wait, where are those SIGPIPES coming from? And why there are two of
them? And it gets funnier if one uses the system Bourne Shell or Korn
Shell instead of Bash:
$ prove -e /bin/sh ./t 9>&2 # Wait a couple of seconds, then hit Ctrl-C
+ sleep 5
^Ccaught signal SIGINT
caught signal SIGPIPE
caught signal SIGPIPE
... last line repeated ~ 25000 times ...
$ ls -l core # The shell didn't dump core, though.
core: No such file or directory
$ prove -e /bin/ksh ./t 9>&2 # Wait a couple of seconds, then hit Ctrl-C
+ sleep 5
^Ccaught signal SIGINT
caught signal SIGPIPE
caught signal SIGPIPE
... last line repeated ~ 6000 times ...
$ file core # The shell dumped core now!
core: ELF 32-bit LSB core file 80386 Version 1, from 'ksh'
=================
Debian Unstable
=================
Some system info:
$ lsb_release -idrc
Distributor ID: Debian
Description: Debian GNU/Linux testing/unstable
Release: testing/unstable
Codename: n/a
$ uname -rmsv
Linux 2.6.30-2-686 #1 SMP Sat Sep 26 01:16:22 UTC 2009 i686
$ bash --version
GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
$ dpkg -l dash
ii dash 0.5.5.1-7.4 POSIX-compliant shell
$ dpkg -l ksh
ii ksh 93u-1 The real, AT&T version of the Korn shell
How to reproduce the issue:
$ prove -e bash ./t 9>&2 # Wait a couple of seconds, then hit Ctrl-C
./t .. + sleep 5
^C
caught signal SIGINT
caught signal SIGPIPE
caught signal SIGPIPE
Again those two SIGPIPE; but ksh only gets one:
$ prove -e ksh ./t 9>&2
./t .. + sleep 5
^C
caught signal SIGINT
caught signal SIGPIPE
It gets funnier if one uses the Alquist shell:
$ prove -e /bin/dash ./t 9>&2 # Wait a couple of seconds, then hit Ctrl-C
+ sleep 5
^Ccaught signal SIGINT
caught signal SIGPIPE
caught signal SIGPIPE
... last line repeated ~ 28000 times ...
=================
Let me know if you need more information.
Regards, and thanks for you great software,
Stefano
Message body is not shown because it is too large.