bug-coreutils
[Top][All Lists]
Advanced

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

Re: ln -sf foo symlink_to_directory


From: Jim Meyering
Subject: Re: ln -sf foo symlink_to_directory
Date: Fri, 06 Feb 2004 16:00:51 +0100

Bruno Haible <address@hidden> wrote:
> ln (GNU coreutils 5.1.1) on Linux 2.4.x, when given the command
>
>      ln -sf foo symlink_to_directory
>
> puts the symlink to 'foo' into the directory. I would have expected it to
> replace the symlink_to_directory. Rationale:

The behavior of `ln -s' in that case is compatible with
historical BSD implementations.  You'd like the SYSV behavior.
I think it's too late to change, since many people have come to
rely on the existing behavior.  Imagine what'd happen if we did
change it:  people are used to creating a link in a directory,
say in /usr/local/bin, by doing this

  ln -fs /some/file /usr/local/bin

and that works fine as long as /usr/local/bin is a directory.
But what happens when e.g., due to space considerations, that
`bin' directory is moved and replaced with a symlink to its new
location.  Then, the very same command will have the surprising
effect of making /usr/local/bin point to /some/file rather than
to the directory containing lots of executables.

> Is that consistent with POSIX?

I don't know.  Perhaps it is deliberately not specified.  If the
POSIX spec mandates this aspect of `ln -s' semantics, then lots
of vendors are non-conforming, on one side or the other.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]