NetBSD Problem Report #59199

From www@netbsd.org  Wed Mar 19 23:43:41 2025
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 6AF4C1A9239
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 19 Mar 2025 23:43:41 +0000 (UTC)
Message-Id: <20250319234340.0BF391A923C@mollari.NetBSD.org>
Date: Wed, 19 Mar 2025 23:43:40 +0000 (UTC)
From: alx@kernel.org
Reply-To: alx@kernel.org
To: gnats-bugs@NetBSD.org
Subject: nullability of rstatus parameter in strtoi(3) and strtou(3)
X-Send-Pr-Version: www-1.0

>Number:         59199
>Category:       lib
>Synopsis:       nullability of rstatus parameter in strtoi(3) and strtou(3)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 19 23:45:00 +0000 2025
>Last-Modified:  Thu Mar 20 08:43:51 +0000 2025
>Originator:     Alejandro Colomar
>Release:        10.1
>Organization:
Linux man-pages project, C Committee (WG14), shadow-utils
>Environment:
>Description:
There seem to be exactly zero callers of these APIs that are not interested in the status, in NetBSD.

alx@devuan:~/src/bsd/netbsd/trunk$ find -type f \
    | grep '\.[ch]$' \
    | xargs grep -l '\<strto[iu]\>' \
    | xargs pcre2grep -Mn '(?s)\bstrto[iu] *\([^;]*(NULL|0)\)';
alx@devuan:~/src/bsd/netbsd/trunk$


In Debian, there seems to be one, but it's a test case, so I guess we can just talk to them and ask them to update the test.

<https://codesearch.debian.net/search?q=%5Cbstrto%5Bui%5D+*%5C%28.*NULL%5C%29&literal=0>

The main point of this API is that it simplifies error handling compared to strtol(3).  But if one doesn't care about errors, strtol is just as good.  (Well, the clamping behavior is nice, but I think it really makes little sense to not check for errors, and it seems everybody else agrees?)

I don't have a strong opinion, but what do you think?
>How-To-Repeat:

>Fix:
Require status to be non-null for strtoi(3) and strtou(3).

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: misc-bug-people->lib-bug-people
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Thu, 20 Mar 2025 08:43:51 +0000
Responsible-Changed-Why:
Over to the libary team


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.