tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: link(2) on a symlink to a directory fails



>> [link(2) on a symlink]

> Posix says:
>   http://pubs.opengroup.org/onlinepubs/009695399/functions/link.html
> which gives an implementation-dependent out.

I assume you're talking about the wording for directories, but that's
not the issue here.  The question here isn't about linking to
directories; it's about linking to symlinks.  That the test case given
fails on NetBSD because the symlink points to a directory is a red
herring; the Linux behaviour doesn't link to a directory any more than
the NetBSD one does - it links to a symlink.

> NetBSD appears to be compliant, and to follow the default/sane
> interpretation.

Actually, to me the sane interpretation would be the Linux one.  Why
_shouldn't_ I be able to hardlink to a symlink?  (Filesystem
permitting, of course, as for anything involving symlinks.)

> Also, from POSIX, it seems that link on anything other than a regular
> file is irregular (except a symlink, where the link is made on the
> target, no different than any other operation).

I read "file" in that description as meaning, basically, "filesystem
object".  Otherwise, there'd be no need to explicitly mention the case
where path1 names a directory, because it has to "[name] an existing
file".

/~\ The ASCII                             Mouse
\ / Ribbon Campaign
 X  Against HTML                mouse%rodents-montreal.org@localhost
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index