public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Alejandro Colomar <alx.manpages@gmail.com>
Cc: Ian Abbott <abbotti@mev.co.uk>, Zack Weinberg <zack@owlfolio.org>,
	linux-man@vger.kernel.org,
	Michael Kerrisk <mtk.manpages@gmail.com>,
	Alejandro Colomar <alx@kernel.org>
Subject: Re: [PATCH] scanf.3: Do not mention the ERANGE error
Date: Thu, 19 Jan 2023 20:09:11 -0800	[thread overview]
Message-ID: <Y8oT53gEtkAOX0Zb@sol.localdomain> (raw)
In-Reply-To: <633629bd-753c-3097-9896-2491a0b0f1a2@gmail.com>

Hi Alejandro,

On Mon, Dec 12, 2022 at 12:33:08PM +0100, Alejandro Colomar wrote:
> > Documenting `ERANGE` in the ERRORS section kind of implies that
> > `scanf()` should return `EOF` when an integer overflow is encountered,
> > which it doesn't (and doing so would violate the C standard).
> > 
> > Just remove any mention of the `ERANGE` error to avoid confusion.
> > 
> > Fixes: 646af540e467 ("Add an ERRORS section documenting at least some of the errors that may occur for scanf().")
> > Cc: Michael Kerrisk <mtk.manpages@gmail.com>
> > Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
> 
> I applied the patch; thanks!  And also applied another one explicitly
> marking all those numeric conversion specifiers as deprecated:
> 
> <https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=a15d34326c581eab107bf05782cc60d8ebdcad69>
> 
> Cheers,
> 

This is commonly used functionality with no replacement suggested.  Should it
really be deprecated?  Is the undefined behavior here a real world issue
anywhere, or is this just a theoretical issue based on interpretation of the C
standard?  Perhaps instead of a deprecation, this just deserves a mention in the
BUGS section of the man page, and a request to the C standard committee to fix
the text in the standard to make the behavior defined?

I'll note that memcpy() is not deprecated, even though the C standard has a bug
where 'memcpy(dst, src, 0)' is undefined if either pointer is NULL.  That's a
very similar sort of issue.  The fix, of course, is for implementations to
ignore the defective standard and make the behavior defined...

- Eric

  reply	other threads:[~2023-01-20  4:36 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-08 12:34 [PATCH] scanf.3: Do not mention the ERANGE error Ian Abbott
2022-12-09 18:59 ` Alejandro Colomar
2022-12-09 19:28   ` Ian Abbott
2022-12-09 19:33     ` Alejandro Colomar
2022-12-09 21:41       ` Zack Weinberg
2022-12-11 15:58         ` Alejandro Colomar
2022-12-11 16:03           ` Alejandro Colomar
2022-12-12  2:11           ` Zack Weinberg
2022-12-12 10:21             ` Alejandro Colomar
2022-12-14  2:13               ` Zack Weinberg
2022-12-14 10:47                 ` Alejandro Colomar
2022-12-14 11:03                   ` Ian Abbott
2022-12-29  6:42                     ` Zack Weinberg
2022-12-29  6:39                   ` Zack Weinberg
2022-12-29 10:47                     ` Alejandro Colomar
2022-12-29 16:35                       ` Zack Weinberg
2022-12-29 16:39                         ` Alejandro Colomar
2022-12-12 15:22             ` Ian Abbott
2022-12-14  2:18               ` Zack Weinberg
2022-12-14 10:22                 ` Ian Abbott
2022-12-14 10:39                   ` Alejandro Colomar
2022-12-14 10:52                     ` Ian Abbott
2022-12-14 11:23                       ` Alejandro Colomar
2022-12-14 14:10                         ` Ian Abbott
2022-12-14 16:38                         ` Joseph Myers
2022-12-12 10:07       ` Ian Abbott
2022-12-12 11:33 ` Alejandro Colomar
2023-01-20  4:09   ` Eric Biggers [this message]
2023-01-20 13:12     ` Alejandro Colomar
2023-01-20 17:55       ` G. Branden Robinson
2023-01-20 22:02         ` Alejandro Colomar
2023-01-20 19:41       ` Eric Biggers

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=Y8oT53gEtkAOX0Zb@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=abbotti@mev.co.uk \
    --cc=alx.manpages@gmail.com \
    --cc=alx@kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=zack@owlfolio.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