Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Dec 2001 14:05:04 +0100
From:      Cliff Sarginson <cliff@raggedclown.net>
To:        FreeBSD Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: Modifying only certain bits with chmod
Message-ID:  <20011206130504.GA9605@raggedclown.net>
In-Reply-To: <00bb01c17e52$96093b50$0a00000a@atkielski.com>
References:  <009101c17c12$649fe2e0$0a00000a@atkielski.com> <Pine.GSO.4.31.0112061049360.6883-100000@mail.ilrt.bris.ac.uk> <20011206122233.GB1111@raggedclown.net> <00bb01c17e52$96093b50$0a00000a@atkielski.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Dec 06, 2001 at 01:36:10PM +0100, Anthony Atkielski wrote:
> Cliff writes:
> 
> > And pray nothing else that depends on standard
> > chmod doesn't try to use it.
> 
> The modification is backward-compatible.  All I did was add an optional mask field to the the octal mode field, i.e., you can
> specify "400:600" instead of just "400", meaning "set the owner's read bit and reset the owner's write bit on this file, and leave
> the other bits alone."  Unless a script or something depended on this specific format generating an _error_ message (a very unsafe
> way to write a script), nothing will see the change.
> 
> > If you are going to do this kind of thing you
> > really should not do it in such a way that the
> > "real" system program you are replacing is not
> > somehow called if the caller expects it.
> 
> If the change were not compatible with the "real" command, I would agree.  However, I took care to make sure that this change is
> indeed compatible.  The only way any program could see it would be if it deliberately depended on receiving an error status from
> chmod for the specific error of specifing "xxx:yyy" for the mode, where xxx and yyy are both valid octal numbers.  I consider that
> highly unlikely; hopefully nobody programs that badly.
> 
What is highly unlikely often happens.

> > For example, front-ending "rm" with a safe version
> > which saves the rm'ed files somewhere - a common
> > practise - is one thing.
> 
> Is it?  That sounds far less safe than the change I've made.  A script or program using rm to free disk space would be useless if
> the behavior of the command were changed in that way.  You might see a disk fill in the middle of the night, which wouldn't be fun.
> 
Well, you have obviously never been a system manager.
Such a script (the front end) would be implemented by a System Manager.
The latter would also be under his/her control and he/she would be aware
of how to call the real rm in this case.
Besides which System management practise would dictate you are given
warnings of impending disk space shortage.

> > All a mystery to me, you don't need to be Albert
> > Einstein to learn the symbolic arguments for
> > changing particular modes on a file.
> 
> The symbolic arguments are far less intuitive for me, whereas bitwise operations are easy.
>
There are better ways of doing this than changing system program source
code. 

-- 
Regards
Cliff



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011206130504.GA9605>