[Bug 10494] remove-source-files fails with symlinks

samba-bugs at samba.org samba-bugs at samba.org
Thu Mar 14 15:29:57 UTC 2019


--- Comment #2 from Adrian Torregrosa <adrian.torregrosa.ext at nokia.com> ---
We have found this same problem using rsync 3.1.2.

I have downloaded the source code for version 3.1.3, and found the following
lines in sender.c:

146         if (S_ISREG(file->mode) /* Symlinks & devices don't need this
check: */
147          && (st.st_size != F_LENGTH(file) || st.st_mtime != file->modtime
148 #ifdef ST_MTIME_NSEC
149          || (NSEC_BUMP(file) && (uint32)st.ST_MTIME_NSEC !=
150 #endif
151         )) {
152                 rprintf(FERROR_XFER, "ERROR: Skipping sender remove for
changed file: %s\n", fname);
153                 return;
154         }

I added some debugging info, compiled and tested, and found out that when
trying to retrieve symlinks the "file" pointer refers to the hard file, whereas
the "st" register refers to the symlink. Therefore "S_ISREG(file->mode)" will
be true, so will be "st.st_size != F_LENGTH(file)" and most likely "st.st_mtime
!= file->modtime" too. As a result the error gets printed and the symlink is
not deleted, as intended.

I have tried modifying the first condition and it worked as expected:
146         if (S_ISREG(st.st_mode) /* Symlinks & devices don't need this
check: */

Best regards.

You are receiving this mail because:
You are the QA Contact for the bug.

More information about the rsync mailing list