From: Vincent Lefevre <vincent@vinc17.net>
To: Alejandro Colomar <alx@kernel.org>
Cc: libc-alpha@sourceware.org, Eric Blake <eblake@redhat.com>,
linux-man@vger.kernel.org
Subject: Re: LINE_MAX
Date: Tue, 21 May 2024 00:26:58 +0200 [thread overview]
Message-ID: <20240520222658.GG2665@qaa.vinc17.org> (raw)
In-Reply-To: <qjp55g4oisyltajr4hckjgqjfbfwx7w5jwfgpeuqhdghppxrft@khoxlratj7kl>
On 2024-05-20 23:49:13 +0200, Alejandro Colomar wrote:
> I think I found a bug in POSIX.1-2017 (and probably, previous ones too,
> but didn't check).
I already reported the issue in 2009 about the example:
> However:
> <https://pubs.opengroup.org/onlinepubs/009695399/functions/fgets.html>:
> The following sections are informative.
> EXAMPLES
>
> Reading Input
>
> The following example uses fgets() to read each line of input. {LINE_MAX}, which defines the maximum size of the input line, is defined in the <limits.h> header.
>
> #include <stdio.h>
> ...
> char line[LINE_MAX];
> ...
> while (fgets(line, LINE_MAX, fp) != NULL) {
> ...
> }
> ...
See thread "fgets/strtok and LINE_MAX" I started on 2009-09-21
in the Austin Group mailing-list. It is available on gmane:
Path: news.gmane.org!not-for-mail
From: Vincent Lefevre <vincent-opgr-opTGSl+ZDNkdnm+yROfE0A@public.gmane.org>
Newsgroups: gmane.comp.standards.posix.austin.general
Subject: fgets/strtok and LINE_MAX
Date: Mon, 21 Sep 2009 01:03:13 +0200
Lines: 31
Approved: news@gmane.org
Message-ID: <20090920230313.GV657@prunille.vinc17.org>
[...]
There's the issue with the missing "+1", but also whether
LINE_MAX < INT_MAX.
See also
https://www.austingroupbugs.net/view.php?id=182
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
next prev parent reply other threads:[~2024-05-20 22:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-20 21:49 LINE_MAX Alejandro Colomar
2024-05-20 22:26 ` Vincent Lefevre [this message]
2024-05-21 10:08 ` LINE_MAX Alejandro Colomar
2024-05-21 11:40 ` LINE_MAX Vincent Lefevre
2024-05-20 22:35 ` LINE_MAX Lennart Jablonka
2024-05-21 10:14 ` LINE_MAX Alejandro Colomar
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=20240520222658.GG2665@qaa.vinc17.org \
--to=vincent@vinc17.net \
--cc=alx@kernel.org \
--cc=eblake@redhat.com \
--cc=libc-alpha@sourceware.org \
--cc=linux-man@vger.kernel.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