bug#79060: ln documentation 2nd form does not work

Davide Brini via GNU coreutils Bug Reports <[email protected]>
Newsgroups gmane.comp.gnu.core-utils.bugs
Message-ID <20250720171913.008c89ae@gonzo>
On Sun, 20 Jul 2025 23:21:09 +1000, Mason Wong <[email protected]>
wrote:

> According to the ln documentation ( ln(1) - Linux manual page
> <https://man7.org/linux/man-pages/man1/ln.1.html>)
> 
> [image: image.png]
> The documentation states that you should be able to do something like *ln
> a.txt* (where a.txt is just some arbitrary file). However, this is
> misleading because something like this cannot be done:

The problem is that you're running the command in the same directory as the
source, so it correctly cannot create a link to it since an object with the
same name already exists (ie, the file itself). This is the same that would
happen even with the two-argument form of ln, if an object with the same
name already exists;

$ touch b
$ ln -s /bin/ls b
ln: failed to create symbolic link 'b': File exists

Try linking to an object that doesn't live in the same directory.

$ rm b
$ ln -s /bin/ls
$ ls -l
lrwxrwxrwx 1 davide davide       7 Jul 20 17:18 ls -> /bin/ls

-- 
D.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.