jpl@allegra.UUCP (John P. Linderman) (03/31/84)
leslie@dice raises some interesting questions about the ownership and modes of symbolic links. Since chgrp and chown modify the owner of the link itself (as opposed to the file it references), it only makes sense to establish the original owners of the link itself, using lstat instead of stat. I thought that it might be well to do the same for chmod, so one could change the mode of the link itself rather than the link it references. But the chmod system call insists on changing the mode of the file that the link references, not the mode of the link itself, so it is better to leave that stat call unchanged. This brings up the larger issue of the semantics of owners and modes on symbolic links. As far as I can tell, they mean nothing. If I change my umask to 777 and make a symbolic link to a writable file, I end up with a link that is mode 000, but I can still write the file through the link. There is no warning message if I try to remove the link, as there would be if I tried to remove a file that was mode 000. And there is no way to change the file that a link references except by removing and remaking the link. If the modes mean nothing, than neither do the owners. Under the circumstances, the best policy on ownership and modes of symbolic links is to ignore them. You cannot change their modes with chmod, and it wouldn't matter if you did. Please set me straight if this analysis is faulty. John P. Linderman Department of Symbolic Illogic allegra!jpl