On 02/24/2012 11:48 AM, Eric Blake wrote: > chmod 0000$(printf %o $mode) DIR
If this is the suggested use, shouldn't the leading-zero approach require at least *4* leading zeros before the actual octal value? That would remove one of my objections to it, namely, the confusion between "chmod 00755 DIR" (which would clear the setuid bits, if the requirement is 5 or more total digits) and "chmod 0000 DIR" (which would not). > s/@/0000/, and you have your distro-agnostic prefix. Sorry, I don't follow. "chmod 0000755 DIR" will not clear the setuid bits on Solaris, or on some RHEL versions. So no matter what we do, the behavior will not be distro-agnostic. If we want distro-agnostic behavior that solves the problem, we need to start by introducing behavior that will work on our platform but not other platforms, and then hope to convince other platform developers to become compatible. I doubt whether "chmod 0000755 DIR"'s behavior would be standardized by POSIX, because it would invalidate existing implementations. In contrast, "chmod @755 DIR"'s behavior might become part of the standard, if we ask, because it doesn't invalidate existing implementations. So this seems a better way to move forward, if we want the behavior to become portable eventually.