On Tue, May 27, 2025 at 05:21:19PM +0000, John Radley (jradxl2) wrote: > Hello,I can't pipe output like this:- > $ pasta --version | grep pasta > but this works:- > $ sudo apt install expect > $ unbuffer pasta --version | grep pasta > pasta 2025_05_12.8ec1341-9-g3262c9b > > If this is the intended action, please can you tell me why? Ouch. No, that's not intended. I initially assumed this was because we were sending the version information to stderr instead of stdout, but that's not the case. This is a bug introduced by d0006fa78 ("treewide: use _exit() over exit()"). For --version we're displaying the information with fprintf(), then immediately exiting with _exit(). When writing to a pipe, stdout is buffered. Normally the buffer would be flushed before exiting, but using _exit() bypasses that. We could fix this specific problem by adding an fflush(stdout) before the _exit(). However, I worry that there might be other bugs we have because we're not running libc installed exit handlers here and elsewhere. I was already a bit dubious about using _exit() by default, and now I really don't think it was a good idea. That said, I don't immediately have a better idea of how to address the problem d0006fa78 was aiming to fix in the first place. Well... I'm on holiday at the moment, so I won't be fixing it. Laurent & Stefano, I hope the analysis above is helpful. -- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson