The process hierarchy starts with tclsh (MacPorts), then a bunch of layers of make and sh (from oath-toolkit's recursive `make check`), and finally the test-fcntl executable. I was using MacPorts' "trace mode", which seems to be responsible for the particularly high number of inherited open files, but without trace mode I still run into the issue; the returned fd is 11 in this case.
But I don't really want to focus on my specific use-case (for which I already have a workaround). I think the patch is warranted just on the basis that it makes the test a bit more robust, with minimal drawbacks. > On May 9, 2021, at 5:24 AM, Bruno Haible <br...@clisp.org> wrote: > > Nicholas Gaya wrote: >> it seems like the test process inherits a lot of open files from its parent, >> as the actual fd returned by fcntl is 67. > > That seems excessive. What is the chain of parent, grandparent etc. processes? > > Bruno >