GNU bug report logs -
#7634
anomaly ln command
Previous Next
Reported by: Baggia Nate <baggianate <at> gmail.com>
Date: Mon, 13 Dec 2010 14:00:04 UTC
Severity: normal
Tags: notabug
Done: Jim Meyering <jim <at> meyering.net>
Bug is archived. No further changes may be made.
Full log
Message #14 received at 7634-done <at> debbugs.gnu.org (full text, mbox):
Baggia Nate wrote:
> work with Fedora (version 14) and I noticed that the command:
>
> *ln -fs /path/from /path/to*
>
> does not actually remove the target path.
That is intentional behavior. This is because that is what BSD does
and BSD created the ln command. The GNU ln follows the BSD ln
behavior. This gets discussed every so often and the archives will
have a much longer discussion of it.
> In my case the */path/to* correspond to another symbolic link
> (*/path/other* ). Why not work even if given the option *-f*
> (*--force*) flag?
If you are used to the System V behavior then this will be a
difference. SysV ln always behaves as if the -n option has been
given. The only portable way to deal with differences between SysV
and BSD behaviors is to remove the target symlink before creating the
new one.
rm -f /path/to
ln -sf /path/from /path/to
The BSD (and therefore GNU) expectation would be to use the -n
option. But SysV does not support the -n option. But if you are not
concerned about portability to SysV then that is the easiest way.
ln -sfn /path/from /path/to
Since this is intentional behavior I am closing the bug. But feel
free to continue the discussion if more information, clarification or
discussion is needed.
Bob
This bug report was last modified 14 years and 192 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.