From nobody Mon Aug 3 14:30:40 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hDJxY0HTPz6nV3q for ; Mon, 03 Aug 2026 14:30:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hDJxX6Nznz3stL for ; Mon, 03 Aug 2026 14:30:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785767440; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tO7Us9uFADpUHYJiS3M0R7DWxucYjf4qG8jPyrtnLkU=; b=cXYNXbgoANrKC/+i1zN003lp6C9z3ceYpSvXDyLnLPlBUfSYYHbM0Dlaaobw0eCqBS5etn 1wy6A3ONN6n2LbLxZMga+La+Ud6Tblx2yVlfldn4DOKOoDalTR0deGsCy3rnqo8i1cW0e8 bk/fQOeJZssc4UchWwWshTzOXY07gPsh7IBLmfDpUF1sol7iDybdK/cftMMdnF27uCoTsE PXBN/cC10Oz+KchKj5dUSOaHNA69SwB6/4kA05/wUl9YHcmOGK6twuvGmn4jUSX/Bzp4oh PDhoaWMXGjt46vlWs90opnti7ZTVIxE2vVUduf1R7UI0XbN5WMvQfkwsAzuzmA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1785767440; a=rsa-sha256; cv=none; b=A/sC99a2k52kFYATXxzN78Nx1enlTcykv6GX5FSlY+yxaVqN56tRF3U3G1SktOtVwrjupz bDYYqMA1ADCsuBQLt34WwxCAKgIyExIRQsMz4yMLign+8Iz7/t3XXqrhbXcG5lbSOK+UY0 0tbpwx9vE3tJip8jTxsRmccxP2Yw4EdSLgEZp0AbrQX2Y9KdDtqOFkqSmL1gnWfpysY0aj yE0PUrnIFM4G0/uwdTup7CuBmQ6/C3b2KecRL8Lw2DTd55Pm08NrVRKgAe/tysdBGNPQTn u7l0FZLhdYatyYzMV/GXARQe18c6QUrQT3Eo6FQ0bUiLOa1f/GUsHNsJUZmd6Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785767440; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tO7Us9uFADpUHYJiS3M0R7DWxucYjf4qG8jPyrtnLkU=; b=pLY+d5CUv6FbWxIN6HDkVvqOjbbEe6lINY/MY3/MwYZ/O8XkGF4tHCI0c+ma53VunQ4Xc5 UlqH4sTCp7monREmvmKtFZRLPjCqqOFANK8Q5ZXixprgsVCfr1IsZdHnp+5BMLF8bCXAb0 857nfUAy+Kz8JRgNHHLx29jQwzCFE3HDu7MMwcp71cwcCL0tbMSrm4gMsibYe8tilvAFQ0 kz94NcGkXHSPgAFpCinEMoRkQVWPMOuvJC0YbsY8NhUTOHGRQY+iNDmdBgk3RAWrvV+vtZ wweZNiLKlpnTqK5lwRyuF7V50ehSy5hGtDd/5cdE9RcQWwRhnetN2+XCQTHZcA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hDJxX52Mwz14Ll for ; Mon, 03 Aug 2026 14:30:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 37a4b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 03 Aug 2026 14:30:40 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lexi Winter Subject: git: f1d98862044f - main - libc: getopt{,_long}: Const correctness for C23 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ivy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f1d98862044f7748c6f930e9d4339abc166a5b16 Auto-Submitted: auto-generated Date: Mon, 03 Aug 2026 14:30:40 +0000 Message-Id: <6a70a610.37a4b.9b19e8a@gitrepo.freebsd.org> The branch main has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=f1d98862044f7748c6f930e9d4339abc166a5b16 commit f1d98862044f7748c6f930e9d4339abc166a5b16 Author: Lexi Winter AuthorDate: 2026-08-03 14:02:51 +0000 Commit: Lexi Winter CommitDate: 2026-08-03 14:02:51 +0000 libc: getopt{,_long}: Const correctness for C23 On some platforms, e.g. Linux Clang 22.1.8 / glibc 2.43, strchr() now implements the C23 behaviour where passing a const pointer to strchr() also returns a const pointer. This breaks getopt during the bootstrap build, since it assumes the return value is always a mutable pointer. Since the pointed-to value is never modified, fix this by making the pointer const. MFC after: 1 week Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D58488 --- lib/libc/stdlib/getopt.c | 2 +- lib/libc/stdlib/getopt_long.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/stdlib/getopt.c b/lib/libc/stdlib/getopt.c index 2b5e3fa69032..e1edc5a3ee83 100644 --- a/lib/libc/stdlib/getopt.c +++ b/lib/libc/stdlib/getopt.c @@ -57,7 +57,7 @@ int getopt(int nargc, char * const nargv[], const char *ostr) { static char *place = EMSG; /* option letter processing */ - char *oli; /* option letter list index */ + const char *oli; /* option letter list index */ if (optreset || *place == 0) { /* update scanning pointer */ optreset = 0; diff --git a/lib/libc/stdlib/getopt_long.c b/lib/libc/stdlib/getopt_long.c index 5cf6a55649bd..99be520fe332 100644 --- a/lib/libc/stdlib/getopt_long.c +++ b/lib/libc/stdlib/getopt_long.c @@ -349,7 +349,7 @@ static int getopt_internal(int nargc, char * const *nargv, const char *options, const struct option *long_options, int *idx, int flags) { - char *oli; /* option letter list index */ + const char *oli; /* option letter list index */ int optchar, short_too; static int posixly_correct = -1;