From 75e314a11a3ccfecadddf0270dc4619e3486ea66 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 31 Dec 2025 00:14:59 +0100 Subject: [PATCH] tests: du: check -l (--count-links) without -a flag Identified here: * tests/du/hard-link.sh: Add the check. --- tests/du/hard-link.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/du/hard-link.sh b/tests/du/hard-link.sh index 2debaa36f..8fb79e6d4 100755 --- a/tests/du/hard-link.sh +++ b/tests/du/hard-link.sh @@ -61,4 +61,16 @@ EOF compare exp out || fail=1 +# Test du -l (--count-links) without -a flag +# This should count hard-linked files separately +mkdir test-dir && +echo 'content' > test-dir/file1 && +ln test-dir/file1 test-dir/file2 || framework_failure_ +du_normal=$(du test-dir | cut -f1) || fail=1 +du_count_links=$(du -l test-dir | cut -f1) || fail=1 +# The count-links version should be larger +if test "$du_normal" -gt 0; then + test "$du_count_links" -gt "$du_normal" || fail=1 +fi + Exit $fail