bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: chmod 0755 behaves like chmod 755


From: Paul Eggert
Subject: Re: chmod 0755 behaves like chmod 755
Date: Thu, 04 Oct 2007 09:55:32 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Mike Frysinger <address@hidden> writes:

> POSIX is clear on the behavior with files, but 
> says that it's up to specific implementations how they behave on 
> directories

You're quite right.  Sorry, I should have been clearer that the issue
is about behavior with directories, not files.

> yes, POSIX allows this, but it's hard to swallow the "leading zeros are 
> irrelevant" logic when it gets qualified according to POSIX and becomes "when 
> working on a file, leading zeros are significant, but when working on 
> anything else, leading zeros are insignificant"

I agree that it's a messy area, but the POSIX wording is not about
leading zeros, it's about behavior.  That is, as far as POSIX is
concerned, "chmod 755 dir" and "chmod 0755 dir" are both allowed to
clear the setgid bit, and they're both allowed to leave the setgid bit
alone.  On some implementations, the former leaves the setgid bit
alone and the latter clears it; POSIX allows this.  With GNU chmod,
both commands leave the setgid bit alone; POSIX allows this as well.
I believe that on some implementatiions, both commands clear the bit;
POSIX allows this too.  Sorry, but there is no consensus here, and
portable scripts have to take this into account.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]