From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9D074385E01D; Wed, 25 May 2022 20:41:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9D074385E01D From: "josephcsible at gmail dot com" To: glibc-bugs@sourceware.org Subject: [Bug stdio/29182] New: Make getdelim with a delimiter of EOF read the entire file Date: Wed, 25 May 2022 20:41:34 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: stdio X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: josephcsible at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2022 20:41:34 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D29182 Bug ID: 29182 Summary: Make getdelim with a delimiter of EOF read the entire file Product: glibc Version: unspecified Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: stdio Assignee: unassigned at sourceware dot org Reporter: josephcsible at gmail dot com Target Milestone: --- POSIX says this about getdelim: > The delimiter argument is an int, the value of which the application shal= l ensure is a character representable as an unsigned char of equal value th= at terminates the read process. If the delimiter argument has any other val= ue, the behavior is undefined. This means that calling getdelim with a delimiter of EOF is undefined behav= ior. I propose that, as a GNU extension, we define this as meaning that there is= no delimiter, and to unconditionally read until end-of-file. Implementing this= in iogetdelim.c would be as simple as skipping the memchr and just setting t to NULL if delimiter =3D=3D EOF. The only downside of doing this that I can th= ink of is that it'd be incompatible with any platforms where sizeof(int) =3D=3D 1,= but I'm not aware of any that we support or plan to. --=20 You are receiving this mail because: You are on the CC list for the bug.=