From: Collin Funk Date: Thu, 4 Dec 2025 04:18:48 +0000 (-0800) Subject: tests: ls: check that 'ls -R' doesn't run out of file descriptors X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8787601bbe08ccf38b50e8c7364607229ffa8c64;p=thirdparty%2Fcoreutils.git tests: ls: check that 'ls -R' doesn't run out of file descriptors * tests/ls/recursive.sh: Add a test where the file descriptor limit is less than the number of directories we visit recursively. --- diff --git a/tests/ls/recursive.sh b/tests/ls/recursive.sh index cf16b64fbf..6935bdb53f 100755 --- a/tests/ls/recursive.sh +++ b/tests/ls/recursive.sh @@ -59,4 +59,41 @@ EOF compare exp out || fail=1 +# Check that we don't run out of file descriptors when visiting +# directories recursively. +mkdir -p 1/2/3/4/5/6/7/8/9/10 || framework_failure_ +(ulimit -n 7 && ls -R 1 > out) || fail=1 +cat < exp +1: +2 + +1/2: +3 + +1/2/3: +4 + +1/2/3/4: +5 + +1/2/3/4/5: +6 + +1/2/3/4/5/6: +7 + +1/2/3/4/5/6/7: +8 + +1/2/3/4/5/6/7/8: +9 + +1/2/3/4/5/6/7/8/9: +10 + +1/2/3/4/5/6/7/8/9/10: +EOF + +compare exp out || fail=1 + Exit $fail