Re: [PATCH] scanf.3: Do not mention the ERANGE error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> > Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
> 
> 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



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux