public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "josephcsible at gmail dot com" <sourceware-bugzilla@sourceware.org>
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	[thread overview]
Message-ID: <bug-29182-131@http.sourceware.org/bugzilla/> (raw)

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.

                 reply	other threads:[~2022-05-25 20:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29182-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).