This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes

Bug 115167

Summary: "-f" option ignored by "ln"
Product: [Fedora] Fedora Reporter: Carlos Rodrigues <cefrodrigues>
Component: coreutilsAssignee: Tim Waugh <twaugh>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 1CC: bart.martens, mitr
Target Milestone: ---   
Target Release: ---   
Hardware: athlon   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-02-08 11:39:58 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Carlos Rodrigues 2004-02-07 10:28:16 EST
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 05:27:00 EST
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 11:39:58 EST
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").