From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 15F3E1F44D for ; Wed, 20 Mar 2024 08:54:47 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (2048-bit key; secure) header.d=cs.wisc.edu header.i=@cs.wisc.edu header.a=rsa-sha256 header.s=csl-2018021300 header.b=dBV9e+/w; dkim-atps=neutral Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D55E13858414 for ; Wed, 20 Mar 2024 08:54:45 +0000 (GMT) Received: from smtpout2.cs.wisc.edu (smtpout2.cs.wisc.edu [128.105.6.54]) by sourceware.org (Postfix) with ESMTPS id 6C7813858D1E for ; Wed, 20 Mar 2024 08:54:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6C7813858D1E Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=cs.wisc.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cs.wisc.edu ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6C7813858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=128.105.6.54 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710924862; cv=none; b=gfDd/yfjE/C5jI8D5yr/7ReLYurtvlCXiO7TQpLbpNfnjS113Ff8Qxsz5bpEdzHHTQ7oFgYLAyOW9Mc1JLBglbnJwzmpj5FzUgnsuI69BUZFf1BoLOnbnscxSFsapknjfUc8qJdtHeaqnP5BYkfFeIvgsD8LD3xakSuiguIBpCg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710924862; c=relaxed/simple; bh=1f613HNjxm8/5aTW9rl+WIPZ7hrmTQxmBQWs2C521pc=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=J2poxUWprcTw7RLMEFEHe6e9R0/6yeXWTekd/JmHXBnJ4pKrFqgAjF9tHLRKd1Ybm2bkRj3PEKVYRejfHnjsMli5ciflF0EQs22TnSavGRPaNB6YzfyuY1uGXIxAulxVe2xrrPjV142eTRv3cu9f1deyMX2CLKVXLzDZUJXBbNk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from alumni.cs.wisc.edu (alumni.cs.wisc.edu [128.105.2.11]) by flint.cs.wisc.edu (8.14.7/8.14.4) with ESMTP id 42K8rtgm007671; Wed, 20 Mar 2024 03:53:55 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 flint.cs.wisc.edu 42K8rtgm007671 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.wisc.edu; s=csl-2018021300; t=1710924836; bh=OHMt8ZDrIuzoet8SHUPYNLk13mAx9v2DAsUkqddt6nQ=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=dBV9e+/wOhnCOM36sz9/PacMNy7k6rIa+8P0NwdXNRshlvQkBUF292YFCduFqK7ID b/tV9lKboA3/VwYiX60krYovSqiS99hYXYaPObh5FWbxBKWt2UYF9X09SDEQv5WXYN g9xczX/c+fyHkTOlBk1BldQOWy4mrRGPgOhfyC0hDhQM64g/F3jyxB2bqPwUCCMWbz BzP8RliXhAdr2eFRJe5uLlsZGfZPjkBdw9wxY7/T8yvUxUm0hedFnvcg34S6YWyCIq 896pS5pSBv4uKTfZGICAiuhsLO3ACPVaLf1vAdLZECh5brvl3GZ3YHHmu6oRHB2S1O r/j2oolUFMEhA== Received: from localhost (localhost.localdomain [127.0.0.1]) by alumni.cs.wisc.edu (Postfix) with ESMTP id AF18C1E0847; Wed, 20 Mar 2024 03:53:53 -0500 (CDT) Date: Wed, 20 Mar 2024 03:55:25 -0500 (CDT) From: Carl Edquist To: Zachary Santer cc: Kaz Kylheku , libc-alpha@sourceware.org, coreutils@gnu.org, p@draigbrady.com Subject: Re: RFE: enable buffering on null-terminated data In-Reply-To: Message-ID: 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> MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY=-14637610751835812725171092475525314 Content-ID: <9c634266-1d16-3049-46eb-13c61090695d@cs.wisc.edu> X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---14637610751835812725171092475525314 Content-Type: text/plain; CHARSET=utf-8; format=flowed Content-Transfer-Encoding: 8BIT Content-ID: <97eab712-60b9-62ce-0412-41820ab200a6@cs.wisc.edu> On Tue, 19 Mar 2024, Zachary Santer wrote: > 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. Yay! :D And since tee uses fwrite to copy whatever input is available, that will mean 'records' are output on the same boundaries as the input (whether that be newlines, nuls, or just block boundaries). So putting tee in the middle of a pipeline shouldn't itself interfere with whatever else you're up to. (AND it's still relatively efficient, compared to some tools like cut that putchar a byte at a time.) My note about pipelines like this though: $ ./build.sh | sed s/what/ever/ | tee build.log is that with the default stdio buffering, while all the commands in build.sh will be implicitly self-flushing, the sed in the middle will end up batching its output into blocks, so tee will also repeat them in blocks. 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. (But, proof's in the pudding, so whatever works for you :D ) Happy putting all the way! Carl ---14637610751835812725171092475525314--