Re: Problem parsing list output : no automatic mirror nor browse is possible

"Alexander V. Lukyanov" <[email protected]> Fri, 12 May 2017 11:58:37 +0300
Newsgroups gmane.network.lftp.user
Message-ID <20170512085837.GA86032@lav-w>
--LZvS9be/3tNcYl/X
Content-Type: text/plain; charset=windows-1251
Content-Disposition: inline
Content-Transfer-Encoding: 8bit

Please try commit 4a68c00e773eca3efa12f1c2cd0c91ecb088e600 or the patch in
attachment.

--
   Alexander.


On Thu, May 11, 2017 at 05:03:18PM +0000, Alexander Lukyanov wrote:
> I'll add a workaround. Thanks for the report!
>
> ÷ò, 11 ìàÿ 2017, 19:58 Franck Eyraud <[email protected]>:
>
> > Hello,
> >
> > I have the problem with a FTP server, mirroring is not taking into account
> > any folder for recursion. I think I noticed why: when running ls command,
> > all folders are suffixed with a slash, this doesn't happen on other FTP
> > servers I tried. It seems that this cause lftp to completely ignore them.
> >
> >
> > dr-x------   3 user group            0 May 11 16:33 folder1/
> > dr-x------   3 user group            0 May 11 16:33 folder2/
> > dr-x------   3 user group            0 May 11 16:33 folder3/
> > dr-x------   3 user group            0 May 11 16:33 folder4/
> >
> > cls command return an empty list, du gives output "./ 0", as if no folder
> > where present there.
> >
> > The debug .mplist command gives :
> >
> > Size=4096;Modify=20170511162938.894;Type=dir;Perm=el; folder1/
> > Size=4096;Modify=20170511162938.894;Type=dir;Perm=el; folder2/
> > Size=4096;Modify=20170511162938.894;Type=dir;Perm=el; folder3/
> > Size=4096;Modify=20170511162938.894;Type=dir;Perm=el; folder4/
> >
> > I tried to look for some parameter, for instance use-msld or list-options
> > (but what option to provide), but it doesn't change.
> >
> > Manually changing directory with cd, and mirroring files work correctly.
> >
> > I can understand that the FTP server is buggy, but is there a way to work
> > around that ?  Of course, I have no control over the server, that would be
> > too easy, I have to deal with this, and download data from there...
> >
> > Thank you !
> >
> > Franck

--LZvS9be/3tNcYl/X
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="lftp-ftp-slash.patch"

commit 4a68c00e773eca3efa12f1c2cd0c91ecb088e600
Author: Alexander V. Lukyanov <[email protected]>
Date:   Fri May 12 11:28:46 2017 +0300

    FtpListInfo.cc: chomp the trailing slash (workaround for some servers)

diff --git a/src/FtpListInfo.cc b/src/FtpListInfo.cc
index c7c963e..2840197 100644
--- a/src/FtpListInfo.cc
+++ b/src/FtpListInfo.cc
@@ -106,6 +106,8 @@ FileSet *Ftp::ParseLongList(const char *buf,int len,int *err_ret) const
 	 {
 	    tmp_line.set(line);	 // parser can clobber the line - work on a copy
 	    FileInfo *info=(*line_parsers[i])(tmp_line.get_non_const(),&err[i],tz);
+	    if(info && info->name.length()>1)
+	       info->name.chomp('/');
 	    if(info && !strchr(info->name,'/'))
 	       set[i]->Add(info);
 	    else
@@ -129,6 +131,8 @@ FileSet *Ftp::ParseLongList(const char *buf,int len,int *err_ret) const
       else
       {
 	 FileInfo *info=(*guessed_parser)(line.get_non_const(),the_err,tz);
+	 if(info && info->name.length()>1)
+	    info->name.chomp('/');
 	 if(info && !strchr(info->name,'/'))
 	    (*the_set)->Add(info);
 	 else

--LZvS9be/3tNcYl/X
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
lftp mailing list
[email protected]
http://univ.uniyar.ac.ru/mailman/listinfo/lftp

--LZvS9be/3tNcYl/X--