couple of minor fixes to rsync 2.5.5

Chupriyanov Eugene eric at rbc.ru
Wed Jul 24 02:33:02 EST 2002


Dear friends!

I really appriciate the great job you did on rsync package and hope for its
further improvement and development. It works great in our pretty complex
environment and helps us a lot in our daily duties.

But we've run into couple of small inconveniences.

First one:
We use rsyncd to propagate a tree of html files among several web-servers.
That files are generated on the fly and updated every few minutes.

Here is relevant part of rsyncd.conf:
[sync-include]
    path=/usr/local/www/rbc/win/include
    exclude=*tmp
    use chroot=false
    max connections=2
    read only=true
    list=false
    uid=rbcmaint
    gid=www-all

(Note the exlude line)

Nevertheless I was getting errors like this:

readlink .../include/cnews.html.tmp: No such file or directory
rsync error: partial transfer (code 23) at main.c(578)

I'm not sure I fixed it clean, but I get rid of that errors by patching
flist.c. Here is the diff:

--- flist.c.orig        Mon Jul  8 17:48:12 2002
+++ flist.c     Mon Jul  8 17:48:39 2002
@@ -644,7 +644,7 @@

        if (readlink_stat(fname, &st, linkbuf) != 0) {
                int save_errno = errno;
-               if ((errno == ENOENT) && copy_links && !noexcludes) {
+               if ((errno == ENOENT) && !noexcludes) {
                        /* symlink pointing nowhere, see if excluded */
                        memset((char *) &st, 0, sizeof(st));
                        if (check_exclude_file(f, fname, &st)) {

The second problem appears when we need that target files always have
correct permissions - we do some testing on them and we receive errors, when
file already copied and renamed from tempfile, but permission are not yet
set. So I fixed it with following diff:

--- rsync.c.orig        Fri Jul 19 13:37:25 2002
+++ rsync.c     Fri Jul 19 13:36:42 2002
@@ -236,13 +236,15 @@
 {
        if (make_backups && !make_backup(fname))
                return;
+       /* eric: set permisions before moving file */
+       set_perms(fnametmp, file, NULL, 0);

        /* move tmp file over real file */
        if (robust_rename(fnametmp,fname) != 0) {
                if (errno == EXDEV) {
                        /* rename failed on cross-filesystem link.
                           Copy the file instead. */
-                       if (copy_file(fnametmp,fname, file->mode &
INITACCESSPERMS)) {
+                       if (copy_file(fnametmp,fname, file->mode)) {
                                rprintf(FERROR,"copy %s -> %s : %s\n",
                                        fnametmp,fname,strerror(errno));
                        } else {

I hope these modifications don't break things apart. :)
Thanks for your attention.

----
Eugene V. Chupriyanov
RosBusinessConsulting NOC
mail to: eric at rbc.ru





More information about the rsync mailing list