Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Mar 2021 21:49:57 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 254489] Command 'ln -sfF' behaves unreasonably: it deletes the target directory and then fails
Message-ID:  <bug-254489-227-QA8gmWePsT@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-254489-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-254489-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D254489

christos@christosmarg.xyz changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |christos@christosmarg.xyz

--- Comment #1 from christos@christosmarg.xyz ---
There is no bug on ln(1)'s part. The -F option checks if your last argument=
 is
a directory and if it is, it removes it only if it's empty (see code below).


static int      Fflag;                  /* Remove empty directories also. */


if (Fflag && S_ISDIR(sb.st_mode)) {
        if (rmdir(target)) {
                warn("%s", target);
                return (1);
        }
}

The reason your command fails doesn't have to do with the -F option - it ha=
s to
do with the fact that you're trying to create a link named `.x/`, and as you
probably know, you're not allowed to use slashes inside a name, so symlink(=
2)
fails. You'd get the same error no matter what option you used.

If you want your command to work, simply write it as `ln -sfF /bin/ls .x`.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-254489-227-QA8gmWePsT>