[Bug 254489] Command 'ln -sfF' behaves unreasonably: it deletes the target directory and then fails
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Mon Mar 22 21:49:57 UTC 2021
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254489
christos at christosmarg.xyz changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |christos at christosmarg.xyz
--- Comment #1 from christos at 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 has 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`.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list