From owner-freebsd-ports Wed Mar 13 22:20:14 2002 Delivered-To: freebsd-ports@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 8AC1E37B41B for ; Wed, 13 Mar 2002 22:20:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g2E6K1u09884; Wed, 13 Mar 2002 22:20:01 -0800 (PST) (envelope-from gnats) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id C85F237B402 for ; Wed, 13 Mar 2002 22:11:39 -0800 (PST) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g2E6BdK07554; Wed, 13 Mar 2002 22:11:39 -0800 (PST) (envelope-from nobody) Message-Id: <200203140611.g2E6BdK07554@freefall.freebsd.org> Date: Wed, 13 Mar 2002 22:11:39 -0800 (PST) From: Brent Casavant To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: ports/35882: Perl Expect module send_slow hangs on EOF Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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