Subject: | Removes Last Character of Each Line |
Date: | Sun, 18 Feb 2007 06:20:28 -0500 |
To: | <bug-libnet [...] rt.cpan.org> |
From: | Tom Rouillard <tom [...] justtom.com> |
Hello Graham,
System information:
Perl: v5.8.6 built for x86_64-linux-thread-multi
OS: Red Hat Linux Fedora Core 4 (2.6.12-1.1447_FC4smp)
Net::FTP::A version 99 required--this is only version 1.17 at -e line 1.
Upgraded from 2.75 to 2.77 two days ago.
When using Net::FTP 2.77 to transfer ascii files that previously transferred
fine under 2.75, we are seeing that the last character on every line is
chopped.
Our line endings are Unix newlines "\n" on all ascii files.
There are no error messages or warnings. The FTP goes through OK, but the
file is transformed along the way.
Using the diff tool on CPAN I see that this change was made in A.pm:
- my $nr = (my $tmp = substr($buf,0,$size)) =~ tr/\r\n/\015\012/;
- $tmp =~ s/[^\015]\012/\015\012/sg if $nr;
- $tmp =~ s/^\012/\015\012/ unless ${*$data}{'net_ftp_outcr'};
- ${*$data}{'net_ftp_outcr'} = substr($tmp,-1) eq "\015";
+ (my $tmp = substr($buf,0,$size)) =~ s/\r?\n/\015\012/sg;
Here is the output of a file transferred using Net::FTP 2.77. As you can
see, the last character of every line was removed. The receiving server is
using ProFTPD 1.2.1 Server. I've also tested this by sending it to a Mac OS
X server with the same results.
This is a test. I will count from 100 to 110 ..
10
10
10
10
10
10
10
10
10
10
11
Here is the code that sent it:
#!/usr/bin/perl -w
use strict;
use Net::FTP;
my $file = $ARGV[0];
my $host = "xxx.xxxxx.xxx";
my $user = "xxxx";
my $pass = "xxxxxxxxx";
my $ftp = Net::FTP->new($host, Passive => 1, Debug => 1);
$ftp->login($user, $pass);
$ftp->ascii();
$ftp->put( $file);
$ftp->quit();
exit;
Regards,
Tom