duplicity-talk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Duplicity-talk] FTP backend, consecutive ls


From: Olivier Croquette
Subject: [Duplicity-talk] FTP backend, consecutive ls
Date: Wed, 03 Oct 2007 14:17:29 +0200
User-agent: Thunderbird 2.0.0.4 (Macintosh/20070604)

Hi

I have got an incomparability between ncftp and the ftp server of my
provider.
ncftp sends a "NLST -CF" command which is interpreted by the server as
"list the file named -CF".
I have contacted the ncftp developers, who suggest using the -x option of nclftpls.

Anyhow, I have introduced another work-around in duplicity, and while doing that, I have noticed that in
ftpBackend.list(), 2 consecutive listings are requested from the server.

See the part commented with:
"# if long list is not empty, get short list of names only"
in:
<http://cvs.savannah.nongnu.org/viewvc/duplicity/duplicity/backends.py?revision=1.45&root=duplicity&view=markup>


I don't understand why 2 ls are necessary.
The reason given is "# try for a long listing to avoid connection reset"

In my workaround, I just use the results of the long listing .
Indeed I am using the following patch and I have had no problem so far.

This is more a call for comments as a request for inclusion by the way :)

NB: Writing this email, I see that my code has a problem when a file contains a space character, but the topic is still interesting.

--- backends.py.org     2007-09-25 18:49:48.000000000 +0200
+++ backends.py 2007-09-25 22:16:14.000000000 +0200
@@ -542,13 +548,8 @@
                                          (self.flags, self.url_string)
                l = self.popen_persist(commandline).split('\n')
                l = filter(lambda x: x, l)
-               if not l:
-                       return l
-               # if long list is not empty, get short list of names only
-               commandline = "ncftpls %s '%s'" % \
-                                         (self.flags, self.url_string)
-               l = self.popen_persist(commandline).split('\n')
-               return filter(lambda x: x, l)
+
+               # The last item of each line is the file name
+               return map(lambda x: x.split(" ")[-1], l)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]