Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Oct 1997 08:54:20 +0100 (CET)
From:      Andre Albsmeier <Andre.Albsmeier@mchp.siemens.de>
To:        dwhite@resnet.uoregon.edu
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Why is "chown -h -R" forbidden?
Message-ID:  <199710270754.IAA00631@curry.mchp.siemens.de>
In-Reply-To: <Pine.BSF.3.96.971026234216.12269V-100000@gdi.uoregon.edu> from Doug White at "Oct 26, 97 11:42:44 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
> On Tue, 21 Oct 1997, Andre Albsmeier wrote:
> 
> > When trying to run
> > 
> > chown -h -R user.group file ...
> > 
> > I get the message
> > 
> > chown: the -R and -h options may not be specified together
> > 
> > Why is this so? I want to pass a whole file hierarchy over
> > to a user; including the symlinks (not what they point at).
> 
> -R and -h are mutually exclusive.  See chown(8); try the -H option.

And I don't understand why. I assume that -P is the default (at least
it is for find(1)). So, when descending down the hierarchy, IMHO it would
make sense to allow -R and -h. This is what I wrote a few days ago to
-hackers, however, I didn't get any reply until now...


----------------- snip ------------------------------

Hi,

after asking on -questions why "chown -R -h" isn't
allowed, I was told that this is due to the possibility
that there might be symlinks which point to directories
somewhere else.

However, this might really be a problem, but only if
the symlinks are followed. So if neither -L nor -H
are specified, I think it would be safe to allow -h 
with -R.

The diff's are quite simple:

*** chown.c.ORI Wed Oct 22 11:35:40 1997
--- chown.c     Tue Oct 21 20:23:30 1997
***************
*** 116,122 ****
  
        fts_options = FTS_PHYSICAL;
        if (Rflag) {
!               if (hflag)
                        errx(1, "the -R and -h options may not be specified together");
                if (Hflag)
                        fts_options |= FTS_COMFOLLOW;
--- 116,122 ----
  
        fts_options = FTS_PHYSICAL;
        if (Rflag) {
!               if (hflag && (Lflag || Hflag) )
                        errx(1, "the -R and -h options may not be specified together");
                if (Hflag)
                        fts_options |= FTS_COMFOLLOW;


I have tried it here and it works quite nice. The reason,
why I like it is, to pass a whole directory over to another
user; of course without the files the symlinks are pointing at.

What do you think about that?

	-Andre




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