From nobody Wed Dec 3 02:38:09 2025 X-Original-To: dev-commits-src-branches@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 4dLhdY2kBlz6JfYh for ; Wed, 03 Dec 2025 02:38:09 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dLhdY19z6z3rdx for ; Wed, 03 Dec 2025 02:38:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1764729489; 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=QUDLqbUVxs6z84GlIYubiWcucUbnwWEd3IvWsAUClI4=; b=Q3wYCkJHq0XdOr28CLPzGGnksnts/OOD6Ip22U7OCw5xKGTr7w95/nPSEjaay+KT6HQpGk jPuNV9iaes46nF5DedqXHkJzJf+FSY2G9t6xbJ/zPVF1Ri8uhcaX5uCB5oYbuSujalzXm3 iX9ofALDTYnHK2OACEkq+uPKOIVq6mehK+0Oan/rGK86/5gG56hVZMZt7CcwbkNlX1mLYP gMPdMnN17h02dEvydmEjzgPK324aNOk52TGgfqm7qtBoD3Qxi3Jrf1OdcyPbjzIjz8kRHO MwcxexA1ajhxSGv/UrJQwYDqsUv2+G1DnRIhjhfW4G6ccnpyQuo3nuYtRwDj2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1764729489; 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=QUDLqbUVxs6z84GlIYubiWcucUbnwWEd3IvWsAUClI4=; b=WALBvu8V07WAXoPUmQnV/T/mezbk1hlcTNkzIYhpu3+GDCkdLUYrm3VJj9FQxxmBSqlOpi mJWpo9E9UKabEwuAqc2QeX8U3fa1o5kj+MeREJvNIOlXLadtZgJWusgVetcAVDTd555uc9 89uByDOc8PQVmUlB7mcyZg89zdbf10QbcxyNybhaAGK9CiShWZMA+OjY9GSJ/mcm7yk6ex dkPC5+J8iDpafK47ayfJsRPvpEmHdyOnyA+oeeqoscYfeMMDuHxLRrVvD1tdyk+5gAKy2D CvsmUAlqJicuPBafr9dMwV11f8ThYcfzlKbEb9T7YJVbpohNdoTxF4EJ5TqB9g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1764729489; a=rsa-sha256; cv=none; b=wlq6vhTyVUdDXl42NC62GfZ/C0DDex8wG9TlFdGP5414HoPe5MQjaHbojzIApL9MmuxGeX MWsrHDDCi5xDIfmFGHGct3F88Jt14fRKdDJuqouFyg04U3Yn+GG5/agcURSjlFcQXDEqyf jWxhx06F72laNIS+w8NFdOjcCi41RT/2ezJspzQI7M/lW906d3Rc0W35OocRAnYDNQYX1K ty5ygq2cvZ0d6OkRtJ+yrlqINHz66S0fKGMFyuxU1OjpjkX12bn5AL+zYBsws3G9roEFI5 7Dzn7wPnY5n8zGUBluKQbWoSGIARsW8isvT33qfNC2fQxOIWx/Yf0NbacwC/FQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dLhdY04z8z397 for ; Wed, 03 Dec 2025 02:38:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2f7af by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 03 Dec 2025 02:38:09 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jose Luis Duran Subject: git: 06c2e9b7685b - stable/15 - strfmon: Fix negative sign handling for C locale List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 06c2e9b7685b630d90b20364bbe778007086a624 Auto-Submitted: auto-generated Date: Wed, 03 Dec 2025 02:38:09 +0000 Message-Id: <692fa291.2f7af.8761815@gitrepo.freebsd.org> The branch stable/15 has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=06c2e9b7685b630d90b20364bbe778007086a624 commit 06c2e9b7685b630d90b20364bbe778007086a624 Author: Jose Luis Duran AuthorDate: 2025-11-26 20:34:56 +0000 Commit: Jose Luis Duran CommitDate: 2025-12-03 02:29:13 +0000 strfmon: Fix negative sign handling for C locale If the locale's positive_sign and negative_sign values would both be returned by localeconv() as empty strings, strfmon() shall behave as if the negative_sign value was the string "-". This occurs with the C locale. The implementation previously assigned "0" to sign_posn (parentheses around the entire string); now it assigns it to "1" (sign before the string) when it is undefined (CHAR_MAX). Austin Group Defect 1199[1] is applied, changing the requirements for the '+' and '(' flags. [1]: https://www.austingroupbugs.net/view.php?id=1199 Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D53913 (cherry picked from commit cf85e7034ad5640b18a3b68d6b291b7bf89bfc80) --- lib/libc/stdlib/strfmon.c | 2 +- lib/libc/tests/stdlib/strfmon_test.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libc/stdlib/strfmon.c b/lib/libc/stdlib/strfmon.c index b19d9fc43369..611ac45b9c82 100644 --- a/lib/libc/stdlib/strfmon.c +++ b/lib/libc/stdlib/strfmon.c @@ -457,7 +457,7 @@ __setup_vars(int flags, char *cs_precedes, char *sep_by_space, char *sign_posn, if (*sep_by_space == CHAR_MAX) *sep_by_space = 0; if (*sign_posn == CHAR_MAX) - *sign_posn = 0; + *sign_posn = 1; } static int diff --git a/lib/libc/tests/stdlib/strfmon_test.c b/lib/libc/tests/stdlib/strfmon_test.c index 165ddcc2ab56..c6c20bd26985 100644 --- a/lib/libc/tests/stdlib/strfmon_test.c +++ b/lib/libc/tests/stdlib/strfmon_test.c @@ -205,8 +205,8 @@ ATF_TC_BODY(strfmon_plus_or_parenthesis, tc) { "%(i", "C", "[123.45] [(123.45)]" }, { "%(n", "en_US.UTF-8", "[$123.45] [($123.45)]" }, { "%(i", "en_US.UTF-8", "[USD123.45] [(USD123.45)]" }, - { "%n", "C", "[123.45] [(123.45)]" }, /* XXX */ - { "%i", "C", "[123.45] [(123.45)]" }, /* XXX */ + { "%n", "C", "[123.45] [-123.45]" }, + { "%i", "C", "[123.45] [-123.45]" }, { "%n", "en_US.UTF-8", "[$123.45] [-$123.45]" }, { "%i", "en_US.UTF-8", "[USD123.45] [-USD123.45]" }, }; @@ -253,7 +253,7 @@ ATF_TC_BODY(strfmon_l, tc) const char *locale; const char *expected; } tests[] = { - { "C", "[ **1234.57 ] [ **1234.57 ]" }, /* XXX */ + { "C", "[ **1234.57] [ **1234.57]" }, { "de_DE.UTF-8", "[ **1234,57 €] [ **1.234,57 EUR]" }, { "en_GB.UTF-8", "[ £**1234.57] [ GBP**1,234.57]" }, };