Re: [PATCH] update tzset tests
Keith Packard <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
Dimitar Dimitrov <[email protected]> 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
signature.asc
(application/pgp-signature, 832 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEw4O3eCVWE9/bQJ2R2yIaaQAAABEFAmKFXZkACgkQ2yIaaQAA ABFOig//aurbi61e5wNxVqiHu9f7vG4gErCvykGDXsEC4vC8uixysAi9ZOuAIPhK Renb1Ow42Pc9HStkOh8SGo5jbVVFy0lWN/2HIThkLM89sdqRo+M+Gx5nNqkTjxXP 64r7mwa60GZMYIl2qXWculyyZiE7yfQ2tf8LhiTl2e4orAjA3kxtLWowHSH/p/vc at6ZAGTyTqf2ndCzWyMGhMJKa140cC1rCS9DvAbpakwUMkTHPdXjL1Un6CVIniHY I7mlhHwbUiWyBalDGGCBCJoanJETCT++ymmgonuyb4sEvdPojEcEqhjmWL8Atf0s troysvp5urnotIiwl7JZ8R5lmdnbqV3Ir3J8poCKiudTROPpKyVkP2u9tI1tD+n6 lT49PAgcybnFTuTjemUGACLDbgE5mecby5M9UKl9G4Oe+vEK0gcyQ7QwTkKFA3d6 tp1JmWF/4Wn9LEQk2ZfZ2kE5qQnwGO21ewer6XYVXUXxF0mi59voelH7OrNWLyaY Si3VuWt10jN51mDgIuBZhbjwJAWjIPSdeCSM67m9h1B5EvCtmDwKx3o2K4K/blaK eG1zgVI81L0r8t4iwdpoCptV+3JsfQi0HWzwvQzP8+RXsWyHXFfqBeJ8VuvTQKjK PVCqtwBWQldzPSzpx3LC5ZKcikGviZ9BrIaQJHmCp5MJ54K7TJ8= =XEvz -----END PGP SIGNATURE-----