Subject: | Net::FTP newline strangeness |
Hi,
Have been migrating a perl script which has been using the Net::FTP
module for to a new server. It has been working nicely, but the new
server has a newer version of the Net::FTP module, which seems to be
generating an error.
This may or may not be the same issue as bug 35643, but I wasn't sure,
so am starting a new one. Apologies if it is.
When a text file is ftped from the local linux machine, to a remote
windows machine, some of the line endings are confused. Single newlines
come through without any trouble, but where there are multiple newlines
together, some are deleted, and some show sets of 3 'rectangle'
characters. Sorry I don't know exactly what these characters are, or
what the pattern is. I've attached an example file, and also imitated it
with '[]' below.
-----------------------------------------------
this file
contains
really not that much (1 blank lines)[][][]
oh well (2 blank lines)[][][]
some line breaks
are good. (3 blank lines)[][][]
[][][]
not goo. (4 blank lines)[][][]
[][][]
The end.(2 more blank lines)[][][]
-----------------------------------------------
(Where '3 blank lines means', the nexts three lines are blank - 4 '\n').
Have tried this with a few different versions, same script/file/servers.
Affects:
libnet-1.22
libnet-1.21
libnet-1.20
Does not affect:
libnet-1.18
libnet-1.19
Running Redhat linux.
Running perl v5.8.8 built for x86_64-linux-thread-multi
Code which generates the error:
my $ftp = Net::FTP->new($ftp_host) or die("Could not
connect $ftp_host");
$ftp->debug(1); ## debugging
$ftp->login($ftp_username, $ftp_password) or die("Could not log
in to ftp : ".$ftp->message);
$ftp->cwd($remote_dir) or die("Could not
change directory :".$ftp->message);
$ftp->ascii();
$ftp->put("$file") or warn("Could
not put file:".$ftp->message);
$ftp->quit();
The debugging output:
Net::FTP>>> Net::FTP(2.77)
Net::FTP>>> Exporter(5.58)
Net::FTP>>> Net::Cmd(2.29)
Net::FTP>>> IO::Socket::INET(1.29)
Net::FTP>>> IO::Socket(1.29)
Net::FTP>>> IO::Handle(1.25)
Net::FTP=GLOB(0xa076d40)>>> USER someuser
Net::FTP=GLOB(0xa076d40)<<< 331 Password required for someuser.
Net::FTP=GLOB(0xa076d40)>>> PASS ....
Net::FTP=GLOB(0xa076d40)<<< 230 User someuser logged in.
Net::FTP=GLOB(0xa076d40)>>> CWD test
Net::FTP=GLOB(0xa076d40)<<< 250 CWD command successful.
Net::FTP=GLOB(0xa076d40)>>> TYPE A
Net::FTP=GLOB(0xa076d40)<<< 200 Type set to A.
Net::FTP=GLOB(0xa076d40)>>> ALLO 160
Net::FTP=GLOB(0xa076d40)<<< 200 ALLO command successful.
Net::FTP=GLOB(0xa076d40)>>> PASV
Net::FTP=GLOB(0xa076d40)<<< 227 Entering Passive Mode (ip address stuff).
Net::FTP=GLOB(0xa076d40)>>> STOR filewithstuff.txt
Net::FTP=GLOB(0xa076d40)<<< 125 Data connection already open; Transfer
starting.
Net::FTP=GLOB(0xa076d40)<<< 226 Transfer complete.
Net::FTP=GLOB(0xa076d40)>>> QUIT
Net::FTP=GLOB(0xa076d40)<<< 221
And thanks for the module, and all the work on it :) For the moment, we
are just using the older version 1.19.
Thanks!
Subject: | filewithstuff.txt |
this file
contains
really not that much (1 blank lines)
oh well (2 blank lines)
some line breaks
are good. (3 blank lines)
not goo. (4 blank lines)
The end.(2 more blank lines)