<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libc/tests/stdtime, branch main</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>tzcode: Test escape from TZDIR</title>
<updated>2025-09-29T12:39:49+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-09-29T12:36:24+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=cf76bfbb235116702ea1689bf984f200a72d2790'/>
<id>cf76bfbb235116702ea1689bf984f200a72d2790</id>
<content type='text'>
Test a value of TZ that temporarily escapes from TZDIR (which is not
permitted when setugid) then reenters it.

MFC after:	3 days
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Test a value of TZ that temporarily escapes from TZDIR (which is not
permitted when setugid) then reenters it.

MFC after:	3 days
</pre>
</div>
</content>
</entry>
<entry>
<title>tzcode: Fix issues when TZ is an absolute path</title>
<updated>2025-09-27T17:07:16+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-09-27T17:07:04+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=df8bc705eb04aff2f718678fffb9d5d4f5d7c223'/>
<id>df8bc705eb04aff2f718678fffb9d5d4f5d7c223</id>
<content type='text'>
* If TZ starts with TZDIR, strip any additional slashes so relname
  does not end up looking like an absolute path.  For instance,
  TZ=/usr/share/zoneinfo//UTC should result in UTC, not /UTC.

* In the setugid case, we were incorrectly passing name rather than
  relname to fstatat().

* Modify the tz_env and tz_env_setugid test cases to exercise both
  of these scenarios.

* Also add test cases for invalid values of TZ, which I wrote
  earlier but forgot to include in a5f14e4f9069.

Reported by:	Paul Eggert &lt;eggert@cs.ucla.edu&gt;
MFC after:	3 days
Fixes:		967a49a21a27 ("Update tzcode to 2025b")
Fixes:		a5f14e4f9069 ("tzcode: Use -00 only for invalid time zones")
Reviewed by:	philip
Differential Revision:	https://reviews.freebsd.org/D52753
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* If TZ starts with TZDIR, strip any additional slashes so relname
  does not end up looking like an absolute path.  For instance,
  TZ=/usr/share/zoneinfo//UTC should result in UTC, not /UTC.

* In the setugid case, we were incorrectly passing name rather than
  relname to fstatat().

* Modify the tz_env and tz_env_setugid test cases to exercise both
  of these scenarios.

* Also add test cases for invalid values of TZ, which I wrote
  earlier but forgot to include in a5f14e4f9069.

Reported by:	Paul Eggert &lt;eggert@cs.ucla.edu&gt;
MFC after:	3 days
Fixes:		967a49a21a27 ("Update tzcode to 2025b")
Fixes:		a5f14e4f9069 ("tzcode: Use -00 only for invalid time zones")
Reviewed by:	philip
Differential Revision:	https://reviews.freebsd.org/D52753
</pre>
</div>
</content>
</entry>
<entry>
<title>tzcode: Add a test case for plain issetugid case</title>
<updated>2025-09-01T06:33:47+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-09-01T06:33:37+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=016d3ec239b39895cf19aa62552fc316d7d98045'/>
<id>016d3ec239b39895cf19aa62552fc316d7d98045</id>
<content type='text'>
This catches a bug in tzcode which incorrectly considers TZDEFAULT as
unsafe as if it came from the environment.

Also deduplicate some repeated code, and fix a missing mode in an
open(2) call with O_CREAT set.

Event:		Oslo Hackathon 202508
Reviewed by:	philip
Differential Revision:	https://reviews.freebsd.org/D52241
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This catches a bug in tzcode which incorrectly considers TZDEFAULT as
unsafe as if it came from the environment.

Also deduplicate some repeated code, and fix a missing mode in an
open(2) call with O_CREAT set.

