Subject: Re: misc/6166: No obvious documentation on symlink modes
To: None <perry@piermont.com>
From: Dave Sainty <dave@dtsp.co.nz>
List: netbsd-bugs
Date: 09/18/1998 00:48:40
"Perry E. Metzger" writes:

> Dave Sainty writes:
> > And I think Chris is right, the documentation on all modes on symlinks
> > is sparce.  I think it's information that should be covered in the
> > documentation.  It's just the right thing to do, right?  (Doing this
> > follows the general trend of other functions that the documentation
> > performs :) ).
> 
> Okay. Someone has to write it. Based on what you've heard so far, do
> you suppose you could submit patches to symlink(7)? If they are
> reasonable, I promise to commit them.

Heh, ok...

This tries to provide a reasonable explanation based on what appears
to be the case.  I'm a bit worried that it's somewhat hidden and
probably not very easy to find if you were to look.  But it's
something.

I haven't played with man pages before, someone may wish to shoot down
my macro usage. :)

Hope you like it ;)

Cheers,

Dave

--- bin/ln/symlink.7.orig	Sat Feb  7 01:21:24 1998
+++ bin/ln/symlink.7	Fri Sep 18 00:44:29 1998
@@ -107,9 +107,11 @@
 would return a file descriptor to the file
 .Dq afile .
 .Pp
-There are four system calls that do not follow links, and which operate
+There are six system calls that do not follow links, and which operate
 on the symbolic link itself.
 They are:
+.Xr lchmod 2 ,
+.Xr lchown 2 ,
 .Xr lstat 2 ,
 .Xr readlink 2 ,
 .Xr rename 2 ,
@@ -128,6 +130,23 @@
 systems in that the system call
 .Xr chown 2
 has been changed to follow symbolic links.
+.Pp
+If the filesystem is mounted with the symperm mount option, the symbolic link
+file permission bits have the following effects:
+.Pp
+The
+.Xr readlink 2
+system call requires read permissions on the symbolic link.
+.Pp
+System calls that follow symbolic links will fail without execute/search
+permissions on all the symbolic links followed.
+.Pp
+The write, set-user-ID-on-execution and set-group-ID-on-execution symbolic
+link mode bits have no effect on any system calls
+.Po
+including
+.Xr execve 2
+.Pc .
 .Ss Commands not traversing a file tree.
 The second area is symbolic links, specified as command line file
 name arguments, to commands which are not traversing a file tree.
@@ -248,7 +267,9 @@
 .Dq Li "chown -R user slink directory"
 will ignore
 .Dq Li slink ,
-because symbolic links in this system do not have owners.
+because the
+.Fl h
+flag must be used to change owners of symbolic links.
 Any symbolic links encountered during the tree traversal will also be
 ignored.
 The command