From nobody Fri Nov 20 12:04: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 4jWDXd36HLz71WtG for ; Fri, 20 Nov 2026 12:04:33 +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 4jWDXd1k7yz3QNc for ; Fri, 20 Nov 2026 12:04:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795176273; 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=2/YdKWgEeUe1Nw60r746l8BffOx6aQQi06B9ht/Ybn4=; b=UaTbopo7o6ui8stTtnQqY33yIA+9wShu7GAV0saVLKaMAJ0zbVsWdYbZF0c9IrtM6WNUnE VcPO4tzvJ3Kl3N+LQcwX9ECge5CoJ66UNKzcWyGAa+TbYIFSjSSTTQWEAeueIOHF/mor2i LGRL/S7X3HiLtjuRjye2Lij9GTmq2tjYPX52Ub4XUL/4JdxBWiJEDN8Bfoa6mHzdwHkddi UIIljH3WviIlXWh4bM1InB+buneVP31oEqEmZmyOPCV+pneU3uBE+y2Seg7YlST/h3TqV9 9QFSwx5U6LJwtftYuJrpVAVaX+bqk0CT1v03G2j3QFfbPUbID0nF+5XUjJvHMw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1795176273; b=L4OfxY57I30dD5OPie+xPXIc+Hv262Lxod97nw7QudqCXbEEQ7xGOrltFaStcTzoY05TF3 FeVmX0l6zDPQ0I0rSfTS3EbhIy0HXwoHoyA8Au/oQ3uVFUMOWgx8attR2E3eTitQP6tEs5 eGqg4nm3Gh2R5kelrLO0zSlJ2kJe9hfal4LWgdqVPbfld3xogz0UsCUPN4Z9mvwvP4KrVM UhCSB7ZtNcggiCinoQztXPkDqQwmEYbWXu6BVWGCQbzXjfmsbQoPp1xFQvZmWO2Xns3kio BeWfithB7+FpImoGxCQfDM1tAe113eJr1bLxs8ti19t2MSBj153xCw8JdJdw3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795176273; 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=2/YdKWgEeUe1Nw60r746l8BffOx6aQQi06B9ht/Ybn4=; b=lcVZD5GNoImi5f31bvdvB/cX4ShZPP67E5c4YMBs+kb1CV80/KMXkH97DCPm617hzVCYih GwP6SXWaHFw+SVhNKS659KEQdRQzMYU05KON3VVDB/jpBpC5XuqiZgpd4QMoHreGnATT6T +Vhd/SycXNBxGf94XAdk44lEil+w+lAYVIF1OSU3ODn1dp83yinzS7DrIsiMpd3TfgN0Mn tfBLrpyI2jwfUTHCA22LnMdCMGTbvy+09kW24FfHV9ao8nUqFp530ifmP8UvUwVHhgiN5m 0RCyp8WE998NS7rgmiyCftFG1/gA5TPb5Y3tSzxE8Fs5RwcEKLMyTLMiZktSbQ== 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 4jWDXd14BHznkC for ; Fri, 20 Nov 2026 12:04:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 37e3 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 20 Nov 2026 12:04:33 +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: c646af975f41 - stable/15 - 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/15 X-Git-Reftype: branch X-Git-Commit: c646af975f41fb0b4b28a8985bc430c6eb3149a6 Auto-Submitted: auto-generated Date: Fri, 20 Nov 2026 12:04:33 +0000 Message-Id: <6b003751.37e3.7433a7f3@gitrepo.freebsd.org> The branch stable/15 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=c646af975f41fb0b4b28a8985bc430c6eb3149a6 commit c646af975f41fb0b4b28a8985bc430c6eb3149a6 Author: Showta Ishizaki AuthorDate: 2026-09-28 21:55:42 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-11-20 12:03:55 +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 4fa99316321c..07b518c59214 100644 --- a/lib/libc/stdio/printf-pos.c +++ b/lib/libc/stdio/printf-pos.c @@ -357,13 +357,14 @@ reswitch: switch (ch) { if ((error = addsarg(&types, flags))) goto error; break; - 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) @@ -546,13 +547,14 @@ reswitch: switch (ch) { if ((error = addsarg(&types, flags))) goto error; break; - 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);