Event:		Oslo Hackathon 202508
Reviewed by:	philip
Differential Revision:	https://reviews.freebsd.org/D52241
</pre>
</div>
</content>
</entry>
<entry>
<title>tzcode: Add a test case for thin jails</title>
<updated>2025-08-27T18:40:09+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-08-27T12:27:29+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=b2f394b90062b9f4aee51de4e5fd7513b3db7362'/>
<id>b2f394b90062b9f4aee51de4e5fd7513b3db7362</id>
<content type='text'>
Add a test case for a typical thin jail scenario where TZDIR does not
exist and we get our information from /etc/localtime.  This is
technically already covered by the detect_tz_changes test case, but
this new test case is independent of the DETECT_TZ_CHANGES option.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a test case for a typical thin jail scenario where TZDIR does not
exist and we get our information from /etc/localtime.  This is
technically already covered by the detect_tz_changes test case, but
this new test case is independent of the DETECT_TZ_CHANGES option.
</pre>
</div>
</content>
</entry>
<entry>
<title>tzcode: Add test case for setugid programs</title>
<updated>2025-08-25T11:56:48+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-08-25T11:56:48+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=c6c7c7ac94636a1f705a6f4d6ea74b1e62ad517d'/>
<id>c6c7c7ac94636a1f705a6f4d6ea74b1e62ad517d</id>
<content type='text'>
Fixes:		a6b19979bf13 ("tzcode: Fix TZ for non-setugid programs")
Differential Revision:	https://reviews.freebsd.org/D52124
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes:		a6b19979bf13 ("tzcode: Fix TZ for non-setugid programs")
Differential Revision:	https://reviews.freebsd.org/D52124
</pre>
</div>
</content>
</entry>
<entry>
<title>tzcode: Fix TZ for non-setugid programs</title>
<updated>2025-08-22T07:22:17+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-08-22T07:22:17+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=a6b19979bf13055da5f24d1f240f2acddb35eeac'/>
<id>a6b19979bf13055da5f24d1f240f2acddb35eeac</id>
<content type='text'>
The previous commit had the desired effect for setugid programs, but
broke TZ for everyone else.  I didn't notice because my test cases
swap out /etc/localtime instead of setting TZ, so add a test case
that sets TZ.

Fixes:		b6ea2513f776 ("tzcode: Limit TZ for setugid programs")
Reviewed by:	cy
Differential Revision:	https://reviews.freebsd.org/D52108
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The previous commit had the desired effect for setugid programs, but
broke TZ for everyone else.  I didn't notice because my test cases
swap out /etc/localtime instead of setting TZ, so add a test case
that sets TZ.

Fixes:		b6ea2513f776 ("tzcode: Limit TZ for setugid programs")
Reviewed by:	cy
Differential Revision:	https://reviews.freebsd.org/D52108
</pre>
</div>
</content>
</entry>
<entry>
<title>libc: Test time zone change detection.</title>
<updated>2025-07-18T17:49:57+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-07-18T17:49:13+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=57ee56578cc55b3da9a0dee64b385507be2dc80a'/>
<id>57ee56578cc55b3da9a0dee64b385507be2dc80a</id>
<content type='text'>
While here, clean the detection code up a bit.

Sponsored by:	Klara, Inc.
Sponsored by:	NetApp, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D51343
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While here, clean the detection code up a bit.

Sponsored by:	Klara, Inc.
Sponsored by:	NetApp, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D51343
</pre>
</div>
</content>
</entry>
<entry>
<title>strptime: Fix day-of-week calculation.</title>
<updated>2024-12-09T12:38:22+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2024-12-09T12:37:45+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=4285e024baa80f81d13cdcc016fdf0721fe57862'/>
<id>4285e024baa80f81d13cdcc016fdf0721fe57862</id>
<content type='text'>
The day-of-week calculation used the raw year value without adjusting
for TM_YEAR_BASE, so it was off by one for 300 years out of every 400;
it just happened to be correct for 1901 through 2000.  It also used a
loop where a simple addition would have sufficed.

While here, simplify our version of Gauss's algorithm, and document
that we assume the Gregorian calendar.

MFC after:	1 week
PR:		282916
Reviewed by:	imp, allanjude, philip
Differential Revision:	https://reviews.freebsd.org/D47977
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The day-of-week calculation used the raw year value without adjusting
for TM_YEAR_BASE, so it was off by one for 300 years out of every 400;
it just happened to be correct for 1901 through 2000.  It also used a
loop where a simple addition would have sufficed.

While here, simplify our version of Gauss's algorithm, and document
that we assume the Gregorian calendar.

MFC after:	1 week
PR:		282916
Reviewed by:	imp, allanjude, philip
Differential Revision:	https://reviews.freebsd.org/D47977
</pre>
</div>
</content>
</entry>
</feed>
