From nobody Fri Nov 20 12:04:49 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 4jWDXy4rmMz71XBD for ; Fri, 20 Nov 2026 12:04:50 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jWDXx6sR7z3QsG for ; Fri, 20 Nov 2026 12:04:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795176290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=u7oYYCOimbz4PumfKPPN+ch7PZHexcztUZWjuEhjJ9w=; b=AeUlF/+37ParZoDt2uAr2EESQWABKWOI1abJoXD2TVDunN9UiqkSh3JTQrJgHTYZeKNLfK tREWpW1a+oJZBtiMKZbWNaRsq5xUbrhSTqd0hGFUzMbBGIF5JbiHzibm+wEtz7Ip7ZQMrW 8tjEBmw2otipUy/Q84x+wP3aiAaO1K1nbFA9T+JHTmxd9RZGuX91aOKbbas3OQVcgLZQJn +QrZCDLvNL2sxUd3HYDjXaVDnNYVWTrfRXkHGtHuDruWCm6HfjVFntNYM0Al3RcgFxywiE lr3LtkyNK99f6ymHO89iMDj/tbjEvPY7AOeKEUOek/ErT+4Z6pjliYujyJejPA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1795176290; b=VWHGFglqSUg7L4xr9zlzBIIH4ypHIogUT+4bYzbghIP9XX9jV+pU+2yj6UHYIkikiU9tpH cY9smHlPffSxeFRMpmpwBFyd4H7mId+twtJfQwEkgbIiZr9jplAPpHscgSSSx9jMMyHBtC n2+ExjDJFuM4pSGNR8nDiVkXkAkQk1B1iW9O8bLgQjjiZqzBpNjK6wF1BNtNp5NtDhJgMr Eccb4C2+wKKHtqT0iq2U4Mpc2MSHAc0fhf2H53iRX/iNDZvW3e3ThOJiUZQs7ZSBG9NWRN 44uMbYT9VhiFnNTSTgwN5mXS+CURY7+5A76bezEGUn3jWNq2jumDoNQvOc33FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795176290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=u7oYYCOimbz4PumfKPPN+ch7PZHexcztUZWjuEhjJ9w=; b=GqBFYxmD8PjwldlN5qJv8WGoXswXLZkReDsUULP5u74GPhMkdEJ3hQ1rVrU1Q96wKAr1NQ dbzXdcB/M2zVqoGH+4bZkySAmynpCLRpRQk8JSFP2ikr0MAK/BKBZ6wHdDV8plaL7uyP2g B4gEBU/80ekmtzZB96PknkG7RFxJXP8PPEj4PxIz1l3VLdf2vXTH/DjiU6QxDa6lsjWom5 G1n6n1iG9NJKQm+5R0UNgZd4xyWOJOTh75oShLDN7aetmLDjNMNYoG4kEZWfZSHyXAriAe 4oLO8KSiNQBpUuNPwr8oo/bWUIOyZI/7kMrDAuvo/9dwojKBSDMy0gQvXwrSUw== 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 4jWDXx64yvzny0 for ; Fri, 20 Nov 2026 12:04:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 383e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 20 Nov 2026 12:04:49 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Showta Ishizaki From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: dd5393b28af2 - stable/14 - stdio: Fix positional %F conversion List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository 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: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: dd5393b28af20abebc82fe1cdd32e415cc18d88d Auto-Submitted: auto-generated Date: Fri, 20 Nov 2026 12:04:49 +0000 Message-Id: <6b003761.383e.75fac1b9@gitrepo.freebsd.org> The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=dd5393b28af20abebc82fe1cdd32e415cc18d88d commit dd5393b28af20abebc82fe1cdd32e415cc18d88d Author: Showta Ishizaki AuthorDate: 2026-09-28 21:55:42 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-11-20 12:04:05 +0000 stdio: Fix positional %F conversion When a format uses positional arguments, __find_arguments() walks it first to learn the type of every argument, and lists the floating point conversions as A a E e f G g. F is missing, so a double that is only referred to through %F never gets a type, its slot in the argument table stays unset, and the conversion reads whatever is there: printf("[%1$F]\n", -INFINITY); [0.000000] printf("[%1$F]\n", 1.5); [0.000000] printf("[%F]\n", 1.5); [1.500000] With a width taken from another argument, "%1$*2$F", vsnprintf(3) returned lengths like 2103024 for a ten character result; abseil's str_format test allocates that much and was killed for it on FreeBSD. The same format with %1$f, or with any other conversion of the same argument, works because those give it a type. Add F ahead of f in both __find_arguments() and __find_warguments(), and test %F, plain and positional, in snprintf_test and swprintf_test. MFC after: 1 week Signed-off-by: Showta Ishizaki Pull Request: https://github.com/freebsd/freebsd-src/pull/2420 (cherry picked from commit eb647dd28137c5f44030645a648e5a8c24e16f4f) --- lib/libc/stdio/printf-pos.c | 14 ++++++++------ lib/libc/tests/stdio/snprintf_test.c | 13 +++++++++++++ lib/libc/tests/stdio/swprintf_test.c | 13 +++++++++++++ 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/lib/libc/stdio/printf-pos.c b/lib/libc/stdio/printf-pos.c index 77a1218ccd91..394ec98e7e85 100644 --- a/lib/libc/stdio/printf-pos.c +++ b/lib/libc/stdio/printf-pos.c @@ -363,13 +363,14 @@ reswitch: switch (ch) { goto error; break; #ifndef NO_FLOATING_POINT - case 'a': case 'A': - case 'e': + case 'a': case 'E': + case 'e': + case 'F': case 'f': - case 'g': case 'G': + case 'g': error = addtype(&types, (flags & LONGDBL) ? T_LONG_DOUBLE : T_DOUBLE); if (error) @@ -556,13 +557,14 @@ reswitch: switch (ch) { goto error; break; #ifndef NO_FLOATING_POINT - case 'a': case 'A': - case 'e': + case 'a': case 'E': + case 'e': + case 'F': case 'f': - case 'g': case 'G': + case 'g': error = addtype(&types, (flags & LONGDBL) ? T_LONG_DOUBLE : T_DOUBLE); if (error) diff --git a/lib/libc/tests/stdio/snprintf_test.c b/lib/libc/tests/stdio/snprintf_test.c index 29b908b65120..c8f04b7e5524 100644 --- a/lib/libc/tests/stdio/snprintf_test.c +++ b/lib/libc/tests/stdio/snprintf_test.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -81,6 +82,17 @@ ATF_TC_BODY(snprintf_d, tc) SNPRINTF_TEST("2,147,483,647", "%'d", INT_MAX); } +ATF_TC_WITHOUT_HEAD(snprintf_F); +ATF_TC_BODY(snprintf_F, tc) +{ + SNPRINTF_TEST("1.500000", "%F", 1.5); + SNPRINTF_TEST("INF", "%F", INFINITY); + SNPRINTF_TEST("-INF", "%F", -INFINITY); + SNPRINTF_TEST("1.500000", "%1$F", 1.5); + SNPRINTF_TEST("-INF", "%1$F", -INFINITY); + SNPRINTF_TEST(" 1.500000", "%1$*2$F", 1.5, 10); +} + ATF_TC_WITHOUT_HEAD(snprintf_x); ATF_TC_BODY(snprintf_x, tc) { @@ -197,6 +209,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, snprintf_b); ATF_TP_ADD_TC(tp, snprintf_B); ATF_TP_ADD_TC(tp, snprintf_d); + ATF_TP_ADD_TC(tp, snprintf_F); ATF_TP_ADD_TC(tp, snprintf_x); ATF_TP_ADD_TC(tp, snprintf_X); ATF_TP_ADD_TC(tp, snprintf_wN); diff --git a/lib/libc/tests/stdio/swprintf_test.c b/lib/libc/tests/stdio/swprintf_test.c index f00ecc7f1c1d..fe2957928344 100644 --- a/lib/libc/tests/stdio/swprintf_test.c +++ b/lib/libc/tests/stdio/swprintf_test.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -82,6 +83,17 @@ ATF_TC_BODY(swprintf_d, tc) SWPRINTF_TEST("2,147,483,647", "%'d", INT_MAX); } +ATF_TC_WITHOUT_HEAD(swprintf_F); +ATF_TC_BODY(swprintf_F, tc) +{ + SWPRINTF_TEST("1.500000", "%F", 1.5); + SWPRINTF_TEST("INF", "%F", INFINITY); + SWPRINTF_TEST("-INF", "%F", -INFINITY); + SWPRINTF_TEST("1.500000", "%1$F", 1.5); + SWPRINTF_TEST("-INF", "%1$F", -INFINITY); + SWPRINTF_TEST(" 1.500000", "%1$*2$F", 1.5, 10); +} + ATF_TC_WITHOUT_HEAD(swprintf_x); ATF_TC_BODY(swprintf_x, tc) { @@ -198,6 +210,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, swprintf_b); ATF_TP_ADD_TC(tp, swprintf_B); ATF_TP_ADD_TC(tp, swprintf_d); + ATF_TP_ADD_TC(tp, swprintf_F); ATF_TP_ADD_TC(tp, swprintf_x); ATF_TP_ADD_TC(tp, swprintf_X); ATF_TP_ADD_TC(tp, swprintf_wN);