lavv17 / lftp

sophisticated command line file transfer program (ftp, http, sftp, fish, torrent)
http://lftp.yar.ru
GNU General Public License v3.0
1.11k stars 162 forks source link

Mirror with Local OS X #221

Open Freshou opened 8 years ago

Freshou commented 8 years ago

i'm currently using lftp to do backup of different WebSite to a Local server Running OS X .

Today i got my first Web Server connecting with SFTP and using UTF8 as filename encoding and i got a Problem...

Every file that got some accent in it are delete and redownloaded every backup...

From what i found, the OS X FileSystem normalize their filename to UTF-8 NFD instead of NFC ...

This Article is probably the most detailed on that problem: http://serverfault.com/questions/397420/converting-utf-8-nfd-filenames-to-utf-8-nfc-in-either-rsync-or-afpd or this get some other information http://stackoverflow.com/questions/6153345/different-utf8-encoding-in-filenames-os-x

I use Rsync when i can and effectively, the --iconv=UTF-8,UTF-8-Mac Works with rsync, but with lftp , if i use "set file:charset utf-8-mac", it doesn't work...

Is it possible To get a Patch for this (i compile the most recent version, so i can apply a patch for this) as i know this context may not be recurrent, si i can patch my own copy...

I don't know how the file:charset work in lftp, do it use the local iconv install with OS X and that know about utf-8-mac or do it use standard iconv ...

Thanx !

lavv17 commented 8 years ago

file:charset is for local files, sftp:charset for the remote (if the sftp protocol version is <= 3). Is the HFS filesystem local or remote?

Freshou commented 8 years ago

I'm not in position to test the sftp version, but I can confirm that if I force encoding to something else than UTF8, filename are incorrect ...

The hfs is the local one !

Envoyé de mon iPhone

Le 24 mars 2016 à 09:22, Alexander V. Lukyanov notifications@github.com a écrit :

file:charset is for local files, sftp:charset for the remote (if the sftp protocol version is <= 3). Is the HFS filesystem local or remote?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub

lavv17 commented 8 years ago

From http://stackoverflow.com/questions/9892897/why-can-iconv-convert-precomposed-form-but-not-decomposed-form-of-%C3%89-from-utf:

Unfortunately iconv indeed doesn't deal with the decomposed characters in UTF-8, except the version installed on Mac OS X.

When dealing with Mac file names, you can use iconv with the "utf8-mac" character set option. It also takes into account a few idiosyncrasies of the Mac decomposed form.

So I think "set file:charset utf8-mac" should change something on MacOS X. lftp converts remote file names to this character set internally.

Freshou commented 8 years ago

i tried with set file:charset utf8-mac and it doesn't work...

Maybe the name comparaison is not the same at every level when using mirror... i Explain...

Actually i use mirror option with this options : mirror --recursion=always --delete-first --verbose

If at every level of comparaison for the option mirror, the comparaison were the same, the file with utf-8 char (but not normalize) would be at first deleted locally and after it would be download again...

But actually, the first time i run the command, the file with utf-8 char are deleted locally, but not re-download... If i run it a second time, it download missing file...

Third time, it delete it...

Fourth, it re-download...

and so on...

So there's somewhere it the mirror process that doesn't do the job correctly anyway... ;)

Freshou commented 8 years ago

Any follow-up on this ?

Freshou commented 8 years ago

Playing with some configuration and formatting my destination HardDrive as Case Sensitive corrected a lot of problem...

I'm still getting some problem, but it's minor... Here's my last log ...

Transferring file IMG/UserFiles/Images/histoireregionale/histoire_dici/Équipe-hockey-CKBS-avec-Lionel-Gaucher-1965-1966-Coll-André-Bourgeois.jpg' mirror: Access failed: No such file (Équipe-hockey-CKBS-avec-Lionel-Gaucher-1965-1966-Coll-André-Bourgeois.jpg) Transferring fileIMG/UserFiles/Images/histoireregionale/histoire_dici/pollution/2-Aqueduc-Centre-dhistoire-Studio-B-J--Hébert-CH085.jpg' mirror: Access failed: No such file (2-Aqueduc-Centre-dhistoire-Studio-B-J--Hébert-CH085.jpg) Making directory IMG/UserFiles/Images/histoireregionale/histoire_dici/sports' Transferring fileIMG/UserFiles/Images/histoireregionale/histoire_dici/sports/Équipe-hockey-CKBS-avec-Lionel-Gaucher-1965-1966-Coll-André-Bourgeois.jpg' mirror: Access failed: No such file (Équipe-hockey-CKBS-avec-Lionel-Gaucher-1965-1966-Coll-André-Bourgeois.jpg)

The file "in problem", i can download them with another FTP/SFTP programs without any problem... But the sync got problem with them...