Subject: Unexpected results from `ln --symbolic --interactive --relative`

From: Florian Schweiger <[email-masked]>
Date: Tue, 17 May 2016 10:56:06 +0100

Hi,

I've noticed the following unexpected behaviour in `ln` which appears to 
be a bug. I'm referring to the attached MWE Bash script 
test_ln-symbolic-interactive-relative.sh.

When run, it creates a directory "test_dir" and a file "test_file" in 
the current working directory. Then it tries to create a relative, 
symbolic link to the file in said directory. When the "--interactive" 
option is present, this operation fails every other time in that it 
overwrites the existing link with an unreachable target.

DETAILED DESCRIPTION:

* First invocation
     $ ./test_ln-symbolic-interactive-relative.sh
     ln -sirv test_file test_dir/test_link
     ‘test_dir/test_link’ -> ‘../test_file’
* Second invocation:
     $ ./test_ln-symbolic-interactive-relative.sh
     ln -sirv test_file test_dir/test_link
     ln: replace ‘test_dir/test_link’? y
     ‘test_dir/test_link’ -> ‘test_file’
* Third invocation:
     $ ./test_ln-symbolic-interactive-relative.sh
     ln -sirv test_file test_dir/test_link
     ln: replace ‘test_dir/test_link’? y
     ‘test_dir/test_link’ -> ‘../test_file’

AFFECTED SYSTEM:
     * ln (GNU coreutils) 8.21
     * GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)
     * Ubuntu 14.04.4 LTS
     * Linux 3.13.0-67-generic #110-Ubuntu SMP Fri Oct 23 13:24:41 UTC 
2015 x86_64 x86_64 x86_64 GNU/Linux

On other systems, the symbolic link is set as expected every time.

WORKING SETUP:
     * ln (GNU coreutils) 8.21
     * GNU bash, version 4.2.53(1)-release (x86_64-suse-linux-gnu)
     * openSUSE 13.1 (Bottle) (x86_64)
     * Linux 3.11.10-29-desktop #1 SMP PREEMPT Thu Mar 5 16:24:00 UTC 
2015 (338c513) x86_64 x86_64 x86_64 GNU/Linux

Cheers,
Florian

-----------------------------
http://www.bbc.co.uk
This e-mail (and any attachments) is confidential and 
may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in 
error, please delete it from your system.
Do not use, copy or disclose the 
information in any way nor act in reliance on it and notify the sender 
immediately.
Please note that the BBC monitors e-mails 
sent or received.
Further communication will signify your consent to 
this.
-----------------------------