Some permssion fixes:
authorWayne Davison <wayned@samba.org>
Mon, 18 Feb 2008 18:02:35 +0000 (10:02 -0800)
committerWayne Davison <wayned@samba.org>
Mon, 18 Feb 2008 18:20:50 +0000 (10:20 -0800)
 - Changed itemized output to only report 'p' with -p or -E.
 - Fixed a duplicate output of a link-dest file with -vv but no -i.
 - Improved unchanged_attrs() to handle -E.

generator.c

index b22d9d64c08dae8d0cd0bbdc1d1eb7acc9709d4b..eb1301502a5b8590d25bb7ce7c1085dc5f8b2f1e 100644 (file)
@@ -41,6 +41,7 @@ extern int preserve_links;
 extern int preserve_devices;
 extern int preserve_specials;
 extern int preserve_hard_links;
+extern int preserve_executability;
 extern int preserve_perms;
 extern int preserve_times;
 extern int uid_ndx;
@@ -563,6 +564,9 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
        if (preserve_perms && !BITS_EQUAL(sxp->st.st_mode, file->mode, CHMOD_BITS))
                return 0;
 
+       if (preserve_executability && ((sxp->st.st_mode & 0111) != 0) ^ ((file->mode & 0111) != 0))
+               return 0;
+
        if (am_root && uid_ndx && sxp->st.st_uid != (uid_t)F_OWNER(file))
                return 0;
 
@@ -610,7 +614,8 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
                        ;
                } else
 #endif
-               if (!BITS_EQUAL(sxp->st.st_mode, file->mode, CHMOD_BITS))
+               if ((preserve_perms || preserve_executability)
+                && !BITS_EQUAL(sxp->st.st_mode, file->mode, CHMOD_BITS))
                        iflags |= ITEM_REPORT_PERMS;
                if (uid_ndx && am_root && (uid_t)F_OWNER(file) != sxp->st.st_uid)
                        iflags |= ITEM_REPORT_OWNER;
@@ -960,7 +965,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
                                goto try_a_copy;
                        if (preserve_hard_links && F_IS_HLINKED(file))
                                finish_hard_link(file, fname, ndx, &sxp->st, itemizing, code, j);
-                       if (itemizing && (verbose > 1 || stdout_format_has_i > 1)) {
+                       if (!maybe_ATTRS_REPORT && (verbose > 1 || stdout_format_has_i > 1)) {
                                itemize(cmpbuf, file, ndx, 1, sxp,
                                        ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS,
                                        0, "");