compare st_mode & 07777, or Aix dirs always differ

jw schultz jw at
Sat Feb 8 03:59:19 EST 2003

On Fri, Feb 07, 2003 at 11:15:57AM -0500, Roderick Schertler wrote:
> 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.

First, a tecnical note:

Instead of all those ifndef,define,endif lines with
literals just so you can OR them, cut to the quick with

	#ifndef ALLPERMS
	#define ALLPERMS 07777

ALLPERMS is a BSDism that even shows up in the linux headers.

Since POSIX and SUSv3 specify that the actual mode_t
bits are implementation specific I'm just a trifle leery of
adding this in.  We support some rather strange systems
although ACCESSPERMS and INITACCESSPERMS don't appear to
have bitten us so far.  My paranoid side says that the
actual value should be set in configure and default to ~0.

My pragmatic side says so what, we wind up updating the
mtime on directories anyway and it is no more data crossing
the wire.

There you have it.
Sans simplification: -1
With simplification: +0.5

	J.W. Schultz            Pegasystems Technologies
	email address:		jw at

		Remember Cernan and Schmitt

More information about the rsync mailing list