]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: ls: check that 'ls -R' doesn't run out of file descriptors
authorCollin Funk <collin.funk1@gmail.com>
Thu, 4 Dec 2025 04:18:48 +0000 (20:18 -0800)
committerCollin Funk <collin.funk1@gmail.com>
Fri, 5 Dec 2025 02:00:49 +0000 (18:00 -0800)
* tests/ls/recursive.sh: Add a test where the file descriptor limit is
less than the number of directories we visit recursively.

tests/ls/recursive.sh

index cf16b64fbf1e73ae29507a8b80a14308237e526b..6935bdb53fd77a81d32eac519aeffeb396c16747 100755 (executable)
@@ -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 <<EOF > 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