Skip Menu |

This queue is for tickets about the Expect CPAN distribution.

Report information
The Basics
Id: 41482
Status: open
Priority: 0/
Queue: Expect

People
Owner: Nobody in particular
Requestors: _rubio_ [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Bug with EINTR handling in Expect.pm
Date: Sat, 6 Dec 2008 03:49:13 -0800 (PST)
To: RGiersig [...] cpan.org, bug-Expect [...] rt.cpan.org
From: Rubio <_rubio_ [...] yahoo.com>
Greetings, I just wanted to point out a little bug with the new EINTR handling in 1.21 (and thanks for adding this, by the way; I was the original requester, or at least one of them). You've wrappered the select() call in a SELECT: { BLOCK } so you could restart it on EINTR, but you used "next SELECT" to implement that restart which doesn't do what is intended. As the perl docs put it: "Note that a block by itself is semantically identical to a loop that executes once. Thus next will exit such a block early." which is exactly what happens here--the select in fact does not restart. (oops.) Contrast with: "Note that a block by itself is semantically identical to a loop that executes once. Thus redo inside such a block will effectively turn it into a looping construct." So the trivial fix, replace the "next" with "redo", and voila, it works perfectly: *** Expect.pm.ORIG Thu Jul 19 07:23:51 2007 --- Expect.pm Sat Dec 6 05:42:18 2008 *************** *** 792,798 **** if ($!{EINTR} and $Expect::IgnoreEintr) { print STDERR ("ignoring EINTR, restarting select()...\r\n") if ($Expect::Exp_Internal or $Expect::Debug); ! next SELECT; } print STDERR ("select() returned error code '$!'\r\n") if ($Expect::Exp_Internal or $Expect::Debug); --- 792,798 ---- if ($!{EINTR} and $Expect::IgnoreEintr) { print STDERR ("ignoring EINTR, restarting select()...\r\n") if ($Expect::Exp_Internal or $Expect::Debug); ! redo SELECT; } print STDERR ("select() returned error code '$!'\r\n") if ($Expect::Exp_Internal or $Expect::Debug); Thanks for your work on this, Expect.pm is a lifesaver. --Rubio
Hi Rubio, I know this has been a while ago, but I just recently started to co-maintain the module. Could you please create a test-case for this feature and send it via GitHub? https://github.com/szabgab/expect.pm