From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id A680924B53 for ; Tue, 12 Mar 2024 15:31:31 +0100 (CET) Received: (qmail 15914 invoked by uid 550); 12 Mar 2024 14:27:14 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 15891 invoked from network); 12 Mar 2024 14:27:14 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710253874; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=PHPXxdsgcmGJ3bvKcmn+oZVCWrkQe5q07FFatxDg7+I=; b=eOULuJ/Nbw5t4gX30msEGe8vcysjFg2sPEsdcF2Fz4i8od88zuVVnt99THo1nfF5G3Gr3j kvJDPwOPh5wrzo3+Mqmv/BCKSLoLOn4e2PHhuqD2BJh4ROLmx83Ou3fcnntZ+UEyFyHtFe oXhRohs0Q3IgfdJrEqsvftvNu0bB0wY= X-MC-Unique: Pw7xWaSUPZGiLnckFJKZHQ-1 From: Florian Weimer To: "Zack Weinberg" Cc: "Gabriel Ravier" , "Rich Felker" , "Skyler Ferrante (RIT Student)" , musl@lists.openwall.com, "Andreas Schwab" , "Alejandro Colomar" , "Thorsten Glaser" , NRK , "Guillem Jover" , "GNU libc development" , libbsd@lists.freedesktop.org, "Serge E. Hallyn" , "Iker Pedrosa" , "Christian Brauner" References: <20240310193956.GU4163@brightrain.aerifal.cx> <20240310234410.GW4163@brightrain.aerifal.cx> <20240311194756.GY4163@brightrain.aerifal.cx> <40962405-c5b4-4925-9ca5-7a1c723ebbfd@gmail.com> <875xxrv9mm.fsf@oldenburg.str.redhat.com> <84bf19d7-c2ba-46e7-a77d-ecc6497f08a1@app.fastmail.com> Date: Tue, 12 Mar 2024 15:31:04 +0100 In-Reply-To: <84bf19d7-c2ba-46e7-a77d-ecc6497f08a1@app.fastmail.com> (Zack Weinberg's message of "Tue, 12 Mar 2024 10:21:19 -0400") Message-ID: <87o7bjttcn.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Subject: Re: [musl] Re: Tweaking the program name for functions * Zack Weinberg: > On Tue, Mar 12, 2024, at 9:54 AM, Florian Weimer wrote: >>> Doing this would break many programs, such as: >>> - most of coreutils, e.g. programs like ls, cat or head, since they >>> always `close` their input and output descriptors (when they've >>> written or read something) to make sure to diagnose all errors >> >> A slightly better way to do this is to do fflush (stdout) followed by >> error checking on close (dup (fileno (stdout))). > > Does that actually report delayed write errors? As you have it, > the close() just drops the fd created by the dup(), the OFD is > still referenced by fd 1 and therefore remains open. I don't think the VFS close action is subject to reference counting. Otherwise the current coreutils error checking wouldn't work because in many cases, another process retains a reference to the OFD. Thanks, Florian