directories not correctly recognized rsync-3.0.4

Wayne Davison wayned at
Tue Sep 9 13:49:38 GMT 2008

On Tue, Sep 09, 2008 at 01:08:57PM +0200, Jan Thielmann wrote:
> #[sender] i=0 /u/prak28 dir1 mode=0755 len=288 uid=3007030 gid=0 flags=5

That mode is totally bogus.  For dir1 to be a dir, it should have mode
040775.  If it were a regular file, it should have mode 010775.  So, you
should investigate if stat() is returning just 0755 in st_mode, or if
the value is unusually large (and thus, truncated).  One way to get an
inkling should be to run:

perl -e 'printf "0%o\n", (stat("dir1"))[2]'

However, to really know what rsync is getting, you'd be better of either
running rsync under a debugger, or adding an fprintf() into link_stat():

--- flist.c
+++ flist.c
@@ -224,6 +224,7 @@ int link_stat(const char *path, STRUCT_STAT *stp, int follow_dirlinks)
 		return x_stat(path, stp, NULL);
 	if (x_lstat(path, stp, NULL) < 0)
 		return -1;
+	fprintf(stderr, "0%o\t%s\n", stp->st_mode, path); 
 	if (follow_dirlinks && S_ISLNK(stp->st_mode)) {
 		if (x_stat(path, &st, NULL) == 0 && S_ISDIR(st.st_mode))


More information about the rsync mailing list