rsync and broken symlinks

Wayne Davison wayned at samba.org
Thu Dec 16 17:38:05 GMT 2004


On Thu, Dec 16, 2004 at 08:20:00PM +0300, Dmitry V. Levin wrote:
> I see, it happens due to the patched loadparam.c; I'll change that back.

OK -- I'm glad the cause is resolved.

As for the fix, one could argue that "ignore nonreadable" has a bug in
it when dealing with symlinks -- if readlink() worked, the symlink was
readable, so there is no need to call access() on it.  The appended
patch changes this so that rsync doesn't ever use access() on a symlink.
Comments or disagreement?

..wayne..
-------------- next part --------------
--- flist.c	21 Sep 2004 09:24:02 -0000	1.238
+++ flist.c	16 Dec 2004 17:32:34 -0000
@@ -819,8 +819,13 @@ struct file_struct *make_file(char *fnam
 	if (check_exclude_file(thisname, S_ISDIR(st.st_mode) != 0, exclude_level))
 		return NULL;
 
-	if (lp_ignore_nonreadable(module_id) && access(thisname, R_OK) != 0)
-		return NULL;
+	if (lp_ignore_nonreadable(module_id)) {
+#if SUPPORT_LINKS
+		if (!S_ISLNK(st.st_mode))
+#endif
+			if (access(thisname, R_OK) != 0)
+				return NULL;
+	}
 
 skip_excludes:
 


More information about the rsync mailing list