Re: [PATCH] t5516: fail to run in verbose mode
From: Jeff King <hidden>
Date: 2022-11-28 05:16:44
On Fri, Nov 25, 2022 at 01:58:55PM +0900, Junio C Hamano wrote:
Jeff King [off-list ref] writes:quoted
One thing I'd worry about is buffering. One of the nice things about "-v" is that there is nothing between you and the running programs, so you are much less likely to be fooled about the order of events in the output. Or wondering why nothing is happening because real-time output seems to have stalled. But piping through "cat" may end up with weird pauses while it fills up a 4k buffer. Using stdbuf could help, but that's far from portable.We could pipe to "dd bs=1 conv=fsync" (tongue-in-cheek---I think conv=fsync is a GNU thing).
We don't need the fsync; we are just worried about in-process buffering, not kernel-level flushing. So bs=1 is sufficient, in that it would use syscalls to read/write single bytes. It would just be horribly inefficient. We really just want immediate partial read()/write() but with sensible buffer sizes. It would be easy to write a 5-line C program that did this if we really wanted to. I'm not entirely convinced it's worth worrying too much about, though. -Peff