Dimitar Dimitrov writes: > On Tue, May 17, 2022 at 10:45:11AM +0200, jdoubleu wrote: >> Sorry, here's the patch. > > Hi jdoubleu, > > I managed to test your change with https://sourceware.org/pipermail/newlib/2022/019710.html > > Only the following test case fails in tzset.c: > {"<+0123456789ABCDEF>3:33:33", IN_SECONDS(3, 33, 33), NO_TIME}, // truncates the name (17 + 1) > Failure message is: > Assertion failed! Expected 1647906533 to equal 1647893720. winter > time, timezone = "<+0123456789ABCDEF>3:33:33" Yeah, the code needs a fix to truncate the TZ name but then skip to the '>' and keep going. Something like this (line numbers likely wrong; this patch is from picolibc): @@ -153,13 +55,8 @@ /* quit if no items, too few or too many chars, or no close quote '>' */ if (sscanf (tzenv, "%10[-+0-9A-Za-z]%n", __tzname_std, &n) <= 0 - || n < TZNAME_MIN || TZNAME_MAX < n) + || n < TZNAME_MIN || TZNAME_MAX < n || '>' != tzenv[n]) return; - while (tzenv[n] != '>') { - if (!tzenv[n]) - return; - n++; - } ++tzenv; /* bump for close quote '>' */ } @@ -199,18 +96,13 @@ /* quit if no items, too few or too many chars, or no close quote '>' */ if (sscanf (tzenv, "%10[-+0-9A-Za-z]%n", __tzname_dst, &n) <= 0 - || n < TZNAME_MIN || TZNAME_MAX < n) + || n < TZNAME_MIN || TZNAME_MAX < n || '>' != tzenv[n]) { /* No dst */ _tzname[1] = _tzname[0]; _timezone = tz->__tzrule[0].offset; _daylight = 0; - return; + return; } - while (tzenv[n] != '>') { - if (!tzenv[n]) - return; - n++; - } ++tzenv; /* bump for close quote '>' */ } -- -keith