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

Bruce Perens (bruce@pixar.com)
Sun, 22 Dec 96 15:36 PST


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.

> echo >a
> ln -s a b
> ln b c
ls -l a b c
-rw-rw-rw- 1 bruce bruce 0 Dec 22 15:22 a
lrwxrwxrwx 2 bruce bruce 1 Dec 22 15:22 b -> a
lrwxrwxrwx 2 bruce bruce 1 Dec 22 15:22 c -> a
> rm a c
> ln b c
ln: b: No such file or directory

This was reported to me by Richard Stallman. We are both running Debian systems,
I verified that this was a feature of kernel 2.0.27 and not our "ln" executable.

Thanks

Bruce Perens

--
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