From nobody Wed Aug 26 10:12:33 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 4hVL7B6V6kz6ppvY for ; Wed, 26 Aug 2026 10:12:38 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hVL7B3gzZz42Xq for ; Wed, 26 Aug 2026 10:12:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1787739158; 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=UQfatiCQpuL1mzviyQ0V0vdtc1FMBlt44GiRs1iZxe0=; b=fcEq403AcHekcl2HAc9qqwvhbFDDLReUbOODX3zI+H1mtvNaYvvjUVLsdXRKLFmJeGfBg/ PSMU+8WEQGn18P1wpvGAJnOFvFsawzuiTngGCPfmk5nuS42S5MW5BSn83qostVElicDbeW pJtNbPBg+GKPEm8s0EbgN2KKdVrazshCloaXGHgRRVENOpfI5ZZPZYIUI7N0IVaPhWCzmi 5ikgo8eDHw28P9K/EdMDpR6De1yu2EePWg2RO/gtRhNdgvUyqCqjbuyCxsk1DxpYPq/Lg0 B+RhdbZZjqCNBretgMZsB8cGynoaov37dyEp2KpRkiJiuT84wKBWwUndNRYfMg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1787739158; a=rsa-sha256; cv=none; b=Hw9pMa1PqrZG6KabxiyqVA3IB3m56bvlawF42VJZkK8A/dsnhASYRDCSyQhUnScx0rBMKI abqy9VuYkmhMR8TNgC+5pXsodkIueiKANFpzGdD8Fs9YCWzwEndNv1F6evW9YXDcm0WmJt hSW9dYzEJItlbXOB7EzdyfZVftdvdRxX/q+lbZOFkDdzYosAh/jw/YqnrpPVS3NZk6CUUS iGX45bcZh8LAcEtGhxbaThlm2ZaMpXydIP8zZportBvBXCVeIYYNb8js9nPuX/9O7E03nA bJzbJXo6TCCD/vEG2ooj/le5/ahpnAJAsZRmp7eRP1HHiwh9BvYwZj0TE6H+AA== 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=1787739158; 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=UQfatiCQpuL1mzviyQ0V0vdtc1FMBlt44GiRs1iZxe0=; b=gN+MHYOYcx+pvH1MYlRlKJ2KbmTczPgYP+5U7msrQkdhTTPfJEMCmu2yF3Z3jnJDw4GmV9 5rvvstqHVXPqvUpDp4DuYkNbOK7e3pMScQM1M86Oo6ybM1b1/I7TXi6PRBE+7uT+d9E/xA yqxi3wpyDtFoGCPxDgKTDtVOc89pdLkwHI1pUv2TNDg6K3viFtAxiEBtCflwc3grkWp71I wgpuXJyJo2Rzb4BMUpHhGex6NwD0GacxSQjtXD5GGwdgjvov1HZjO5Q2sNtiFMu4LkAXjg uVJnVkbf5+MENqmtPIjU+qbAL/E1pY+8fF6MtjysLb2lF6hHpOZ9o0yQSJV3uA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hVL7B25bDzZCx for ; Wed, 26 Aug 2026 10:12:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 38cb6 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 26 Aug 2026 10:12:33 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lexi Winter Subject: git: d15778bbb910 - stable/15 - 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/stable/15 X-Git-Reftype: branch X-Git-Commit: d15778bbb91055d9cee22228e8b07bdab4795294 Auto-Submitted: auto-generated Date: Wed, 26 Aug 2026 10:12:33 +0000 Message-Id: <6a8ebc11.38cb6.1b48ace7@gitrepo.freebsd.org> The branch stable/15 has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=d15778bbb91055d9cee22228e8b07bdab4795294 commit d15778bbb91055d9cee22228e8b07bdab4795294 Author: Lexi Winter AuthorDate: 2026-08-03 14:02:51 +0000 Commit: Lexi Winter CommitDate: 2026-08-26 09:56:12 +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 (cherry picked from commit f1d98862044f7748c6f930e9d4339abc166a5b16) --- 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;