Date: Thu, 21 Mar 2024 13:32:32 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 277863] Possible regression in mktime(3) Message-ID: <bug-277863-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D277863 Bug ID: 277863 Summary: Possible regression in mktime(3) Product: Base System Version: 14.0-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: misc Assignee: bugs@FreeBSD.org Reporter: nsonack@outlook.com Attachment #249371 text/plain mime type: Created attachment 249371 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D249371&action= =3Dedit Code that triggers the mktime bug The following works on FreeBSD 13.0-RELEASE amd64 but fails on 14.0-RELEASE amd64 (code included as an attachment): # # freebsd-version 13.0-RELEASE # # uname -m amd64 # # cat mktime_bug.c #include <assert.h> #include <err.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <sysexits.h> #include <time.h> int main(void) { struct tm time_buf =3D { .tm_sec =3D 0, .tm_min =3D 0, .tm_hour =3D 0, .tm_mday =3D 1, .tm_mon =3D 0, .tm_year =3D 69, .tm_wday =3D 3, .tm_yday =3D 0, .tm_isdst =3D 0, .tm_zone =3D "CET", }; errno =3D 0; time_t const unix_time =3D mktime(&time_buf); if (errno) err(EX_DATAERR, "mktime failed"); printf("Unix time is: %ld\n", unix_time); return 0; } # # cc -g -O0 -o mktime_bug mktime_bug.c # ./mktime_bug Unix time is: -31539600 # Whereas on 14.0-RELEASE: $ freebsd-version 14.0-RELEASE-p5 $=20 $ uname -m amd64 $=20 $ cc -g -O0 -o mktime_bug mktime_bug.c $ ./mktime_bug mktime_bug: mktime failed: Value too large to be stored in data type $=20 Note that the requested year is 1969 - the bug is possibly related to this fact. This might be a regression due to a version bump of tzcode. This bug was discovered due to a test failure in schilytools at https://codeberg.org/schilytools/schilytools/issues/66. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-277863-227>