Hello

This patch adds a missing test in du.

Cheers,
Sylvestre

From c27f286a306c918ebb16e2d523bba131cccc5a40 Mon Sep 17 00:00:00 2001
From: Sylvestre Ledru <[email protected]>
Date: Wed, 31 Dec 2025 00:14:59 +0100
Subject: [PATCH] du -l (--count-links) without -a flag

Identified here:
<https://github.com/uutils/coreutils/issues/9871>

  * tests/du/hard-link.sh: Add the check.
---
 tests/du/hard-link.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tests/du/hard-link.sh b/tests/du/hard-link.sh
index 2debaa36f..b5f94e4dc 100755
--- a/tests/du/hard-link.sh
+++ b/tests/du/hard-link.sh
@@ -61,4 +61,14 @@ EOF
 
 compare exp out || fail=1
 
+# Test du -l (--count-links) without -a flag
+# This should count hard-linked files separately
+mkdir -p test-dir
+echo "content" > test-dir/file1
+ln test-dir/file1 test-dir/file2
+du_normal=$(du test-dir | cut -f1)
+du_count_links=$(du -l test-dir | cut -f1)
+# The count-links version should be larger (counting the hardlink separately)
+test "$du_count_links" -gt "$du_normal" || fail=1
+
 Exit $fail
-- 
2.47.3

Reply via email to