<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libc/tests/stdio, branch main</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>Fix floaing point test. (again)</title>
<updated>2025-09-14T14:48:40+00:00</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2025-09-14T14:48:40+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=455426da078cbbea8160bf4232b3fd1ae56e2ff5'/>
<id>455426da078cbbea8160bf4232b3fd1ae56e2ff5</id>
<content type='text'>
Fixes: 9dd78db9c30a
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes: 9dd78db9c30a
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix floaing point test.</title>
<updated>2025-09-14T12:14:02+00:00</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2025-09-14T11:52:16+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=4c91a542d30156ba693222c5bb85856aef004c9d'/>
<id>4c91a542d30156ba693222c5bb85856aef004c9d</id>
<content type='text'>
I botched a style fix to a pull request, and didn't catch it on amd64,
but it broke almost everything else. It's a false positive to the style
program and spaces cannot be inserted here. It's not math, but a funky
notation.

Fixes: 9dd78db9c30a
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I botched a style fix to a pull request, and didn't catch it on amd64,
but it broke almost everything else. It's a false positive to the style
program and spaces cannot be inserted here. It's not math, but a funky
notation.

Fixes: 9dd78db9c30a
</pre>
</div>
</content>
</entry>
<entry>
<title>libc: prevent incorrect %a/%La rounding at full precision</title>
<updated>2025-09-14T03:09:26+00:00</updated>
<author>
<name>Osamu Sho</name>
<email>osamusho@gmail.com</email>
</author>
<published>2025-09-04T02:34:34+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=9dd78db9c30a220ac3e8e65d89548ff99c14dd90'/>
<id>9dd78db9c30a220ac3e8e65d89548ff99c14dd90</id>
<content type='text'>
In __hdtoa() and __hldtoa(), rounding is incorrectly applied when
the requested precision exactly matches the number of significant
hexadecimal digits. In this case, the redux adjustment can trigger
an unintended exponent increment and shift the rounding position
left by one bit. This causes the least significant digit to be
rounded incorrectly.

The fix adds a new condition based on MAX_HEX_DIGITS (derived from
MANT_DIG) so that rounding is performed only when precision is
strictly less than the number of significant digits. This avoids
the unintended shift while preserving correct rounding for other
cases.

A new regression test
(printfloat_test:hexadecimal_rounding_offset_eq_exp) covers both
the binary64 (%.13a) and binary128 (%.28La on arm64) cases that
previously fail, ensuring the bug does not regress.

Note: MAX_HEX_DIGITS represents the maximum number of hexadecimal
digits needed to express the mantissa. It is computed by subtracting
the implicit integer bit from [L]DBL_MANT_DIG, dividing the remaining
mantissa bits by 4 (with +3 to round up any remainder), and finally
adding +1 for the leading integer digit. This makes its meaning
explicit and distinct from SIGFIGS, which serves a different purpose.

Fixes: 76303a9735ee ("Make several changes to the way printf handles hex floating point (%a):")
Signed-off-by: Osamu Sho &lt;osamusho@gmail.com&gt;
Reviewed by: imp,jlduran
Pull Request: https://github.com/freebsd/freebsd-src/pull/1837
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In __hdtoa() and __hldtoa(), rounding is incorrectly applied when
the requested precision exactly matches the number of significant
hexadecimal digits. In this case, the redux adjustment can trigger
an unintended exponent increment and shift the rounding position
left by one bit. This causes the least significant digit to be
rounded incorrectly.

The fix adds a new condition based on MAX_HEX_DIGITS (derived from
MANT_DIG) so that rounding is performed only when precision is
strictly less than the number of significant digits. This avoids
the unintended shift while preserving correct rounding for other
cases.

A new regression test
(printfloat_test:hexadecimal_rounding_offset_eq_exp) covers both
the binary64 (%.13a) and binary128 (%.28La on arm64) cases that
previously fail, ensuring the bug does not regress.

Note: MAX_HEX_DIGITS represents the maximum number of hexadecimal
digits needed to express the mantissa. It is computed by subtracting
the implicit integer bit from [L]DBL_MANT_DIG, dividing the remaining
mantissa bits by 4 (with +3 to round up any remainder), and finally
adding +1 for the leading integer digit. This makes its meaning
explicit and distinct from SIGFIGS, which serves a different purpose.

