Bug 115167 - "-f" option ignored by "ln"
Summary: "-f" option ignored by "ln"
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils   
(Show other bugs)
Version: 1
Hardware: athlon
OS: Linux
Target Milestone: ---
Assignee: Tim Waugh
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2004-02-07 15:28 UTC by Carlos Rodrigues
Modified: 2007-11-30 22:10 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-02-08 16:39:58 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Carlos Rodrigues 2004-02-07 15:28:16 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040116

Description of problem:
The "-f" ("--force") option in "ln" doesn't seem to have any effect
except supress the error message when the symlink already exists.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. mkdir a b
2. ln -s a c
3. ln -sf b c

Actual Results:  After step 3 the symlink "c" still points at "a".

Expected Results:  It should point at "b", the "f" option should force
the old symlink to be eliminated and the new one to be created
pointing at "b".

Additional info:

Comment 1 Bart Martens 2004-02-08 10:27:00 UTC
I think this is not a bug.

$ mkdir a b
$ ln -s a c
$ ln -sf b c
$ ls -l
total 8
drwxrwxr-x    2 bart     bart         4096 Feb  8 11:30 a
drwxrwxr-x    2 bart     bart         4096 Feb  8 11:30 b
lrwxrwxrwx    1 bart     bart            1 Feb  8 11:30 c -> a
$ ls -l c/
total 0
lrwxrwxrwx    1 bart     bart            1 Feb  8 11:30 b -> b

Comment 2 Carlos Rodrigues 2004-02-08 16:39:58 UTC
I see what you mean. I didn't notice that the second ln was creating a
symlink called "b" inside directory "c". I almost sure that this
behavior was introduced not long ago as I remember doing the kind of
command sequence indicated above with the results I expected.

The way to get the result I want is by doing "ln -sfn" to avoid
dereferencing the existing symlink. I'm closing this but I feel that
something should be done to make this explicit in the documentation
(at least for those like me that expected the present behavior only
when using "c/" instead of just "c").

Note You need to log in before you can comment on or make changes to this bug.