Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Mar 2002 22:11:39 -0800 (PST)
From:      Brent Casavant <bcasavan@angeltread.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/35882: Perl Expect module send_slow hangs on EOF
Message-ID:  <200203140611.g2E6BdK07554@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         35882
>Category:       ports
>Synopsis:       Perl Expect module send_slow hangs on EOF
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 13 22:20:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Brent Casavant
>Release:        4.5-STABLE
>Organization:
>Environment:
FreeBSD abigail.angeltread.org 4.5-STABLE FreeBSD 4.5-STABLE #5: Thu Mar  7 00:03:10 CST 2002     root@abigail.angeltread.org:/usr/src/sys/compile/abigail  i386
>Description:
There is a long-standing bug in the p5-Expect modules (I'm using 1.12
at the moment) while using the subroutine send_slow.

If EOF is received (i.e. a closed network connection) send_slow will
loop forever.
>How-To-Repeat:
Utilize the Expect send_slow subroutine to close a network connection.
A good example might be sending a command to end a telnet login
session controlled by expect.  You will see the process hang at
that point, burning CPU time.
>Fix:
The following fix was provided by Richard Todd (rmtodd@servalan.com).
It has been tested against p5-Expect-1.12 and an earlier (version
not remembered) release.  Note that this is a patch against the
installed file, not against the original source.

--- Expect.pm.orig      Thu Mar 14 00:08:14 2002
+++ Expect.pm   Thu Mar 14 00:08:59 2002
@@ -1176,7 +1176,7 @@
        # .01 sec granularity should work. If we miss something it will
        # probably get flushed later, maybe in an expect call.
        while (select($rmask,undef,undef,.01)) {
-         sysread($self,${*$self}{exp_Pty_Buffer},1024);
+         last if (sysread($self,${*$self}{exp_Pty_Buffer},1024) == 0); # exit if EOF
          # Is this necessary to keep? Probably.. #
          # if you need to expect it later.
          ${*$self}{exp_Accum}.= ${*$self}{exp_Pty_Buffer};


>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203140611.g2E6BdK07554>