From: "Pádraig Brady" <P@draigBrady.com>
To: Zachary Santer <zsanter@gmail.com>, Carl Edquist <edquist@cs.wisc.edu>
Cc: Kaz Kylheku <kaz@kylheku.com>,
libc-alpha@sourceware.org, coreutils@gnu.org
Subject: Re: Modify buffering of standard streams via environment variables (not LD_PRELOAD)?
Date: Fri, 19 Apr 2024 10:32:28 +0100 [thread overview]
Message-ID: <df175303-0ce9-2311-e851-4940de68a9b2@draigBrady.com> (raw)
In-Reply-To: <CABkLJU+fFHiSkiJAe-f=N765STBx+v3=65S+Q5JrRgr6hwN0TQ@mail.gmail.com>
On 19/04/2024 01:16, Zachary Santer wrote:
> Was "RFE: enable buffering on null-terminated data"
>
> On Wed, Mar 20, 2024 at 4:54 AM Carl Edquist <edquist@cs.wisc.edu> 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 'stdbuf -oL bash'), then every command
>> in your pipelines will start with the new default line-buffered stdout.
>> That way your line-items from build.sh should get passed all the way
>> through the pipeline as they are produced.
>
> 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. I
> was building Ada, though, so pretty good chance that part of the build
> chain doesn't link against libc at all.
>
> I got a bunch of
> ERROR: ld.so: object '/usr/libexec/coreutils/libstdbuf.so' from
> LD_PRELOAD cannot be preloaded: ignored.
>
> And then it somehow caused compiler errors relating to the size of
> what would be pointer types. Cleared out all the build products and
> tried again without stdbuf and everything was fine.
>
>>From the original thread just within the coreutils email list, "stdbuf
> feature request - line buffering but for null-terminated data":
> On Tue, Mar 12, 2024 at 12:42 PM Kaz Kylheku <kaz@kylheku.com> wrote:
>>
>> I would say that if it is implemented, the programs which require
>> it should all make provisions to set it up themselves.
>>
>> 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 fully buffered
>> when not connected to a terminal.
>
> I think I've partially come around to this point of view. However,
> instead of expecting all sorts of individual programs to implement
> their own buffering mode command-line options, could this be handled
> with environment variables, but without LD_PRELOAD? I don't know if
> libc itself can check for those environment variables and adjust each
> program's buffering on its own, but if so, that would be a much
> simpler solution.
>
> You could compare this to the various locale environment variables,
> though I think a lot of commands whose behavior differ from locale to
> locale do have to implement their own handling of that internally, at
> least to some extent.
>
> This seems like somewhat less of a hack, and if no part of a program
> looks for those environment variables, it isn't going to find itself
> getting broken by the dynamic linker. It's just not going to change
> its buffering.
>
> Additionally, things that don't link against libc could still honor
> these environment variables, if the developers behind them care to put
> in the effort.
env variables are what I proposed 18 years ago now:
https://sourceware.org/bugzilla/show_bug.cgi?id=2457
cheers,
Pádraig
next prev parent reply other threads:[~2024-04-19 9:33 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CABkLJULa8c0zr1BkzWLTpAxHBcpb15Xms0-Q2OOVCHiAHuL0uA@mail.gmail.com>
[not found] ` <9831afe6-958a-fbd3-9434-05dd0c9b602a@draigBrady.com>
2024-03-10 15:29 ` RFE: enable buffering on null-terminated data Zachary Santer
2024-03-10 20:36 ` Carl Edquist
2024-03-11 3:48 ` Zachary Santer
2024-03-11 11:54 ` Carl Edquist
2024-03-11 15:12 ` Examples of concurrent coproc usage? Zachary Santer
2024-03-14 9:58 ` Carl Edquist
2024-03-17 19:40 ` Zachary Santer
2024-04-01 19:24 ` Chet Ramey
2024-04-01 19:31 ` Chet Ramey
2024-04-02 16:22 ` Carl Edquist
2024-04-03 13:54 ` Chet Ramey
2024-04-03 14:32 ` Chet Ramey
2024-04-03 17:19 ` Zachary Santer
2024-04-08 15:07 ` Chet Ramey
2024-04-09 3:44 ` Zachary Santer
2024-04-13 18:45 ` Chet Ramey
2024-04-14 2:09 ` Zachary Santer
2024-04-04 12:52 ` Carl Edquist
2024-04-04 23:23 ` Martin D Kealey
2024-04-08 19:50 ` Chet Ramey
2024-04-09 14:46 ` Zachary Santer
2024-04-13 18:51 ` Chet Ramey
2024-04-09 15:58 ` Carl Edquist
2024-04-13 20:10 ` Chet Ramey
2024-04-14 18:43 ` Zachary Santer
2024-04-15 18:55 ` Chet Ramey
2024-04-15 17:01 ` Carl Edquist
2024-04-17 14:20 ` Chet Ramey
2024-04-20 22:04 ` Carl Edquist
2024-04-22 16:06 ` Chet Ramey
2024-04-27 16:56 ` Carl Edquist
2024-04-28 17:50 ` Chet Ramey
2024-04-08 16:21 ` Chet Ramey
2024-04-12 16:49 ` Carl Edquist
2024-04-16 15:48 ` Chet Ramey
2024-04-20 23:11 ` Carl Edquist
2024-04-22 16:12 ` Chet Ramey
2024-04-17 14:37 ` Chet Ramey
2024-04-20 22:04 ` Carl Edquist
2024-03-12 3:34 ` RFE: enable buffering on null-terminated data Zachary Santer
2024-03-14 14:15 ` Carl Edquist
2024-03-18 0:12 ` Zachary Santer
2024-03-19 5:24 ` Kaz Kylheku
2024-03-19 12:50 ` Zachary Santer
2024-03-20 8:55 ` Carl Edquist
2024-04-19 0:16 ` Modify buffering of standard streams via environment variables (not LD_PRELOAD)? Zachary Santer
2024-04-19 9:32 ` Pádraig Brady [this message]
2024-04-19 11:36 ` Zachary Santer
2024-04-19 12:26 ` Pádraig Brady
2024-04-19 16:11 ` Zachary Santer
2024-04-20 16:00 ` Carl Edquist
2024-04-20 20:00 ` Zachary Santer
2024-04-20 21:45 ` Carl Edquist
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=df175303-0ce9-2311-e851-4940de68a9b2@draigBrady.com \
--to=p@draigbrady.com \
--cc=coreutils@gnu.org \
--cc=edquist@cs.wisc.edu \
--cc=kaz@kylheku.com \
--cc=libc-alpha@sourceware.org \
--cc=zsanter@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).