Eric Blake <[EMAIL PROTECTED]> writes:

> $ touch a
> $ ln -s a b
> $ ln b c      # Bug: c should be a hard link to a, not b
> $ ls -l a b c
> -rw-r--r--  1 eblake None 0 Mar 15 19:04 a
> lrwxrwxrwx  2 eblake None 1 Mar 15 19:04 b -> a
> lrwxrwxrwx  2 eblake None 1 Mar 15 19:04 c -> a

I agree that this is an incompatibility with POSIX, and should get
fixed one way or another.

Solaris 9 /usr/xpg4/bin/ln and OpenBSD 3.4 /bin/ln agree with POSIX,
but Solaris 9 /bin/ln agrees with GNU ln.  So there is a practical
compatibility issue here.

Also, Solaris 9 /usr/xpg4/bin/ln and OpenBSD 3.4 /bin/ln don't agree
about whether "ln b c" should dereference b just once (which is what
Solaris does) or repeatedly until it finds a non-symlink (which is
what OpenBSD 3.4 ln does, because that's what OpenBSD link() does).

It does seem to be a messy area.  It's not clear to me that POSIX was
intended to specify what it does.  Personally I prefer the GNU "ln"
behavior, on hosts that support hard links to symlinks: it's much
cleaner and easier to explain.

Maybe this should be brought before the POSIX committee?


_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to