compare st_mode & 07777, or Aix dirs always differ
Roderick Schertler
roderick at argon.org
Sat Feb 8 03:15:57 EST 2003
Under Aix directories have the mode 024xxxx instead of the customary
04xxxx. Because of this when you sync a directory to or from an Aix
system it's never up to date.
Here is a patch which fixes this. It causes rsync to look at only the
bits that chmod actually influences, 07777, when deciding whether or not
the modes differ.
I was surprised there wasn't an existing constant for 07777, but I
couldn't find one. I thought then to exclude the S_IFMT bits, but on
Aix that has the usual value of 0170000, so it wouldn't exclude the
problematic 0200000 bit.
diff -r -X /home/roderick/.diff-exclude -u rsync-2.5.5/rsync.c rsync/rsync.c
--- rsync-2.5.5/rsync.c Thu Dec 20 10:33:13 2001
+++ rsync/rsync.c Fri Feb 7 10:12:50 2003
@@ -203,7 +203,7 @@
#ifdef HAVE_CHMOD
if (!S_ISLNK(st->st_mode)) {
- if (st->st_mode != file->mode) {
+ if ((st->st_mode & CHMOD_BITS) != (file->mode & CHMOD_BITS)) {
updated = 1;
if (do_chmod(fname,file->mode) != 0) {
rprintf(FERROR,"failed to set permissions on %s : %s\n",
diff -r -X /home/roderick/.diff-exclude -u rsync-2.5.5/rsync.h rsync/rsync.h
--- rsync-2.5.5/rsync.h Mon Mar 25 02:29:43 2002
+++ rsync/rsync.h Fri Feb 7 10:02:09 2003
@@ -488,9 +488,53 @@
#define STDERR_FILENO 2
#endif
+#ifndef S_ISUID
+#define S_ISUID 04000
+#endif
+#ifndef S_ISGID
+#define S_ISGID 02000
+#endif
+#ifndef S_ISVTX
+#define S_ISVTX 01000
+#endif
+#ifndef S_IRWXU
+#define S_IRWXU 00700
+#endif
+#ifndef S_IRUSR
+#define S_IRUSR 00400
+#endif
#ifndef S_IWUSR
-#define S_IWUSR 0200
+#define S_IWUSR 00200
+#endif
+#ifndef S_IXUSR
+#define S_IXUSR 00100
+#endif
+#ifndef S_IRWXG
+#define S_IRWXG 00070
+#endif
+#ifndef S_IRGRP
+#define S_IRGRP 00040
+#endif
+#ifndef S_IWGRP
+#define S_IWGRP 00020
+#endif
+#ifndef S_IXGRP
+#define S_IXGRP 00010
+#endif
+#ifndef S_IRWXO
+#define S_IRWXO 00007
+#endif
+#ifndef S_IROTH
+#define S_IROTH 00004
+#endif
+#ifndef S_IWOTH
+#define S_IWOTH 00002
+#endif
+#ifndef S_IXOTH
+#define S_IXOTH 00001
#endif
+
+#define CHMOD_BITS (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
#ifndef _S_IFMT
#define _S_IFMT 0170000
--
Roderick Schertler
roderick at argon.org
More information about the rsync
mailing list