What's up with chown.c doing a chmod?

Rob Landley rob at landley.net
Fri Jan 6 18:18:34 UTC 2006


On Thursday 05 January 2006 14:57, Shaun Jackman wrote:
> Hello Rob,
>
> The chmod call seems unnecessary. I just checked the coreutils
> implementation of chown, and it does not call chmod at any time. I

If coreutils doesn't do it then I doubt we need to...

I just ripped it out.

> found this comment in the source code that suggests a chown can change
> permission bits.

Yeah, it can revert the suid bit.  And we _want_ it to do that, for security 
reasons.

> So perhaps someone was trying to undo that effect, 
> despite this comment's warning. I'd suggest removing the chmod call. I
> don't suppose there's ChangeLog entry or cvs blame entry for the
> offending line?

A while back there was a marvelous feature of the web interface that would 
show you an annotated and color coded version of the file indicating which 
checkin was responsible for the current value of each line of the file.  
Unfortunately, that feature was lost in the move to subversion.

The closest we can get now is "svn log coreutils/chown.c" which shows svn 7425 
from Glenn was "preserve suid/sgid bits".  Which might as well say "disable 
safety feature".  That would be a no.  If you want suid set after chown, 
you're supposed to put it back manually because it now means something 
_different_...

Rob
-- 
Steve Ballmer: Innovation!  Inigo Montoya: You keep using that word.
I do not think it means what you think it means.



More information about the busybox mailing list