Subject: Re: LINK a symbolic link?

From: Peter Staubach <[email-masked]>
Date: Tue, 27 Nov 2001 12:49:24 -0700 (MST)

> 
> On Tue, Jim Rees wrote:
> >   LINK won't let you create a link to a directory
> > 
> > That's not what the spec says.  I had assumed you could only link to a
> > regular file, but now Spencer says you can link to non-regular files.  Since
> > the spec doesn't say which non-regular files you can link to, I assume an
> > implementation is free to allow links to directories.  If that's not the
> > case, maybe we should fix the spec.
> > 
> > My preference would be to disallow links to non-regular files.
> 
> There is precedence in NFSv2/v3 for linking to non-regular files
> (except for directories).
> 

I don't think that there was anything in the NFS Version 2 or NFS
Version 3 protocols which restricted the ability to link anything,
even directories.  In fact, linking to directories _must_ be allowed
in order to correctly implement certain semantics.  It is unfortunate,
but the UNIX link(2) system will allow a link to a directory.

		ps

---

From: Erik Seaberg <[email-masked]>
Date: 27 Nov 2001 12:04:25 -0800

Peter Staubach <[email-masked]> writes:

> It is unfortunate,

The FreeBSD and GNU/Linux manpages for link(2) both claim you'll get
EPERM if you try to link to a directory (probably so that every
directory has one parent--no other types of entries are similarly
restricted), and FreeBSD's /bin/ln reports "is a directory".  Does
POSIX specify this one way or the other, or is it a SysV feature?