Subject: Re: chmod on symlink Q
To: Greywolf <greywolf@starwolf.com>
From: Matthias Buelow <mkb@mukappabeta.de>
List: tech-userlevel
Date: 04/30/2001 20:32:54
Greywolf writes:

>This is a Feature of NetBSD -- a point where value is actually added.

I can hardly see the benefit of that "feature", when I have to provide
an option to chmod(1) to do anything at all.

>IIRC, code was put in where we treat symlink permissions differently
>than standard file permissions.  see symlink(7).

That's no problem -- the difference manifests itself in chmod(1)
with the -h option.  I can't understand, though, what benefit comes
from chmod(1) not doing anything at all if -h is not specified.
I mean, how do you change the modes of the link target through the
symlink in the NetBSD implementation?  You can't.

There are two problems with the current implementation:

a) `chmod symlink' is a null operation and doesn't have any effect.
b) `chmod -h symlink' changes the symlink's modes but no option
   is available for operating on the link target, i.e. chmod is
   unsymmetric in that respect.

This would not be an issue, if the default behaviour of chmod(1)
would be to change the link target's mode, like it is on other
systems.
If you want to change the modes of the first symlink, you could
then specify -h, as you have to do anyways with the current
implementation.
symlink(7) says nothing about chmod(1).  There would be little
to say anyways, since for each operation lchmod(2) and chmod(2)
exist and are very straightforward in their behaviour.  chmod(1)
isn't however.

--mkb