Package: libexpect-perl
Version: 1.15-3
Severity: normal
Tags: patch

If you call $expect->send_slow() when the sub-process has exited, or
is exiting, it will go into an infinite loop printing out the last
output recieved.  The patch below fixes this problem.  Will you
forward it on to upstream, or should I do that?
        -Eric

diff -c -r libexpect-perl-1.15-orig/Expect.pm libexpect-perl-1.15/Expect.pm
*** libexpect-perl-1.15-orig/Expect.pm  Wed Apr 27 09:13:08 2005
--- libexpect-perl-1.15/Expect.pm       Wed Apr 27 09:14:45 2005
***************
*** 1256,1262 ****
        # .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);
          # Is this necessary to keep? Probably.. #
          # if you need to expect it later.
          ${*$self}{exp_Accum}.= ${*$self}{exp_Pty_Buffer};
--- 1256,1263 ----
        # .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)) {
!         my $amt = sysread($self,${*$self}{exp_Pty_Buffer},1024);
!         last unless defined $amt && $amt > 0; # subprocess went away
          # Is this necessary to keep? Probably.. #
          # if you need to expect it later.
          ${*$self}{exp_Accum}.= ${*$self}{exp_Pty_Buffer};

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (992, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.4.28
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages libexpect-perl depends on:
ii  libio-pty-perl                1:1.02-2   Perl module for pseudo tty IO
ii  libio-stty-perl               0.02-7     Interface to secure pseudo ttys
ii  perl                          5.8.4-8    Larry Wall's Practical Extraction 

-- no debconf information
diff -c -r libexpect-perl-1.15-orig/Expect.pm libexpect-perl-1.15/Expect.pm
*** libexpect-perl-1.15-orig/Expect.pm  Wed Apr 27 09:13:08 2005
--- libexpect-perl-1.15/Expect.pm       Wed Apr 27 09:14:45 2005
***************
*** 1256,1262 ****
        # .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);
          # Is this necessary to keep? Probably.. #
          # if you need to expect it later.
          ${*$self}{exp_Accum}.= ${*$self}{exp_Pty_Buffer};
--- 1256,1263 ----
        # .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)) {
!         my $amt = sysread($self,${*$self}{exp_Pty_Buffer},1024);
!         last unless defined $amt && $amt > 0; # subprocess went away
          # Is this necessary to keep? Probably.. #
          # if you need to expect it later.
          ${*$self}{exp_Accum}.= ${*$self}{exp_Pty_Buffer};

Reply via email to