Open ojwb opened 1 year ago
It occurred to me to look at other preload libraries, and the first one I looked at was libfaketime which seems to provide the solution:
https://github.com/wolfcw/libfaketime/commit/ee4f57d8a581fe2fb826d820954eecc0c33e8724
Thanks to a tip-off from @carlocab I did a simple test to see if eatmydata actually eats my data on macos:
The trick I used relies on eatmydata (quite reasonably IMHO) not attempting to emulate the error case where the fd isn't actually syncable. So this test program behaves differently when under eatmydata vs not:
Testing on Debian unstable, using the debian eatmydata package:
This demonstrates that this error case is indeed handled differently when eatmydata is working. So far, so good.
I don't own a mac, so I tested macos using github actions - this is using the homebrew libeatmydata package which includes the patch from #33 that you kindly recently merged:
https://github.com/ojwb/homebrew-eatmydata-test/actions/runs/5766706912/job/15635169095
The output from
./testeatmydata < /dev/null 2> /dev/null
is exactly the same with and withouteatmydata
:With a working eatmydata I would expect the output to differ, probably with no errors reported under eatmydata though I find
F_FULLFSYNC of fd 1 failed: Bad file descriptor
surprising as stdout must be open for this output to get logged - I'd guess it's a socket (fds 0 and 2 should be block devices).I'm afraid I don't know how to fix this.