Subject: | eval-fork-die bug in Expect 1.21 |
Date: | Thu, 17 Jul 2014 13:26:36 -0500 |
To: | bug-Expect [...] rt.cpan.org |
From: | Felipe Gasper <felipe [...] felipegasper.com> |
use Expect ();
my $pid = $$;
open my $stdout, '>&=', STDOUT or die $!;
print {$stdout} "PID: ${$}$/";
my ( $expect, $err );
local $@;
eval { Expect->spawn('/does/not/exist') };
print {$stdout} "PID after Expect: ${$}$/";
die if $$ != $pid;
=====================
The above should print two “PID after Expect” messages. If it doesn’t,
run strace on it to verify that the process does NOT end with the die()
statement in Expect::spawn.
(The SIGHUP to the child--which, where does that come from??--is race-y
with the stuff after eval {}.)
This is a pretty big problem; since Expect() can die(), it always needs
eval {} around it, but that produces a difficult-to-find race condition.
-Felipe Gasper
cPanel, Inc.