On 2025-02-08 22:40, Marco Atzeri via Cygwin wrote:
Noticed today, not sure it is new nor that is Cygwin specific.

It can create unrequested circular links, to replicate:

$ cd /tmp
$ mkdir dirA
$ mkdir dirB
$ cd dirA
$ ln -fs /tmp/dirB dirB
$ ls -l
total 0
lrwxrwxrwx 1 marco marco 9 Feb  9 06:33 dirB -> /tmp/dirB
$ cd dirB
$ ls -l
total 0
lrwxrwxrwx 1 marco marco 7 Feb  9 06:25 dirB -> ../dirB

I built nothing in dirB, but now there is inside a circular link to itself.

It only happens with "ln -fs" not with "ln -s"

You are forcing the creation and are allowed to do shoot yourself; also a number of bugs were introduced with coreutils 9 changing to use f...at() directory relative functions, which messed up our patches and forced a reversion.

I have created many of these, so when creating symlinks with ln -s, I now try not to use -f, and almost always try to use either -t --target-directory or -T --no-target-directory to specify whether a symlink should added into the directory, or a link to a file or directory should be created, or replaced with -f.

I am not seeing anything about this in coreutils issues or change logs;
if you can, would you mind checking with coreutils test 9.5;
I am working on 9.6 and will recheck there when usable.

--
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retrancher  but when there is no more to cut
                                -- Antoine de Saint-Exupéry

--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to