tests: wc: ensure -c counts all of a file when descriptors run out

Reported at https://github.com/uutils/coreutils/issues/15742

* tests/wc/page-size.sh: Add a test case.

Link: https://github.com/coreutils/coreutils/pull/446
This commit is contained in:
Sylvestre Ledru authored and Pádraig Brady committed 2026-11-07 12:35:10 +00:00
1 parent 0201866781
commit a15203bb8c
1 file changed
+9
+9
View File
@@ -48,4 +48,13 @@ for multiple in $(seq 3); do
compare /dev/null err || fail=1
done
# Ensure 'wc -c FILE' reports the whole size of a page-multiple file
# when no descriptors are left for other ways of counting.
if (ulimit -n 4 && cat file > /dev/null) 2> /dev/null; then
(ulimit -n 4 && wc -c file > out 2> err) || fail=1
echo "$file_size file" > exp || framework_failure_
compare exp out || fail=1
compare /dev/null err || fail=1
fi
Exit $fail