public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug stdio/29182] New: Make getdelim with a delimiter of EOF read the entire file
@ 2022-05-25 20:41 josephcsible at gmail dot com
0 siblings, 0 replies; only message in thread
From: josephcsible at gmail dot com @ 2022-05-25 20:41 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=29182
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 shall ensure is a character representable as an unsigned char of equal value that terminates the read process. If the delimiter argument has any other value, the behavior is undefined.
This means that calling getdelim with a delimiter of EOF is undefined behavior.
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 == EOF. The only downside of doing this that I can think of
is that it'd be incompatible with any platforms where sizeof(int) == 1, but I'm
not aware of any that we support or plan to.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-25 20:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-25 20:41 [Bug stdio/29182] New: Make getdelim with a delimiter of EOF read the entire file josephcsible at gmail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).