On GNU/Hurd, file descriptor limits set via 'ulimit -n' seem to be
ineffective when set below the default:

    $ (ulimit -n; ulimit -n 512; ulimit -n; \
         tee $(seq 1024) < /dev/null; echo $?)
    1024
    512
    tee: 1022: Too many open files
    tee: 1023: Too many open files
    tee: 1024: Too many open files
    1

* tests/sort/sort-merge-fdlimit.sh: Don't fail if using 'ulimit -n' to
decrease the file descriptor limit is ineffective.
---
 tests/sort/sort-merge-fdlimit.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/sort/sort-merge-fdlimit.sh b/tests/sort/sort-merge-fdlimit.sh
index 54e790d06..1a23d04b7 100755
--- a/tests/sort/sort-merge-fdlimit.sh
+++ b/tests/sort/sort-merge-fdlimit.sh
@@ -35,7 +35,11 @@ seq 17 >some-data
 # the ATF but fail inside it.
 
 (ulimit -n 19 && touch ulimit-worked &&
- returns_ 2 sort --batch-size=20 /dev/null) || fail=1
+   returns_ 2 sort --batch-size=20 /dev/null) || {
+     # GNU/Hurd seems to ignore 'ulimit -n'.  Check for that
+     # before failing.
+     (ulimit -n 0; cat /dev/null) || fail=1
+}
 rm ulimit-worked || skip_ 'cannot modify open file descriptor limit'
 
 # The default batch size (nmerge) is 16.
-- 
2.55.0


Reply via email to