[PATCH 3/3] mktime: improve thread-safety

2024-10-04 Thread Paul Eggert
* lib/mktime.c (__mktime_internal) [!_LIBC]: Double the number of probes. Although this isn’t guaranteed to suffice, it should be good enough for practical applications, and fixing the problem in general would require access to the underlying tz state lock which would be hard to do. --- ChangeLog

[PATCH 1/3] mktime: refactor to get closer to glibc

2024-10-04 Thread Paul Eggert
* lib/mktime.c (convert_time): Reorder args. (__tz_convert): New macro. All convert_time callers changed to use it. --- ChangeLog| 6 ++ lib/mktime.c | 14 -- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index e5d5b10d37..6d8a1a52b3 10

[PATCH 2/3] mktime: fix timegm bug that set tmp->tm_isdst

2024-10-04 Thread Paul Eggert
* lib/timegm.c (__timegm64): Omit now-unnecessary initialization of tm_isdst. Anyway, the initialization was always wrong, since timegm should not modify *TMP when it fails. --- ChangeLog| 5 + lib/timegm.c | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/C

iconv_open: Fix undefined behaviour

2024-10-04 Thread Bruno Haible
Shifting an 'unsigned char' value left by 24 bits is undefined behaviour, if that value happens to be >= 128. (Because the 'unsigned char' value gets zero-extended to an 'int' first, and left-shift on signed integer types is undefined if it changes the sign.) 2024-10-04 Bruno Haible i

Re: new module 'bcp47'

2024-10-04 Thread Bruno Haible
Here's a refactoring of that code, reducing implicit code duplication. 2024-10-04 Bruno Haible bcp47: Refactor. * lib/bcp47.c (SCRIPT_*): New macros. (default_script_in_territory, default_script_for_language2, default_script_for_language3): New functions.

Re: [PATCH 2/2] timegm: ignore incoming tm_isdst

2024-10-04 Thread Bruno Haible
Paul Eggert wrote: > + AC_CACHE_CHECK([spelling of daylight variable], > +[gl_cv_var___daylight], > +[for gl_cv_var___daylight in __daylight daylight _daylight 0; do On FreeBSD 14, this configure test produces checking spelling of daylight variable... 0 All existing unit tests succeed

Re: [PATCH] Mention WG14 N3322 in manual

2024-10-04 Thread Bruno Haible
Paul Eggert wrote: > +A future C standard is planned to require this behavior; see > +``@url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf, Do you happen to know whether this proposal has already been approved? If yes, I would ask the clang people to change their UBSAN, so that we ca

[PATCH 2/2] timegm: ignore incoming tm_isdst

2024-10-04 Thread Paul Eggert
Problem reported by Florian Weimer via a proposed glibc patch in: https://sourceware.org/pipermail/libc-alpha/2024-October/160310.html * lib/mktime.c (__mktime_internal): Ignore any tm_isdst request if the timezone never observes DST, as is the case for timegm. * m4/mktime.m4 (gl_PREREQ_MKTIME): De

[PATCH 1/2] timegm: desync from glibc for now

2024-10-04 Thread Paul Eggert
* config/srclist.txt: Omit time/timegm.c and time/mktime-internal.h for now, until we can sync glibc from Gnulib. * lib/mktime-internal.h, lib/timegm.c: Revert autoupdate, going back to the recent Gnulib-specific version. --- ChangeLog | 8 config/srclist.txt| 4 ++-- lib/