Eric Blake wrote: > When running test-closein.sh, I'm getting spurious output on Darwin: > > cat: standard output: Bad file descriptor > PASS: test-closein.sh > > $ cat --version | head -n 1 > cat (GNU coreutils) 7.1 > $ uname -v > Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00 PDT 2007; > root:xnu-792.24.17~1/RELEASE_PPC > > I ran ktrace/kdump, and it looks like the problem occurs any time a pipe > is created, but the reader exits without reading anything prior to the > writer attempting to write. For example: > > $ echo hi > foo > $ cat foo | : > cat: standard output: Bad file descriptor > $ cat foo | { :; sleep 0.01; } > $ > > It seems like the Darwin kernel is failing to give SIGPIPE/EPIPE failures, > and instead gives EBADF when the read end of the pipe is gone. Is this > anything that coreutils should try to work around?
Personally, I haven't been too concerned with coreutils "problems" arising from flaws in Darwin, since I rarely use that type of system. In this case, unless you want to work on it and find a clean fix, I'd be inclined to defer working on it indefinitely.