From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id 25C023849AD3 for ; Fri, 19 Apr 2024 12:26:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 25C023849AD3 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=draigBrady.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 25C023849AD3 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::329 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713529571; cv=none; b=tUCDWEzRjewvluVqyp378iHuNQSbFCYLVYjyUny30PuTrEE/f+UOCzHdGNN/9aSa338BIhrgxgnM77fMhR4Vl/lpGYRmUeYPPAs552G+FKsd4O7fWj7axJScAeC6JXBiBS9zHHwnD/2tjg0GKkGMNIx6N+fUT751MOlfG6BXaLk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713529571; c=relaxed/simple; bh=pVoih3Ik9Wd9+DaFUB5+f0mlv4Y1q/r2KU3Q9hXC//0=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=FCxnuMhw3jY1IvlWVpr7DB6Kz0CV9M+yDhPlyeQK9BsYbpmSIDiw70kFmr/Gv4L6DedkZkP6f5eY8DywE72MNG/rLk47Tl8Q3BkAqodH3CvaJ273tZH3sfE6xwnJRy43Nq/cyn6mk0TrMopJQDeimkcNZFggBNsSWO0DL58EWO8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-419c8c314d3so1201855e9.0 for ; Fri, 19 Apr 2024 05:26:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713529568; x=1714134368; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=Ot2mnV5xavszOqmJ8vvv/4sd5aHOdvnSwKzcpcWlwws=; b=aMRmR7J9KJroAmJbcOmZRYGAZgaVw4grteXV2QoEdsVBkjuonh3Pt4C16S9JYzndzL y5umK8QpQbWk+M0v7cW6Vd7XKfEtmfR+K3yW5fiTSPJRU6ntMcKqgdpXi5+YRnG0ZAcM qYoZedIH6ORE+Mq8CQ4mDHVLqpXWleU06+5FjO5Gq6wFssbHvt27YpVOpRY6qY77KLli 0dHvn7EzkDtkpzL91kSsyyMUD0FUaSaaTOwmfCh4Zr/U7i63g5KFr6OuqlGvk9Ycgt34 HfaX50DMsYMYzbRUXwcy5h9+GYfSfSAH7I3g8P1SNy0YNU9k3p7yJaoPLP0ioiXDMnd8 mtlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713529568; x=1714134368; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Ot2mnV5xavszOqmJ8vvv/4sd5aHOdvnSwKzcpcWlwws=; b=MQnbCNtq5l7yATvlspx2ez61AN37Yc5MglLawNPZS8dF2dixLHGbX7HudmWIdmDtJQ 2h6s5OMPWOCBwdrQj5R6UBin9Dwf8yPh6oLAIBhes0jOQW0VNIuEzP3uXTuKcCr8cRkV ewiwGFfGANH1JX6bYb/b17HvIAfGdzbZs/AvnLTLgHv7daPeHz8wQBedwDN/LWPoHBD6 vh+piVjRXTXBPNjuqBRCb9gh5dZ2MwNwYu+Lj34bulZRJIQqqbnk3cKanYkyIC5HuS6N XCbKfCJ4BWncYW9SvS7udFL0cGOndx25UzqczHolBCiFGRWbKTILXea6do8yt64XxlbL VvLQ== X-Forwarded-Encrypted: i=1; AJvYcCUXI4CfPza1bT0iVaFZfPD8xkUXcQijDgQmPJQNlkZzlwcIeHM8J4tGONU/JfKt+o5LWkEyJ4//d/tWF/4T+7a2vOqMBmsgiyl0 X-Gm-Message-State: AOJu0YxF0HqcJ085dlNZ7m1DVQpHKT7AdgT7nX18M8TXFBj+sUJI6rlW f5N7op1iifVPUEQMM3Wx4DVm1NAds7l8aEIUUiw+AAlG0iijvTEA X-Google-Smtp-Source: AGHT+IHUbfZwQue6ndSahCEmN34m0DbmQWSx3KnJvqnsmcGzi9qKqbJcDfUreXplqD0cTv3/SvYJgA== X-Received: by 2002:a05:600c:19cc:b0:418:e08c:865 with SMTP id u12-20020a05600c19cc00b00418e08c0865mr1252771wmq.25.1713529567546; Fri, 19 Apr 2024 05:26:07 -0700 (PDT) Received: from [192.168.1.53] (86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146]) by smtp.googlemail.com with ESMTPSA id l9-20020a1c7909000000b004167b0819aasm9982812wme.0.2024.04.19.05.26.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 19 Apr 2024 05:26:07 -0700 (PDT) Sender: =?UTF-8?Q?P=C3=A1draig_Brady?= Message-ID: Date: Fri, 19 Apr 2024 13:26:05 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Modify buffering of standard streams via environment variables (not LD_PRELOAD)? Content-Language: en-US To: Zachary Santer Cc: Carl Edquist , Kaz Kylheku , libc-alpha@sourceware.org, coreutils@gnu.org 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> From: =?UTF-8?Q?P=C3=A1draig_Brady?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 19/04/2024 12:36, Zachary Santer wrote: > 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 argue with a guy from 18 years ago... > > Ulrich Drepper wrote: >> Hell, no. Programs expect a certain buffer mode and perhaps would work >> unexpectedly if this changes. By setting a mode to unbuffered, for instance, >> you can easily DoS a system. I can think about enough other reasons why this is >> a terrible idea. Programs explicitly must request a buffering scheme so that it >> matches the way the program uses the stream. > > If buffering were set according to the env vars before the program > configures buffers on its end, if it chooses to, then the env vars > have no effect. This is how the stdbuf util works, right now. Would > programs that expect a certain buffer mode not set that mode > explicitly themselves? Are you allowing untrusted users to set env > vars for important daemons or something? How is this a valid concern? > > This is specific to the standard streams, 0-2. Buffering of stdout and > stderr is already configured dynamically by libc. If it's going to a > terminal, it's line-buffered. If it's not, it's fully buffered. Playing devil's advocate, I guess programs may be depending on the automatic buffering modes set. I guess the thinking is that it was too easy to perturb the system with env vars, though you can already do that with LD_PRELOAD. Perhaps at this stage we should consider stdbuf ubiquitous enough to suffice, noting that it's also supported on FreeBSD. I'm surprised that the LD_PRELOAD setting is breaking your ada build, and it would be interesting to determine the reason for that. cheers, Pádraig