Collin Funk wrote:
> The only realistic
> solution I see is adding the following snippet to the start of each
> program:
>
> #if MUSL_LIBC
> if (isatty (STDOUT_FILENO))
> setvbuf (stdout, NULL, _IOFBF, BUFSIZ);
> #endif
This should be:
#if MUSL_LIBC
if (!isatty (STDOUT_FILENO))
setvbuf (stdout, NULL, _IOFBF, BUFSIZ);
#endif
> Given the number of programs, I obviously do not love that solution.
We could implement this solution, through a Gnulib module, and activated
through Gnulib module 'at-init'.
The real question is: is this behaviour worth an extra system call at
program start?
> So I guess Musl is compliant, technically. But I find the behavior a bit
> silly.
Of course it is silly. Rich Felker said that it's motivated by the internal
code structure of musl libc [1]. It's a textbook example of why development
should work by starting with use-cases, translating that to program
requirements, translating that to implementation changes, not by focusing
on the implementation and the code.
Bruno
[1] https://www.openwall.com/lists/musl/2026/04/02/4