Two rsync questions

Matt McCutchen hashproduct+rsync at gmail.com
Wed Nov 29 21:28:32 GMT 2006


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



More information about the rsync mailing list