From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by sourceware.org (Postfix) with ESMTPS id 780F43858D34 for ; Sat, 20 Apr 2024 20:00:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 780F43858D34 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 780F43858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::62c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713643246; cv=none; b=HdbMHolUQe+DhCaIqiEZtG+p9RE2chrut3GYCtnch2pONd6EZhQTV41x+ovjZxIRHmJ0OA2OpoOoA9A7M40DnpzdcDzAqVQMnYNzMHUmDR4capPYOlm/Z58f57SlBYJvrZWpx4srAM0ctrlVAcHeUP6UTjWqhA4A/Cun7iavuN0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713643246; c=relaxed/simple; bh=QeGOVOMHqbLPmgrgoQGclUlK995vxS1+oxvvUEO0UxI=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=TXxiy2nfKbfczFlowJFd5BmHaUvXMj00tDoiAYm1fS0Rfmw5F5urKGhJrbVzecwYrneildaRY81me3MnYK4whhNT/0ZJFmLxjwZ5U4jRdxl6hFxpLooMnXCrXTSnoD7CLYDL5KMnCo5p5ljekb20EbVp6BSwNKfGa0Z4I5zDn1w= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a55996acbb0so104097566b.1 for ; Sat, 20 Apr 2024 13:00:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713643242; x=1714248042; darn=sourceware.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=jX+SLJQdOCpmJjjLOt+xd6y5hSGZhfp/v/W4sptTnWg=; b=eLHk6oWC4DKaJsYljzah7fHJWiWI7b6SNeuABggQgWnH1JcYKxu6G8cG2j4NjThh8z 2G6zMsqcsNjtjMlhpfO9QtF3wPmglwwiCJGz2O5RoFsQfDEEl5NZcSGScMuq1ocu9YWb kVKKHRJa2hxfH73hBY7/9ga1HaMLApioAfOWzugAd1/tig4Fsn26GbQQGqEIEr8EUpUH qRATvq9E8nJVLr6ZCNnBb5qf5t0xKFzwVWowct7XMwME5XuT1ShrjnWWH8joqt7n6w1P FyfThPK3JhuR3wv9AJtqWw0aIYQpyJYxEC1ITDB2Joqj1q3pQRXO9ZOYce7WWewQeAfq af5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713643242; x=1714248042; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jX+SLJQdOCpmJjjLOt+xd6y5hSGZhfp/v/W4sptTnWg=; b=vxlIZrW7qvMBRCtmWZufpn0kpJxtscjUDkkSVsr2UigLblzuegjxxRTzQkr7Sektc6 ppj75MoQiMhRzHJwG199q6qJMFszJfoSiARo8gZE31BlFaiJb7h1bhNKx35yTlHtkfY7 +zcyItjlDbOqiZazO6gXf9iia8aQdrY9ZzmqOlC6AJAXkchXiAkgFPevS6s1p46e7ScS jgFoVSdntxxiIWKZZLIE6b2zQ/YfVHX7Jkb1K5R17rAgu1WQ/vn/3FHRD2xh377bb0ls 8tVztZRU/zXGH8kWC2iYwgftlNIbBKa++iZ6pFXIkQrCRHUHnYkRiK2jPkS/Nqs1pVI8 9OTw== X-Gm-Message-State: AOJu0YxxXUTJYCsWcsswV2FHAX9UlV+4OP9CHvjBGpW1KFNeTltCGL7K B30kElxfu58hWmVy40Ib+18MPrkwpkr3BSTwJQfUvEw729zRStGLpnCJ3lJu0uK9eUF+/hWe6xB 4GTMtMhWhk83P6RKGiJoYzn91o0A= X-Google-Smtp-Source: AGHT+IHIfZK8vKihRA5cRSiPo5R12c5Iws33eUbdwBEkWD/X4iXatzRGV1E5O4PQXzJg39UhWC9N+UqqiltIM8SjnXM= X-Received: by 2002:a17:906:5811:b0:a55:6dda:a080 with SMTP id m17-20020a170906581100b00a556ddaa080mr5725560ejq.3.1713643241870; Sat, 20 Apr 2024 13:00:41 -0700 (PDT) MIME-Version: 1.0 References: <9831afe6-958a-fbd3-9434-05dd0c9b602a@draigBrady.com> <317fe0e2-8cf9-d4ac-ed56-e6ebcc2baa55@cs.wisc.edu> <8c490a55-598a-adf6-67c2-eb2a6099620a@cs.wisc.edu> <8d26e5046cc8bf49490e4aa3f6c00b09@kylheku.com> <12e70177-d115-3c0d-0603-635a14d032f1@cs.wisc.edu> In-Reply-To: <12e70177-d115-3c0d-0603-635a14d032f1@cs.wisc.edu> From: Zachary Santer Date: Sat, 20 Apr 2024 16:00:29 -0400 Message-ID: Subject: Re: Modify buffering of standard streams via environment variables (not LD_PRELOAD)? To: Carl Edquist Cc: libc-alpha@sourceware.org, coreutils@gnu.org, =?UTF-8?Q?P=C3=A1draig_Brady?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sat, Apr 20, 2024 at 11:58=E2=80=AFAM Carl Edquist = wrote: > > On Thu, 18 Apr 2024, Zachary Santer wrote: > > > > Finally had a chance to try to build with 'stdbuf --output=3DL --error= =3DL > > --' in front of the build script, and it caused some crazy problems. > > For what it's worth, when I was trying that out msys2 (since that's what > you said you were using), I also ran into some very weird errors when jus= t > trying to export LD_PRELOAD and _STDBUF_O to what stdbuf -oL sets. It wa= s > weird because I didn't see issues when just running a command (including > bash) directly under stdbuf. I didn't get to the bottom of it though and > I don't have access to a windows laptop any more to experiment. This was actually in RHEL 7. stdbuf --output=3DL --error=3DL -- "${@}" 2>&1 | tee log-file | while IFS=3D'' read -r line; do # do stuff done # And then obviously the arguments to this script give the command I want it to run. > Also I might ask, why are you setting "--error=3DL" ? > > Not that this is the problem you're seeing, but in any case stderr is > unbuffered by default, and you might mess up the output a bit by line > buffering it, if it's expecting to output partial lines for progress or > whatever. I don't know how buffering works when stdout and stderr get redirected to the same pipe. You'd think, whatever it is, it would have to be smart enough to keep them interleaved in the same order they were printed to in. That in mind, I would assume they both get placed into the same block buffer by default.