Re: link(2) creates hard link to symlink in some cases

Bruce Perens (bruce@pixar.com)
Mon, 23 Dec 96 17:45 PST


Any application that depends on that broken link(2) behavior is itself
broken. It doesn't sound very likely that one would. Can you submit the
patch to Linus with an explanation?

Thanks

Bruce

On Sun, 22 Dec 1996, Bruce Perens wrote:
> Under 2.0.27, link(2) creates a hard link to a symlink,
> but only if the target of the symlink exists. This can't
> be the intended behavior.

From: Mark Hemment <markhe@nextd.demon.co.uk>
> It may have been the intended behaviour, but it's certainly the wrong
> behaviour. I test on both SCO's OpenServer, and UnixWare 2.1. Both
> followed the symlink for link(2). Not sure what a BSD derived system does...
>
> As X/Open Issue 4, Version 2, now covers symlinks, I checked in there.
> While they didn't describe the 'following' behaviour of link(2), the
> ELOOP errno is doc'ed as a Unix extension - suggesting symlinks are
> followed. Below is a patch, against 2.1.16 but should apply to 2.0.x
> kernels, to change the behaviour. The only question is; "Does this
> change break any applications?".
>
> --- namei.c.00 Mon Dec 23 19:47:39 1996
> +++ namei.c Mon Dec 23 19:47:41 1996
> @@ -816,7 +816,7 @@
> char * to;
> struct inode * oldinode;
>
> - error = lnamei(oldname, &oldinode);
> + error = namei(oldname, &oldinode);
> if (error)
> return error;
> error = getname(newname,&to);

--
Bruce Perens K6BP   Bruce@Pixar.com
Finger bruce@master.Debian.org for PGP public key.
PGP fingerprint = 88 6A 15 D0 65 D4 A3 A6  1F 89 6A 76 95 24 87 B3