]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: ln -f: ensure existing link replaced
authorSylvestre Ledru <sylvestre@debian.org>
Fri, 10 Oct 2025 11:38:33 +0000 (13:38 +0200)
committerPádraig Brady <P@draigBrady.com>
Fri, 10 Oct 2025 17:19:47 +0000 (18:19 +0100)
Identified here:
<https://github.com/uutils/coreutils/issues/8830>

* tests/ln/misc.sh: Add the check.

tests/ln/misc.sh

index bae731ef4428fae2b32233a3a9af4933842ee8d9..79ea5abe599700e85b56d9a88a888f1b39c10bdc 100755 (executable)
@@ -96,6 +96,14 @@ ln --no-dereference -fs "$af" $ld || fail=1
 test -f $ld || fail=1
 rm -rf $d $f $ld
 
+# -f on a existing file should not generate an error
+rm -rf $d $f
+touch $f || framework_failure_
+mkdir $d || framework_failure_
+ln $f $d
+ln -f $f $d || fail=1
+test -d $d || fail=1
+
 # Try to create a symlink with backup where the destination file exists
 # and the backup file name is a hard link to the destination file.
 touch a b || framework_failure_