--- libexpect-perl-1.21.orig/Expect.pm +++ libexpect-perl-1.21/Expect.pm @@ -195,6 +195,7 @@ # All the functions are written for reading from a tty, so if the naming # scheme looks odd, that's why. my ($class) = shift; + $class = ref($class) if ref($class); # so we can be called as $exp->exp_init() my($self) = shift; bless $self, $class; croak "exp_init not passed a file object, stopped" @@ -1395,7 +1396,7 @@ ${*$self}{exp_Exit} = $?; return ${*$self}{exp_Exit}; } - sleep 1; # Keep loop nice. + select undef, undef, undef, 0.01; } # Send it a term if it isn't dead. if (${*$self}{exp_Debug}) { @@ -1416,7 +1417,7 @@ ${*$self}{exp_Exit} = $?; return $?; } - sleep 1; + select undef, undef, undef, 0.01; } # Since this is a 'soft' close, sending it a -9 would be inappropriate. return undef; @@ -1450,7 +1451,7 @@ ${*$self}{exp_Exit} = $?; return ${*$self}{exp_Exit}; } - sleep 1; # Keep loop nice. + select undef, undef, undef, 0.01; } # Send it a term if it isn't dead. if (${*$self}{exp_Debug}) { @@ -1471,7 +1472,7 @@ ${*$self}{exp_Exit} = $?; return ${*$self}{exp_Exit}; } - sleep 1; + select undef, undef, undef, 0.01; } kill KILL => ${*$self}{exp_Pid}; # wait 5 more seconds for it to die. @@ -1488,7 +1489,7 @@ ${*$self}{exp_Exit} = $?; return ${*$self}{exp_Exit}; } - sleep 1; + select undef, undef, undef, 0.01; } warn "Pid ${*$self}{exp_Pid} of ${*$self}{exp_Pty_Handle} is HUNG.\r\n"; ${*$self}{exp_Pid} = undef; @@ -1615,6 +1616,7 @@ sub DESTROY { my $status = $?; # save this as it gets mangled by the terminating spawned children my $self = shift; + my $exit = $?; if (${*$self}{exp_Do_Soft_Close}) { $self->soft_close(); } --- libexpect-perl-1.21.orig/Expect.pod +++ libexpect-perl-1.21/Expect.pod @@ -499,7 +499,7 @@ For a generic way to interconnect processes, take a look at L. -=item Expect::test_handles(@objects) +=item Expect::test_handles($timeout, @objects) Given a set of objects determines which objects' handles have data ready to be read. B who's members are positions in @objects that @@ -650,6 +650,8 @@ =head2 Configurable Package Variables: +=over 4 + =item $Expect::Debug Defaults to 0. Newly created objects have a $object->debug() value @@ -698,6 +700,7 @@ using ^ and $ instead of it matching the beginning and end of the entire expression. I think this is handy. +=back =head1 CONTRIBUTIONS --- libexpect-perl-1.21.orig/debian/changelog +++ libexpect-perl-1.21/debian/changelog @@ -0,0 +1,243 @@ +libexpect-perl (1.21-1) unstable; urgency=low + + * New upstream release (closes: #520580) + * changed perl path in tutorial (closes: #543665) + + -- Jörgen Hägg Sun, 15 Aug 2010 10:18:36 +0200 + +libexpect-perl (1.20-2) unstable; urgency=low + + * bug in manual, found by Ph. Marek. Closes: #441014 + * updated to debian policy 3.8.0 + * fixed pod bug in manual + + -- Joergen Haegg Thu, 27 Nov 2008 21:35:39 +0100 + +libexpect-perl (1.20-1) unstable; urgency=low + + * New upstream release + + -- Joergen Haegg Mon, 29 Jan 2007 21:19:31 +0100 + +libexpect-perl (1.15-5) unstable; urgency=low + + * WINCH example added, IO-Pty is also upgraded to 1.05 so + this should work now + * removed x-flag from examples after complaint from linda. + * added kibitz-example + + -- Joergen Haegg Thu, 13 Jul 2006 09:38:24 +0200 + +libexpect-perl (1.15-4) unstable; urgency=low + + * removed extra Expect.pod. Closes: #354438 + * included patch from Eric Anderson. Patch is sent to upstream. + Closes: #306679 + + -- Joergen Haegg Mon, 27 Feb 2006 20:54:27 +0100 + +libexpect-perl (1.15-3) unstable; urgency=low + + * now installed in /usr/share instead of /usr/lib. Closes: #158279 + * added pointer to the perl license. Closes #157580 + * installs in /usr/share/perl5. Closes #158279 + * added patches from Andrew Suffield. Closes #159449, #160866, #160997 + * updated to Standards-Version: 3.5.8 + + -- Joergen Haegg Wed, 4 Sep 2002 06:48:26 +0200 + +libexpect-perl (1.15-2) unstable; urgency=low + + * spelling error in debian/control fixed. Closes: #124941 + + -- Joergen Haegg Tue, 23 Apr 2002 22:00:23 +0200 + +libexpect-perl (1.15-1) unstable; urgency=low + + * New upstream release + + -- Joergen Haegg Tue, 2 Apr 2002 22:19:03 +0200 + +libexpect-perl (1.11-4) unstable; urgency=low + + * new maintainer address + * updated Standards-Version + * fixed 'author(s)' in copyright + * removed dh_testversion + + -- Joergen Haegg Tue, 25 Sep 2001 06:05:13 +0200 + +libexpect-perl (1.11-3) unstable; urgency=low + + * removed some junk from the end of the changelog file + + -- Joergen Haegg Fri, 7 Sep 2001 22:50:36 +0200 + +libexpect-perl (1.11-2) unstable; urgency=low + + * removed '(1.10)' from the description in the control file + + -- Joergen Haegg Fri, 9 Mar 2001 20:58:39 +0100 + +libexpect-perl (1.11-1) unstable; urgency=low + + * New upstream release + + -- Joergen Haegg Thu, 8 Mar 2001 21:43:29 +0100 + +libexpect-perl (1.10-1) unstable; urgency=low + + * Initial Release. + + -- Joergen Haegg Wed, 25 Nov 2000 05:56:46 +0200 + +libexpect-perl (1.20-1) unstable; urgency=low + + * New upstream release + + -- Joergen Haegg Mon, 29 Jan 2007 21:19:31 +0100 + +libexpect-perl (1.15-5) unstable; urgency=low + + * WINCH example added, IO-Pty is also upgraded to 1.05 so + this should work now + * removed x-flag from examples after complaint from linda. + * added kibitz-example + + -- Joergen Haegg Thu, 13 Jul 2006 09:38:24 +0200 + +libexpect-perl (1.15-4) unstable; urgency=low + + * removed extra Expect.pod. Closes: #354438 + * included patch from Eric Anderson. Patch is sent to upstream. + Closes: #306679 + + -- Joergen Haegg Mon, 27 Feb 2006 20:54:27 +0100 + +libexpect-perl (1.15-3) unstable; urgency=low + + * now installed in /usr/share instead of /usr/lib. Closes: #158279 + * added pointer to the perl license. Closes #157580 + * installs in /usr/share/perl5. Closes #158279 + * added patches from Andrew Suffield. Closes #159449, #160866, #160997 + * updated to Standards-Version: 3.5.8 + + -- Joergen Haegg Wed, 4 Sep 2002 06:48:26 +0200 + +libexpect-perl (1.15-2) unstable; urgency=low + + * spelling error in debian/control fixed. Closes: #124941 + + -- Joergen Haegg Tue, 23 Apr 2002 22:00:23 +0200 + +libexpect-perl (1.15-1) unstable; urgency=low + + * New upstream release + + -- Joergen Haegg Tue, 2 Apr 2002 22:19:03 +0200 + +libexpect-perl (1.11-4) unstable; urgency=low + + * new maintainer address + * updated Standards-Version + * fixed 'author(s)' in copyright + * removed dh_testversion + + -- Joergen Haegg Tue, 25 Sep 2001 06:05:13 +0200 + +libexpect-perl (1.11-3) unstable; urgency=low + + * removed some junk from the end of the changelog file + + -- Joergen Haegg Fri, 7 Sep 2001 22:50:36 +0200 + +libexpect-perl (1.11-2) unstable; urgency=low + + * removed '(1.10)' from the description in the control file + + -- Joergen Haegg Fri, 9 Mar 2001 20:58:39 +0100 + +libexpect-perl (1.11-1) unstable; urgency=low + + * New upstream release + + -- Joergen Haegg Thu, 8 Mar 2001 21:43:29 +0100 + +libexpect-perl (1.10-1) unstable; urgency=low + + * Initial Release. + + -- Joergen Haegg Wed, 25 Nov 2000 05:56:46 +0200 + +libexpect-perl (1.15-5) unstable; urgency=low + + * WINCH example added, IO-Pty is also upgraded to 1.05 so + this should work now + * removed x-flag from examples after complaint from linda. + * added kibitz-example + + -- Joergen Haegg Thu, 13 Jul 2006 09:38:24 +0200 + +libexpect-perl (1.15-4) unstable; urgency=low + + * removed extra Expect.pod. Closes: #354438 + * included patch from Eric Anderson. Patch is sent to upstream. + Closes: #306679 + + -- Joergen Haegg Mon, 27 Feb 2006 20:54:27 +0100 + +libexpect-perl (1.15-3) unstable; urgency=low + + * now installed in /usr/share instead of /usr/lib. Closes: #158279 + * added pointer to the perl license. Closes #157580 + * installs in /usr/share/perl5. Closes #158279 + * added patches from Andrew Suffield. Closes #159449, #160866, #160997 + * updated to Standards-Version: 3.5.8 + + -- Joergen Haegg Wed, 4 Sep 2002 06:48:26 +0200 + +libexpect-perl (1.15-2) unstable; urgency=low + + * spelling error in debian/control fixed. Closes: #124941 + + -- Joergen Haegg Tue, 23 Apr 2002 22:00:23 +0200 + +libexpect-perl (1.15-1) unstable; urgency=low + + * New upstream release + + -- Joergen Haegg Tue, 2 Apr 2002 22:19:03 +0200 + +libexpect-perl (1.11-4) unstable; urgency=low + + * new maintainer address + * updated Standards-Version + * fixed 'author(s)' in copyright + * removed dh_testversion + + -- Joergen Haegg Tue, 25 Sep 2001 06:05:13 +0200 + +libexpect-perl (1.11-3) unstable; urgency=low + + * removed some junk from the end of the changelog file + + -- Joergen Haegg Fri, 7 Sep 2001 22:50:36 +0200 + +libexpect-perl (1.11-2) unstable; urgency=low + + * removed '(1.10)' from the description in the control file + + -- Joergen Haegg Fri, 9 Mar 2001 20:58:39 +0100 + +libexpect-perl (1.11-1) unstable; urgency=low + + * New upstream release + + -- Joergen Haegg Thu, 8 Mar 2001 21:43:29 +0100 + +libexpect-perl (1.10-1) unstable; urgency=low + + * Initial Release. + + -- Joergen Haegg Wed, 25 Nov 2000 05:56:46 +0200 + --- libexpect-perl-1.21.orig/debian/compat +++ libexpect-perl-1.21/debian/compat @@ -0,0 +1 @@ +7 --- libexpect-perl-1.21.orig/debian/control +++ libexpect-perl-1.21/debian/control @@ -0,0 +1,24 @@ +Source: libexpect-perl +Section: perl +Priority: optional +Maintainer: Jörgen Hägg +Build-Depends: debhelper (>> 7) +Standards-Version: 3.9.1 + +Package: libexpect-perl +Architecture: all +Depends: ${perl:Depends}, ${misc:Depends}, libio-stty-perl, libio-pty-perl (>= 1:1.05-1) +Description: Expect.pm - Perl Expect interface + The Expect module is a successor of Comm.pl and a descendent of Chat.pl. It + more closely resembles the Tcl Expect language than its predecessors. It + does not contain any of the networking code found in Comm.pl. I suspect this + would be obsolete anyway given the advent of IO::Socket and external tools + such as netcat. + . + Expect.pm is an attempt to have more of a switch() & case: feel to make + decision processing more fluid. three separate types of debugging have + been implemented to make code production easier. + . + It is now possible to interconnect multiple file handles (and processes) much + like Tcl's expect. An attempt was made to enable all the features of Tcl's + expect without forcing Tcl on the victim programmer :-) . --- libexpect-perl-1.21.orig/debian/copyright +++ libexpect-perl-1.21/debian/copyright @@ -0,0 +1,24 @@ +This package was debianized by Joergen Haegg on +Sat, 25 Nov 2000 05:56:46 +0200. + +It was downloaded from CPAN + +Upstream Authors: Austin Schutz , + Roland Giersig (new module maintainer) RGiersig@cpan.org + + +Copyright: + +Please see README for documentation. This module is copyrighted +as per the usual perl legalese: +Copyright (c) 1997 Austin Schutz. All rights reserved. This program is free +software; you can redistribute it and/or modify it under the same terms as +Perl itself (/usr/share/doc/perl/copyright or +/usr/share/common-licenses/Artistic). + +Don't blame/flame me if you bust your stuff. +Austin Schutz + +expect() interface & functionality enhanced by +Roland Giersig + --- libexpect-perl-1.21.orig/debian/docs +++ libexpect-perl-1.21/debian/docs @@ -0,0 +1 @@ +README --- libexpect-perl-1.21.orig/debian/examples +++ libexpect-perl-1.21/debian/examples @@ -0,0 +1,12 @@ +tutorial/1.A.Intro +tutorial/2.A.ftp +tutorial/2.B.rlogin +tutorial/3.A.debugging +tutorial/4.A.top +tutorial/5.A.top +tutorial/5.B.top +tutorial/6.A.smtp-verify +tutorial/6.B.modem-init +tutorial/README +debian/ssh.pl +examples/kibitz --- libexpect-perl-1.21.orig/debian/rules +++ libexpect-perl-1.21/debian/rules @@ -0,0 +1,63 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# This file is public domain software, originally written by Joey Hess. + +PACKAGE=$(shell dh_listpackages) + +TMP =`pwd`/debian/$(PACKAGE) + + +build: build-stamp +build-stamp: + dh_testdir + + perl Makefile.PL INSTALLDIRS=vendor + $(MAKE) OPTIMIZE="-O2 -g -Wall" + + touch build-stamp + +realclean: clean + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + + [ ! -f Makefile ] || $(MAKE) distclean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_prep + dh_installdirs + + $(MAKE) install DESTDIR=$(TMP) + +# Build architecture-independent files here. +binary-arch: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-indep: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installexamples + dh_installman + dh_installchangelogs Changes +# dh_link +# dh_strip + dh_compress + dh_fixperms +# dh_makeshlibs + dh_installdeb + dh_perl +# dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install --- libexpect-perl-1.21.orig/debian/ssh.pl +++ libexpect-perl-1.21/debian/ssh.pl @@ -0,0 +1,165 @@ +#!/usr/bin/perl +# +# A Simple Terminal Resizing Example +# GPL version 2. See the COPYING file +# +# This script is a simple example of how handle terminal +# window resize events (transmitted via the WINCH signal) +# -- Jeff Carr +# + +if( ! defined $ARGV[0] ) { + print "Usage: ssh.pl \n"; + exit; +} + +my ($host, $username, $password) = @ARGV; + +use Expect; +use IO::Pty; + +my $spawn = new Expect; +$spawn->raw_pty(1); + +# This gets the size of your terminal window +$spawn->slave->clone_winsize_from(\*STDIN); + +my $PROMPT; + +# This function traps WINCH signals and passes them on +sub winch { + my $signame = shift; + my $pid = $spawn->pid; + $shucks++; + print "count $shucks,pid $pid, SIG$signame\n"; + $spawn->slave->clone_winsize_from(\*STDIN); + kill WINCH => $spawn->pid if $spawn->pid; +} +$SIG{WINCH} = \&winch; # best strategy + +$spawn=Expect->spawn("ssh $username\@$host"); +# log everything if you want +# $spawn->log_file("/tmp/autossh.log.$$"); + +my $PROMPT = '[\]\$\>\#]\s$'; +my $ret = $spawn->expect(5, + [ qr/\(yes\/no\)\?\s*$/ => sub { $spawn->send("yes\n"); exp_continue; } ], + [ qr/assword:\s*$/ => sub { $spawn->send("$password\n"); exp_continue; } ], + [ qr/ogin:\s*$/ => sub { $spawn->send("$username\n"); exp_continue; } ], + [ qr/REMOTE HOST IDEN/ => sub { print "FIX: .ssh/known_hosts\n"; exp_continue; } ], + [ qr/$PROMPT/ => sub { $spawn->send("echo Now try window resizing\n"); } ], +); + +# Hand over control +$spawn->interact(); +exit; +#!/usr/bin/perl +# +# A Simple Terminal Resizing Example +# GPL version 2. See the COPYING file +# +# This script is a simple example of how handle terminal +# window resize events (transmitted via the WINCH signal) +# -- Jeff Carr +# + +if( ! defined $ARGV[0] ) { + print "Usage: ssh.pl \n"; + exit; +} + +my ($host, $username, $password) = @ARGV; + +use Expect; +use IO::Pty; + +my $spawn = new Expect; +$spawn->raw_pty(1); + +# This gets the size of your terminal window +$spawn->slave->clone_winsize_from(\*STDIN); + +my $PROMPT; + +# This function traps WINCH signals and passes them on +sub winch { + my $signame = shift; + my $pid = $spawn->pid; + $shucks++; + print "count $shucks,pid $pid, SIG$signame\n"; + $spawn->slave->clone_winsize_from(\*STDIN); + kill WINCH => $spawn->pid if $spawn->pid; +} +$SIG{WINCH} = \&winch; # best strategy + +$spawn=Expect->spawn("ssh $username\@$host"); +# log everything if you want +# $spawn->log_file("/tmp/autossh.log.$$"); + +my $PROMPT = '[\]\$\>\#]\s$'; +my $ret = $spawn->expect(5, + [ qr/\(yes\/no\)\?\s*$/ => sub { $spawn->send("yes\n"); exp_continue; } ], + [ qr/assword:\s*$/ => sub { $spawn->send("$password\n"); exp_continue; } ], + [ qr/ogin:\s*$/ => sub { $spawn->send("$username\n"); exp_continue; } ], + [ qr/REMOTE HOST IDEN/ => sub { print "FIX: .ssh/known_hosts\n"; exp_continue; } ], + [ qr/$PROMPT/ => sub { $spawn->send("echo Now try window resizing\n"); } ], +); + +# Hand over control +$spawn->interact(); +exit; +#!/usr/bin/perl +# +# A Simple Terminal Resizing Example +# GPL version 2. See the COPYING file +# +# This script is a simple example of how handle terminal +# window resize events (transmitted via the WINCH signal) +# -- Jeff Carr +# + +if( ! defined $ARGV[0] ) { + print "Usage: ssh.pl \n"; + exit; +} + +my ($host, $username, $password) = @ARGV; + +use Expect; +use IO::Pty; + +my $spawn = new Expect; +$spawn->raw_pty(1); + +# This gets the size of your terminal window +$spawn->slave->clone_winsize_from(\*STDIN); + +my $PROMPT; + +# This function traps WINCH signals and passes them on +sub winch { + my $signame = shift; + my $pid = $spawn->pid; + $shucks++; + print "count $shucks,pid $pid, SIG$signame\n"; + $spawn->slave->clone_winsize_from(\*STDIN); + kill WINCH => $spawn->pid if $spawn->pid; +} +$SIG{WINCH} = \&winch; # best strategy + +$spawn=Expect->spawn("ssh $username\@$host"); +# log everything if you want +# $spawn->log_file("/tmp/autossh.log.$$"); + +my $PROMPT = '[\]\$\>\#]\s$'; +my $ret = $spawn->expect(5, + [ qr/\(yes\/no\)\?\s*$/ => sub { $spawn->send("yes\n"); exp_continue; } ], + [ qr/assword:\s*$/ => sub { $spawn->send("$password\n"); exp_continue; } ], + [ qr/ogin:\s*$/ => sub { $spawn->send("$username\n"); exp_continue; } ], + [ qr/REMOTE HOST IDEN/ => sub { print "FIX: .ssh/known_hosts\n"; exp_continue; } ], + [ qr/$PROMPT/ => sub { $spawn->send("echo Now try window resizing\n"); } ], +); + +# Hand over control +$spawn->interact(); +exit; --- libexpect-perl-1.21.orig/tutorial/2.A.ftp +++ libexpect-perl-1.21/tutorial/2.A.ftp @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!/usr/bin/perl # This example demonstrates how to spawn an ftp process, have it #log in to a host, and grab a file off the host. This should give you a #general idea of how to spawn processes and talk to them. --- libexpect-perl-1.21.orig/tutorial/2.B.rlogin +++ libexpect-perl-1.21/tutorial/2.B.rlogin @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!/usr/bin/perl # There are three new things in this example. First is the concept #of closing the process, second is the concept of using regular #expressions in match patterns, and third is the concept of grabbing --- libexpect-perl-1.21.orig/tutorial/3.A.debugging +++ libexpect-perl-1.21/tutorial/3.A.debugging @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!/usr/bin/perl # This example demonstrates how to use the debugging features in #expect. They're reasonably straghtforward. # --- libexpect-perl-1.21.orig/tutorial/4.A.top +++ libexpect-perl-1.21/tutorial/4.A.top @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!/usr/bin/perl # This example is a replay of sorts of the rlogin example #before except in this example we turn control of the process back #to the user through use of interact(). @@ -8,7 +8,7 @@ # $Expect::Debug=2; $Expect::Exp_Internal=1; -$RSH='/usr/local/bin/ssh'; +$RSH='/usr/bin/ssh'; $host_to_login_to=shift(@ARGV); --- libexpect-perl-1.21.orig/tutorial/5.A.top +++ libexpect-perl-1.21/tutorial/5.A.top @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!/usr/bin/perl # Here we are doing this again only this time we'll do it #without Echoing the password. --- libexpect-perl-1.21.orig/tutorial/5.B.top +++ libexpect-perl-1.21/tutorial/5.B.top @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!/usr/bin/perl # Here we set manual_stty on the process so we can do things like #hit ^Z to stop it instead of the ^Z going to the process on the other machine. # This is to say, normally when you interact with a process STDIN is