Hi, rsync:
I am a newbie of rsync and I am very interest in it. I have two
questions here:
1. I want to use rsync to synchronize files between two machines,
one is SuSE Linux Enterprise Desktop 10 and another is RedHat
9(synchonize files from SuSE --> RedHat, using ssh). And I found that
rsync cannot deal with some files with chinese filename. Is this an
encode problem(I know that SuSE uses UTF-8 but I don't know the encoding
method of RedHat)? What can I do to let rsync recognizes these files
correctly? Here is the version info of my rsync:
=========================================================================================================rsync
version 2.6.6 protocol version 29
Copyright (C) 1996-2005 by Andrew Tridgell and others
<http://rsync.samba.org/>
Capabilities: 64-bit files, socketpairs, hard links, ACLs, symlinks,
batchfiles,
inplace, IPv6, 64-bit system inums, 64-bit internal inums,
SLP
rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. See the GNU
General Public Licence for details.
=========================================================================================================
2. I am very interest in rsync and want to read the source codes.
Who can tell me where can I get started? Any suggestion is greatly
appreciated.
Eric Zhang
2006-11-29
Eric Zhang wrote:> 1. I want to use rsync to synchronize files between two machines, > one is SuSE Linux Enterprise Desktop 10 and another is RedHat > 9(synchonize files from SuSE --> RedHat, using ssh). And I found that > rsync cannot deal with some files with chinese filename. Is this an > encode problem(I know that SuSE uses UTF-8 but I don't know the encoding > method of RedHat)? What can I do to let rsync recognizes these files > correctly? Here is the version info of my rsync: [2.6.6 + ACLs]Do you get an error message, or do filenames just appear incorrectly on the destination? To rsync, a source filename is just a sequence of bytes, and it creates a file named by the same sequence of bytes on the destination. If the terminal on the destination machine displays the filenames using a different encoding, you get funny characters. To get rsync to change the filename bytes so they represent the same characters in the destination encoding, you need a special version of rsync that includes the experimental patch iconv.diff, which is available here: http://www.opencoder.net/iconv.diff For more information, read the top of the patch or try: http://www.google.com/search?q=rsync+iconv+site%3Asamba.org> 2. I am very interest in rsync and want to read the source codes. > Who can tell me where can I get started? Any suggestion is greatly > appreciated.Start with "How Rsync Works": http://rsync.samba.org/how-rsync-works.html Then pick the part of rsync that interests you the most (sender, receiver, generator, file-list building, etc.) and start reading from the appropriate entry point (send_files in sender.c, recv_files in receiver.c, recv_generator in generator.c, send_file_list in flist.c, etc). Rsync's code is packed with annoying special cases; on first reading, try to skip over them and focus on the most important steps and subroutine calls. You might find it helpful to do a simple run of rsync at -vvv verbosity (or even higher) and match up the messages it outputs with the code. Matt
Hi, Matt:
Thank you very much. Your suggestions help me a great deal.
About the first question, I have tested again and found that rsync
works very well. Last time I thought rsync cannot deal with the chinese
files because I use another encoding method to list these files so that
every file displayed "incorrect" filename. When I use UTF-8 to list
these files, all files display well. It really works, thanks.
About the second question, I will begin researching rsync's source
code according to your suggestions. Yeah, I am really interesting in
file-list building and generator sections.
Thanks again.
Regards
Eric Zhang
2006-11-30