On Fri, Jul 18, 2025 at 1:43 PM Shawn Webb <shawn.w...@hardenedbsd.org> wrote:
>
> On Fri, Jul 18, 2025 at 05:50:21PM +0000, Dag-Erling Smørgrav wrote:
> > The branch main has been updated by des:
> >
> > URL: 
> > https://cgit.FreeBSD.org/src/commit/?id=d63ffdd1ef6368407b35d415237b95cc739d8073
> >
> > commit d63ffdd1ef6368407b35d415237b95cc739d8073
> > Author:     Dag-Erling Smørgrav <d...@freebsd.org>
> > AuthorDate: 2025-07-18 17:48:59 +0000
> > Commit:     Dag-Erling Smørgrav <d...@freebsd.org>
> > CommitDate: 2025-07-18 17:49:34 +0000
> >
> >     tzcode: Fix time zone change detection.
> >
> >     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.
> >
> >     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(-)
> >
> > 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;
> >
> > -     error = stat(name, &sb);
> > -     if (error != 0)
> > +     if (stat(name, &sb) != 0)
> >               return -1;
> >
> >       if (strcmp(name, old_name) != 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 = change_in_tz(name);
> > -             if (ret <= 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 = _open(name, O_RDONLY | O_BINARY);
> >
>
> Hey DES,
>
> This commit broke buildworld:
>
> ==== BEGIN LOG ====
> /usr/src/contrib/tzcode/localtime.c:512:11: error: no case matching constant 
> switch condition '1' [-Werror]
>   512 |                 switch (change_in_tz(name)) {
>       |                         ^~~~~~~~~~~~~~~~~~
> /usr/src/contrib/tzcode/localtime.c:433:25: note: expanded from macro 
> 'change_in_tz'
>   433 | #define change_in_tz(X) 1
> ==== END LOG ====

Jenkins is also super cranky.

Warner

P.S. I'd just sent a private email with this when this one arrived.

Reply via email to