Email List: Xaustin-group-lX
[All Lists]

Re: link(2) and symlinks

To: yyyyyyyyyyyyyy@xxxxxxxxxxxxx
Subject: Re: link(2) and symlinks
From: Gunnar Ritter <yyyyyyyyyyyyy@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 17 Mar 2005 15:05:09 +0100
Organization: Privat.
References: <42383B12.7050203@byu.net><20050316145244.GA2516@maildrop.rdg.opengroup.org><200503161726.j2GHQdVm012524@khavrinen.lcs.mit.edu><877jk67lu5.fsf@penguin.cs.ucla.edu>
Paul Eggert <yyyyyy@xxxxxxxxxxx> wrote:

> So (unless I'm missing something) in this particular detail *BSD has
> stuck with POSIX rather than the traditional Unix behavior as
> supported by the Solaris default environment and by GNU/Linux.

The traditional BSD behavior has been to follow symbolic links. They
have been introduced with 4.2BSD, and its source code for link() in
/usr/src/sys/sys/ufs_syscalls.c calls "namei(uchar, LOOKUP, 1)" to
resolve the target name. In ufs_nami.c, that function is defined as
"namei(func, flag, follow)" where, according to the comment above,
"The follow argument is 1 when symbolic links are to be followed when
they occur at the end of the name translation process."

The full line of the code for link() in ufs_syscalls.c is

        ip = namei(uchar, LOOKUP, 1); /* well, this routine is doomed anyhow */

I can only speculate about the intention behind the comment.

I do not have access to the SVR4 sources or to a running system from
the early 90's. It is possible that the historic SVR4 behavior of
link() has indeed been to create hard links to symbolic links.

        Gunnar

<Prev in Thread] Current Thread [Next in Thread>