Hi Alexander,

I've updated lftp from (very old) 3.5.6 to the latest 3.7.13
on my FreeBSD box, and found that sftp directory listing
does't work correctly if sftp:charset is set.

  *correct*
  lftp > set sftp:charset
  lftp > ls
  drwx------  1 0    0    0 Jab  8 14:15 ./
  drwx------  1 0    0    0 Apr 30 14:24 ../
  ....

  *wrong* no file listing :-<
  lftp > set sftp:charset euc-jp (or other charset..)
  lftp > ls
  lftp >


I followed ChangeLog and diffs between each previous release.
lftp-3.7.4 works well, however, lftp-3.7.5 and above don't work.
lftp-3.7.5 includes SFtp.cc changes of

 http://www.mail-archive.com/[email protected]/msg03315.html.


In the following SFtp::MakeFileInfo() code in SFtp.cpp:

FileInfo *SFtp::MakeFileInfo(const NameAttrs *na)
{
   const FileAttrs *a=&na->attrs;
   const char *name=utf8_to_lc(na->name);
   const char *longname=utf8_to_lc(na->longname);

   
LogNote(10,"NameAttrs(name=\"%s\",type=%d,longname=\"%s\")\n",name?name:"",a->type,longname?longname:"");

   if(!name || !name[0])
      return 0;
   if(strchr(name,'/'))
      return 0;
   if(name[0]=='~')
      name=dir_file(".",name);
   Ref<FileInfo> fi(new FileInfo(name));


I think, utf8_to_lc(na->longname) call can replace "name" content
before copying by "new FileInfo(name)".
Locating utf8_to_lc(na->longname) at just after "new FileInfo(name)"
corrects the sftp:charset file listing problem.

Could this be a bug in lftp?

Regards,
--Naofumi

-- 
Naofumi Yasufuku (安福 尚文)

E-mail: [email protected]
        [email protected]

"The best way to predict the future is to invent it."
-- Alan Kay

Reply via email to