Re: Modify buffering of standard streams via environment variables (not LD_PRELOAD)?

2024-04-28 Thread Zachary Santer
> On Sun, 21 Apr 2024, wrotycz wrote: > > > > It seems that it's 'interleaved' when buffer is written to a file or > > pipe, and because stdout is buffered it waits until buffer is full or > > flushed, while stderr is not and it doesn't wait and write immediately. > > Right; my point was just that

Re: Modify buffering of standard streams via environment variables (not LD_PRELOAD)?

2024-04-20 Thread Zachary Santer
On Sat, Apr 20, 2024 at 11:58 AM Carl Edquist wrote: > > On Thu, 18 Apr 2024, Zachary Santer wrote: > > > > Finally had a chance to try to build with 'stdbuf --output=L --error=L > > --' in front of the build script, and it caused some crazy problems. > > For what

Re: Modify buffering of standard streams via environment variables (not LD_PRELOAD)?

2024-04-19 Thread Zachary Santer
On Fri, Apr 19, 2024 at 8:26 AM Pádraig Brady wrote: > > Perhaps at this stage we should consider stdbuf ubiquitous enough to suffice, > noting that it's also supported on FreeBSD. Alternatively, if glibc were modified to act on these hypothetical environment variables, it would be trivial to

Re: Modify buffering of standard streams via environment variables (not LD_PRELOAD)?

2024-04-19 Thread Zachary Santer
On Fri, Apr 19, 2024 at 5:32 AM Pádraig Brady wrote: > > env variables are what I proposed 18 years ago now: > https://sourceware.org/bugzilla/show_bug.cgi?id=2457 And the "resistance to that" from the Red Hat people 24 years ago is listed on a website that doesn't exist anymore. If I'm to

Modify buffering of standard streams via environment variables (not LD_PRELOAD)?

2024-04-18 Thread Zachary Santer
Was "RFE: enable buffering on null-terminated data" On Wed, Mar 20, 2024 at 4:54 AM Carl Edquist wrote: > > However, if stdbuf's magic env vars are exported in your shell (either by > doing a trick like 'export $(env -i stdbuf -oL env)', or else more simply > by first starting a new shell with

Re: RFE: enable buffering on null-terminated data

2024-03-19 Thread Zachary Santer
On Tue, Mar 19, 2024 at 1:24 AM Kaz Kylheku wrote: > > But what tee does is set up _IONBF on its output streams, > including stdout. So it doesn't buffer at all. Awesome. Nevermind.

Re: RFE: enable buffering on null-terminated data

2024-03-17 Thread Zachary Santer
On Thu, Mar 14, 2024 at 11:14 AM Carl Edquist wrote: > Where things get sloppy is if you add some stuff in a pipeline after your > build script, which results in things getting block-buffered along the > way: > > $ ./build.sh | sed s/what/ever/ | tee build.log > > And there you will

Re: stdbuf feature request - line buffering but for null-terminated data

2024-03-12 Thread Zachary Santer
On Tue, Mar 12, 2024 at 12:42 PM Kaz Kylheku wrote: > stdbuf is a hack/workaround for programs that ignore the > issue of buffering. Specifically, programs which send information > to one of the three standard streams, such that the information > is required in a timely way. Those streams become

Re: stdbuf feature request - line buffering but for null-terminated data

2024-03-12 Thread Zachary Santer
On Tue, Mar 12, 2024 at 2:58 PM Kaz Kylheku wrote: > What if there existed an alternative delimiting mode: a format where > the character strings are delimited by the two byte sequence \0\n. How long did it take for the major command-line utilities to initially implement handling null-terminated

Re: RFE: enable buffering on null-terminated data

2024-03-11 Thread Zachary Santer
On Mon, Mar 11, 2024 at 7:54 AM Carl Edquist wrote: > > (In my coprocess management library, I effectively run every coproc with > --output=L by default, by eval'ing the output of 'env -i stdbuf -oL env', > because most of the time for a coprocess, that's whats wanted/necessary.) Surrounded by

Re: RFE: enable buffering on null-terminated data

2024-03-10 Thread Zachary Santer
So "find -printf '%p\0\c'" would, for instance, already > behave the same as "stdbuf --output=N find -print0" with the new stdbuf > output mode you're suggesting. > > (Though again, this doesn't actually seem to be any more efficient than > running

RFE: enable buffering on null-terminated data

2024-03-10 Thread Zachary Santer
Was "stdbuf feature request - line buffering but for null-terminated data" See below. On Sun, Mar 10, 2024 at 5:38 AM Pádraig Brady wrote: > > On 09/03/2024 16:30, Zachary Santer wrote: > > 'stdbuf --output=L' will line-buffer the command's output stream. > > Prett

stdbuf feature request - line buffering but for null-terminated data

2024-03-09 Thread Zachary Santer
'stdbuf --output=L' will line-buffer the command's output stream. Pretty useful, but that's looking for newlines. Filenames should be passed between utilities in a null-terminated fashion, because the null byte is the only byte that can't appear within one. If I want to buffer output data on null

Re: [PATCH] printf: add %#s alias to %b

2023-09-07 Thread Zachary Santer
On Thu, Sep 7, 2023 at 12:55 PM Robert Elz wrote: > There are none, printf(3) belongs to the C committee, and they can make > use of anything they like, at any time they like. > > The best we can do is use formats that make no sense for printf(1) to > support > That's still assuming the goal of

Re: [PATCH] printf: add %#s alias to %b

2023-09-07 Thread Zachary Santer
The trouble with using an option flag to printf(1) to toggle the meaning of %b is that you can't then mix format specifiers for binary literals and backslash escape expansion within the same format string. You'd just have to call printf(1) multiple times, which largely defeats the purpose of a