Subject: | Bug #41642 - Newline strangeness - solution/patch |
Date: | Sun, 10 Oct 2010 15:22:15 +0200 |
To: | <bug-libnet [...] rt.cpan.org> |
From: | "Monsuwé, Willem" <W.Monsuwe [...] stater.nl> |
Hello,
I have encountered a bug in Net::FTP, where blank lines are mangled when sent from a windows machine with ASCII transfer mode.
This is the same as bug #41642, as far as I can tell, so I'm marking it with that bug number.
As it turns out this problem is caused by the following line in Net::FTP::A.pm (line #80)
$tmp =~ s/([^\015])\012/$1\015\012/sg if $nr;
The capturing parens apparently capture the first \012 in a set of two consecutive ones, and the substitution therefore doesn't see it.
The fix is to turn it into a negative lookbehind assertion, as so:
$tmp =~ s/(?<!\015)\012/\015\012/sg if $nr;
This changed has fixed the issue for me.
A patch has been attached with this fix.
Regards,
Willem Monsuwe,
Software engineer - Stater BV
*****************************************************
This e-mail message and any files transmitted with it are confidential
and intended exclusively for the addressee(s). No rights on Stater N.V.
and/or any of its subsidiaries can be derived from this e-mail
message. On services rendered by Stater N.V. and/or any of its
subsidiaries, the general conditions as filed with the district court
of Amsterdam, no. 112/2009, apply.
Stater N.V. Number chamber of commerce: 32073618.
This footnote also confirms that this e-mail message has been swept
by Ironport for the presence of computer viruses.
*****************************************************
Message body is not shown because sender requested not to inline it.