aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvestre Ledru <sylvestre@debian.org>2025-10-10 13:38:33 +0200
committerPádraig Brady <P@draigBrady.com>2025-10-10 18:19:47 +0100
commitae0fcbba97a46dee1b5369ca5696e2737642410f (patch)
tree0cd4c2a95f7cd7c76d07a04ad4ae52b8fe5530d5
parenttests: cksum: add a test case for robust file name parsing (diff)
downloadcoreutils-ae0fcbba97a46dee1b5369ca5696e2737642410f.tar.gz
coreutils-ae0fcbba97a46dee1b5369ca5696e2737642410f.zip
tests: ln -f: ensure existing link replaced
Identified here: <https://github.com/uutils/coreutils/issues/8830> * tests/ln/misc.sh: Add the check.
-rwxr-xr-xtests/ln/misc.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/ln/misc.sh b/tests/ln/misc.sh
index bae731ef4..79ea5abe5 100755
--- a/tests/ln/misc.sh
+++ b/tests/ln/misc.sh
@@ -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_