Skip Menu |

This queue is for tickets about the Expect CPAN distribution.

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

People
Owner: RGiersig [...] cpan.org
Requestors: alex.dupuy [...] mac.com
Cc:
AdminCc:

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



Subject: expect 1.21 interact()/interconnect() bug with EOF "escape" handling
Date: Tue, 27 Apr 2010 17:43:05 -0400
To: bug-Expect [...] rt.cpan.org
From: Alexander Dupuy <alex.dupuy [...] mac.com>
The "special" EOF "escape" is correctly used to handle an EOF. :-) However, it will also match the string "EOF" in bytes read from an expect object. :-( The following patch (also as an attachment to protect from line-wrapping) fixes this problem: --- a/Expect/Expect.pm +++ b/Expect/Expect.pm @@ -1180,6 +1180,7 @@ sub interconnect { $escape_character_buffer = '' unless defined ($escape_character_buffer); $escape_character_buffer .= ${*$read_handle}{exp_Pty_Buffer}; foreach $escape_sequence (keys(%{${*$read_handle}{exp_Function}})) { + next if $escape_sequence eq "EOF"; print STDERR "Tested escape sequence $escape_sequence from ${*$read_handle}{exp_Pty_Handle}"if ${*$read_handle}{"exp_Debug"} > 1; # Make sure it doesn't grow out of bounds. $escape_character_buffer = $read_handle->_trim_length($escape_character_buffer,${*$read_handle}{"exp_Max_Accum"}) if (${*$read_handle}{"exp_Max_Accum"});
diff --git a/Expect/Expect.pm b/Expect/Expect.pm index b42283b..60fb772 100644 --- a/Expect/Expect.pm +++ b/Expect/Expect.pm @@ -1180,6 +1180,7 @@ sub interconnect { $escape_character_buffer = '' unless defined ($escape_character_buffer); $escape_character_buffer .= ${*$read_handle}{exp_Pty_Buffer}; foreach $escape_sequence (keys(%{${*$read_handle}{exp_Function}})) { + next if $escape_sequence eq "EOF"; print STDERR "Tested escape sequence $escape_sequence from ${*$read_handle}{exp_Pty_Handle}"if ${*$read_handle}{"exp_Debug"} > 1; # Make sure it doesn't grow out of bounds. $escape_character_buffer = $read_handle->_trim_length($escape_character_buffer,${*$read_handle}{"exp_Max_Accum"}) if (${*$read_handle}{"exp_Max_Accum"});
Am Di 27. Apr 2010, 17:43:29, alex.dupuy@mac.com schrieb: Show quoted text
> The "special" EOF "escape" is correctly used to handle an EOF. :-) > > However, it will also match the string "EOF" in bytes read from an > expect object. :-( > > The following patch (also as an attachment to protect from > line-wrapping) fixes this problem:
Thanks for telling and also thanks for the patch. But I'm not sure that it does-the-right-thing, what if the user wants to match the string "EOF"? Does this still work? Roland -- RGiersig@cpan.org
Subject: Re: [rt.cpan.org #56990] expect 1.21 interact()/interconnect() bug with EOF "escape" handling
Date: Fri, 21 May 2010 10:06:32 +0000
To: bug-Expect [...] rt.cpan.org
From: "Alexander Dupuy" <alex.dupuy [...] mac.com>
Show quoted text
> what if the user wants to match the string > "EOF"? Does this still work?
As I think I wrote in a comment or documentation in the patch, if you want to match that specific string you may have to use a regex, e.g. "[E]OF" - but given the other issues with multi character escapes I don't think anyone will ever want to anyhow. @alex -- mailto:alex.dupuy@mac.com
Am Fr 21. Mai 2010, 06:07:12, alex.dupuy@mac.com schrieb: Show quoted text
> > what if the user wants to match the string > > "EOF"? Does this still work?
> > As I think I wrote in a comment or documentation in the patch, if you > want to match that specific string you may have to use a regex, > e.g. "[E]OF" - but given the other issues with multi character > escapes I don't think anyone will ever want to anyhow.
OK, I'll put it on the list of patches. Thanks! Roland -- RGiersig@cpan.org