From: Keith Packard <keithp@keithp.com>
To: Dimitar Dimitrov <dimitar@dinux.eu>, jdoubleu <hi@jdoubleu.de>
Cc: newlib@sourceware.org
Subject: Re: [PATCH] update tzset tests
Date: Wed, 18 May 2022 13:56:57 -0700 [thread overview]
Message-ID: <8735h6muee.fsf@keithp.com> (raw)
In-Reply-To: <YoU/huyB5A2dITdd@kendros>
[-- Attachment #1: Type: text/plain, Size: 1859 bytes --]
Dimitar Dimitrov <dimitar@dinux.eu> 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2022-05-18 20:57 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-07 15:58 [PATCH] add tests for tzset(3) jdoubleu
2022-04-08 21:21 ` Jeff Johnston
2022-04-10 8:43 ` Dimitar Dimitrov
2022-04-10 17:55 ` jdoubleu
2022-04-10 21:00 ` Dimitar Dimitrov
2022-04-11 11:17 ` jdoubleu
2022-04-11 17:27 ` Dimitar Dimitrov
2022-04-12 11:19 ` jdoubleu
2022-04-12 18:33 ` Brian Inglis
2022-04-07 23:34 ` [PATCH v2 0/2] add tzset/_r POSIX angle bracket <> support in TZ env var Brian Inglis
2022-04-07 23:34 ` [PATCH v2 1/2] newlib/libc/time/tzset.c: doc update POSIX angle bracket <> support Brian Inglis
2022-04-07 23:34 ` [PATCH v2 2/2] newlib/libc/time/tzset_r.c(_tzset_unlocked_r): " Brian Inglis
2022-04-08 19:11 ` [PATCH v2 0/2] add tzset/_r POSIX angle bracket <> support in TZ env var Jeff Johnston
2022-04-13 17:53 ` [PATCH] add tests for tzset(3) Brian Inglis
2022-04-13 20:33 ` Jeff Johnston
2022-04-13 22:19 ` Brian Inglis
2022-04-14 8:59 ` jdoubleu
2022-04-14 16:31 ` Brian Inglis
2022-04-14 19:23 ` Jeff Johnston
2022-04-15 10:10 ` jdoubleu
2022-04-27 19:30 ` Jeff Johnston
2022-05-14 14:39 ` jdoubleu
2022-05-16 16:05 ` Dimitar Dimitrov
2022-05-16 17:38 ` Jeff Johnston
2022-05-17 8:45 ` [PATCH] update tzset tests jdoubleu
2022-05-18 18:48 ` Dimitar Dimitrov
2022-05-18 20:56 ` Keith Packard [this message]
2022-05-19 8:47 ` jdoubleu
2022-05-22 9:51 ` [PATCH v2] " jdoubleu
2022-05-22 21:02 ` Dimitar Dimitrov
2022-05-27 15:46 ` Jeff Johnston
2022-04-13 22:21 ` [PATCH] add tests for tzset(3) Brian Inglis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8735h6muee.fsf@keithp.com \
--to=keithp@keithp.com \
--cc=dimitar@dinux.eu \
--cc=hi@jdoubleu.de \
--cc=newlib@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).