Skip Menu |

This queue is for tickets about the libnet CPAN distribution.

Report information
The Basics
Id: 47557
Status: resolved
Priority: 0/
Queue: libnet

People
Owner: Nobody in particular
Requestors: john [...] j-bg.co.uk
Cc: PHILIPP [...] cpan.org
AdminCc:

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



Subject: BUG in Net::SMTP / Net::Cmd
Date: Sat, 4 Jul 2009 09:39:33 +0100 (BST)
To: bug-libnet [...] rt.cpan.org
From: John Sargent <john [...] j-bg.co.uk>
Consider the code snippet: my $smtp = Net::SMTP->new( $mx, Port => $port, Timeout => 60, Hello => "foo.bar"A, Debug => exists $ENV{DEBUG} ? 1 : 0 ); $smtp->mail($from); $smtp->to($to); $smtp->data(); $smtp->datasend($message); $smtp->dataend(); If I now call $smtp->code() , I get "250" back as expected (assuming the message was delivered ok), but if I call $smtp->message(), I get a text string that includes the text from the data() command as well as the response from the dataend(). That is, the text returned says 'Enter mail, end with "." on a line by itself. Requested mail action okay, completed.' rather than 'Requested mail action okay, completed. ' as I would expect. Perl verson 5.8.5 Net::Cmd version: 2.26 Net::SMTP version: 2.29 O/S Centos 5.1
On Sat Jul 04 04:46:49 2009, john@j-bg.co.uk wrote: Show quoted text
> > Consider the code snippet: > > my $smtp = Net::SMTP->new( > $mx, > Port => $port, > Timeout => 60, > Hello => "foo.bar"A, > Debug => exists $ENV{DEBUG} ? 1 : 0 > ); > $smtp->mail($from); > $smtp->to($to); > $smtp->data(); > $smtp->datasend($message); > $smtp->dataend(); > > > > If I now call $smtp->code() , I get "250" back as expected (assuming the > message was delivered ok), but if I call $smtp->message(), I get a text > string that includes the text from the data() command as well as the > response from the dataend(). That is, the text returned says > > 'Enter mail, end with "." on a line by itself. Requested mail action > okay, completed.' > > rather than > > 'Requested mail action okay, completed. ' > > as I would expect. > > Perl verson 5.8.5 > Net::Cmd version: 2.26 > Net::SMTP version: 2.29 > O/S Centos 5.1 >
I'm also seeing this on CentOS 6.3, Perl 5.10.1-127, Net::SMTP 2.31, Net::Cmd 2.29. From what I can tell, the fix is trivial: --- Cmd.pm.bak 2012-06-22 07:28:26.000000000 -0600 +++ Cmd.pm 2012-10-06 12:03:07.671879659 -0600 @@ -339,7 +339,7 @@ sub response { my $cmd = shift; my ($code, $more) = (undef) x 2; - ${*$cmd}{'net_cmd_resp'} ||= []; + ${*$cmd}{'net_cmd_resp'} = []; while (1) { my $str = $cmd->getline();
This looks like it's the same poblem as reported in more detail on ticket #14875, which includes a patch to fix it. Can anyone confirm whether the #14875 patch fixes the problems being reported here? (That patch actually includes the one-line fix already suggested here, but I would appreciate more testing of the rest of that patch before I consider applying it.)
On Fri Oct 03 04:03:09 2014, SHAY wrote: Show quoted text
> This looks like it's the same poblem as reported in more detail on > ticket #14875, which includes a patch to fix it. > > Can anyone confirm whether the #14875 patch fixes the problems being > reported here? (That patch actually includes the one-line fix already > suggested here, but I would appreciate more testing of the rest of > that patch before I consider applying it.)
I've been using the patch with Perl 5.12, 5.16, and 5.18 in a production environment for 2.5 years. We only use it for SMTP functionality, but it fixes the DATA / . problem effectively.
On Fri Oct 03 12:45:04 2014, PHILIPP wrote: Show quoted text
> On Fri Oct 03 04:03:09 2014, SHAY wrote:
> > This looks like it's the same poblem as reported in more detail on > > ticket #14875, which includes a patch to fix it. > > > > Can anyone confirm whether the #14875 patch fixes the problems being > > reported here? (That patch actually includes the one-line fix already > > suggested here, but I would appreciate more testing of the rest of > > that patch before I consider applying it.)
> > I've been using the patch with Perl 5.12, 5.16, and 5.18 in a > production environment for 2.5 years. > > We only use it for SMTP functionality, but it fixes the DATA / . > problem effectively.
Great! Thanks for the reply. I'm marking this ticket as resolved since it is indeed essentially a duplicate of #14875, which I'm also now resolving by applying the patch on it.