Fixes: 76303a9735ee ("Make several changes to the way printf handles hex floating point (%a):")
Signed-off-by: Osamu Sho &lt;osamusho@gmail.com&gt;
Reviewed by: imp,jlduran
Pull Request: https://github.com/freebsd/freebsd-src/pull/1837
</pre>
</div>
</content>
</entry>
<entry>
<title>stdio: Fix bug in integer-parsing FSM</title>
<updated>2025-08-08T22:46:03+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-08-08T22:17:19+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=602e98dd35ea5041b800fb56a2b1ac34f6649310'/>
<id>602e98dd35ea5041b800fb56a2b1ac34f6649310</id>
<content type='text'>
If we encounter a zero in the havezero state, we should assume octal,
just like we would if we encountered any other digit below 8.

MFC after:	1 week
PR:		288440
Fixes:		d9dc1603d6e4 ("libc: Implement N2630.")
Reviewed by:	mandree
Differential Revision:	https://reviews.freebsd.org/D51832
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If we encounter a zero in the havezero state, we should assume octal,
just like we would if we encountered any other digit below 8.

MFC after:	1 week
PR:		288440
Fixes:		d9dc1603d6e4 ("libc: Implement N2630.")
Reviewed by:	mandree
Differential Revision:	https://reviews.freebsd.org/D51832
</pre>
</div>
</content>
</entry>
<entry>
<title>libc: Fix style nits in flushlbuf regression test</title>
<updated>2025-08-07T13:34:45+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-08-07T13:33:55+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=a39277782140d65abd792cf06694661a526464d0'/>
<id>a39277782140d65abd792cf06694661a526464d0</id>
<content type='text'>
Sponsored by:	Klara, Inc.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Sponsored by:	Klara, Inc.
</pre>
</div>
</content>
</entry>
<entry>
<title>libc: Improve scanfloat test.</title>
<updated>2025-05-16T15:44:10+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-05-16T15:43:20+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=1518203b892f402fa72dd86a458a5d3a0b99dceb'/>
<id>1518203b892f402fa72dd86a458a5d3a0b99dceb</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>libc: Add one more check in new fmemopen test</title>
<updated>2024-10-23T17:29:34+00:00</updated>
<author>
<name>Ed Maste</name>
<email>emaste@FreeBSD.org</email>
</author>
<published>2024-10-23T17:28:55+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=6b9f7133aba44189d9625c352bc2c2a59baf18ef'/>
<id>6b9f7133aba44189d9625c352bc2c2a59baf18ef</id>
<content type='text'>
Reported by:	jrtc27
Fixes: 0953460ce149 ("libc: fix access mode tests in fmemopen(3)")
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reported by:	jrtc27
Fixes: 0953460ce149 ("libc: fix access mode tests in fmemopen(3)")
</pre>
</div>
</content>
</entry>
<entry>
<title>libc: fix access mode tests in fmemopen(3)</title>
<updated>2024-10-23T17:11:14+00:00</updated>
<author>
<name>Ed Maste</name>
<email>emaste@FreeBSD.org</email>
</author>
<published>2024-10-23T13:41:51+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=0953460ce149e6f384aafbcb1e6213dfbf8f6a16'/>
<id>0953460ce149e6f384aafbcb1e6213dfbf8f6a16</id>
<content type='text'>
Previously a stream opened as read-only could be written to.  Add a test
case for the fix.

Also correct another incorrect access mode check that worked by
accident, and improve the tests for that.

PR:		281953
Reported by:	Erkki Moorits, fuz
Reviewed by:	fuz, khng (earlier)
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47265
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously a stream opened as read-only could be written to.  Add a test
case for the fix.

Also correct another incorrect access mode check that worked by
accident, and improve the tests for that.

PR:		281953
Reported by:	Erkki Moorits, fuz
Reviewed by:	fuz, khng (earlier)
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47265
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove residual blank line at start of Makefile</title>
<updated>2024-07-15T22:43:39+00:00</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2024-07-15T04:46:32+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=e9ac41698b2f322d55ccf9da50a3596edb2c1800'/>
<id>e9ac41698b2f322d55ccf9da50a3596edb2c1800</id>
<content type='text'>
This is a residual of the $FreeBSD$ removal.

MFC After: 3 days (though I'll just run the command on the branches)
Sponsored by: Netflix
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is a residual of the $FreeBSD$ removal.

MFC After: 3 days (though I'll just run the command on the branches)
Sponsored by: Netflix
</pre>
</div>
</content>
</entry>
<entry>
<title>fflush: Add test for buffer handling in __sflush</title>
<updated>2023-11-07T13:21:12+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2023-08-03T15:13:45+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=b8dbfb0a6c181a9aeab0b793deb0813d06052df9'/>
<id>b8dbfb0a6c181a9aeab0b793deb0813d06052df9</id>
<content type='text'>
Sponsored by:	Klara, Inc.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Sponsored by:	Klara, Inc.
</pre>
</div>
</content>
</entry>
</feed>
