Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Jul 2025 19:43:21 +0000
From:      Shawn Webb <shawn.webb@hardenedbsd.org>
To:        Dag-Erling =?utf-8?B?U23DuHJncmF2?= <des@freebsd.org>
Cc:        src-committers@freebsd.org, dev-commits-src-all@freebsd.org,  dev-commits-src-main@freebsd.org
Subject:   Re: git: d63ffdd1ef63 - main - tzcode: Fix time zone change detection.
Message-ID:  <35gxd7qvcs7nzwh3zdoh6hnb3htjnzowwitbgi6i647qtj4evj@gpwzez6ggzbd>
In-Reply-To: <202507181750.56IHoLIw040938@gitrepo.freebsd.org>
References:  <202507181750.56IHoLIw040938@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--xgrqnlhdjneuctbv
Content-Type: text/plain; protected-headers=v1; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Subject: Re: git: d63ffdd1ef63 - main - tzcode: Fix time zone change
 detection.
MIME-Version: 1.0

On Fri, Jul 18, 2025 at 05:50:21PM +0000, Dag-Erling Sm=F8rgrav wrote:
> The branch main has been updated by des:
>=20
> URL: https://cgit.FreeBSD.org/src/commit/?id=3Dd63ffdd1ef6368407b35d41523=
7b95cc739d8073
>=20
> commit d63ffdd1ef6368407b35d415237b95cc739d8073
> Author:     Dag-Erling Sm=F8rgrav <des@FreeBSD.org>
> AuthorDate: 2025-07-18 17:48:59 +0000
> Commit:     Dag-Erling Sm=F8rgrav <des@FreeBSD.org>
> CommitDate: 2025-07-18 17:49:34 +0000
>=20
>     tzcode: Fix time zone change detection.
>    =20
>     Prior to the 2022g import, tzloadbody() returned -1 on error.  Now it
>     returns an errno code.  When I updated the time zone change detection
>     logic to match, I improperly returned errno in all cases, which means
>     that if the time zone file has not changed since we last loaded it,
>     tzloadbody() returns a random errno value instead of 0.
>    =20
>     Fixes:          bc42155199b5
>     MFC after:      1 week
>     Sponsored by:   Klara, Inc.
>     Sponsored by:   NetApp, Inc.
>     Reviewed by:    markj
>     Differential Revision:  https://reviews.freebsd.org/D51405
> ---
>  contrib/tzcode/localtime.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
>=20
> diff --git a/contrib/tzcode/localtime.c b/contrib/tzcode/localtime.c
> index f5814a43da54..69b5f0183e2c 100644
> --- a/contrib/tzcode/localtime.c
> +++ b/contrib/tzcode/localtime.c
> @@ -408,10 +408,8 @@ change_in_tz(const char *name)
>  	static char old_name[PATH_MAX];
>  	static struct stat old_sb;
>  	struct stat sb;
> -	int error;
> =20
> -	error =3D stat(name, &sb);
> -	if (error !=3D 0)
> +	if (stat(name, &sb) !=3D 0)
>  		return -1;
> =20
>  	if (strcmp(name, old_name) !=3D 0) {
> @@ -510,13 +508,11 @@ tzloadbody(char const *name, struct state *sp, bool=
 doextend,
>  		 * 'doextend' to ignore TZDEFRULES; the change_in_tz()
>  		 * function can only keep state for a single file.
>  		 */
> -		int ret =3D change_in_tz(name);
> -		if (ret <=3D 0) {
> -			/*
> -			 * Returns an errno value if there was an error,
> -			 * and 0 if the timezone had not changed.
> -			 */
> +		switch (change_in_tz(name)) {
> +		case -1:
>  			return errno;
> +		case 0:
> +			return 0;
>  		}
>  	}
>  	fid =3D _open(name, O_RDONLY | O_BINARY);
>=20

Hey DES,

This commit broke buildworld:

=3D=3D=3D=3D BEGIN LOG =3D=3D=3D=3D
/usr/src/contrib/tzcode/localtime.c:512:11: error: no case matching constan=
t switch condition '1' [-Werror]
  512 |                 switch (change_in_tz(name)) {
      |                         ^~~~~~~~~~~~~~~~~~
/usr/src/contrib/tzcode/localtime.c:433:25: note: expanded from macro 'chan=
ge_in_tz'
  433 | #define change_in_tz(X) 1
=3D=3D=3D=3D END LOG =3D=3D=3D=3D

Thanks,

--=20
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

Signal Username:  shawn_webb.74
Tor-ified Signal: +1 303-901-1600 / shawn_webb_opsec.50
https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A=
4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc

--xgrqnlhdjneuctbv
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmh6o9IACgkQ/y5nonf4
4fpFHg/+JCgMWIOJXY/VozvqPHl5FaGiVWeP3fN8QAyEYRnqmceEAnBqt2Rgwmso
72BS30P/YIlpQLlyx7zaXowPXLs1D+E2wCAZOZ4Q950Gcsvr6EX2YHJOupNKRJxM
xGjQqLO45fZ2NNYd5Y9AzJv3XAcgvxUt7CUlBcosrA/CebFHZC4WRo1V4IBkZPq/
8h2vzy2H5QckARXsVAVMgY78/xspDsNSGptQp7c1bnA14o2Z6BEo07T41JDNQCn2
GTC0fA8cbndIPm+WrvRfl66t05zvzludLNkSd+9RMUup6teKVOjIJXo1uKbQ3mBa
8o1JMC8JNmvYQB94NgiX/yrn9DkYorlgzwFyh3s39jKFXYDYNQkTdalp0sXzSlSa
1/8Ttt9lfgDCQOOgBI+OBNqfEhkciYAR8/WQQ/Ix0iE/4O7mDSBE9rx1UtL+ntP5
/9gqPVFarUaMnKi5rb0NWBkDLPriEJzYMpzg4EQpYd27NhxdwnndK+6pNFi3J8us
VAOGDYGxcwKYulP1UGKf5TACVg0YSQiEUlY4rTHAk4QJc2Pee2XioKgqXNzDIb9Q
xBesJrIoRY/5ySHRXXQKvhYx1mwa0TU9qOspwEfJe+U9zPrsyH7OqsnbhEsJmsF/
DIKkNgusaIHR7T5nCal+4KIcfqom/fbw1U9mv6PKUBN9bvTNLFY=
=/6yA
-----END PGP SIGNATURE-----

--xgrqnlhdjneuctbv--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?35gxd7qvcs7nzwh3zdoh6hnb3htjnzowwitbgi6i647qtj4evj>