public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: jdoubleu <hi@jdoubleu.de>
To: Keith Packard <keithp@keithp.com>, Dimitar Dimitrov <dimitar@dinux.eu>
Cc: newlib@sourceware.org
Subject: Re: [PATCH] update tzset tests
Date: Thu, 19 May 2022 10:47:25 +0200	[thread overview]
Message-ID: <1060b8f4-b592-d883-acfe-b5d5193ee825@jdoubleu.de> (raw)
In-Reply-To: <8735h6muee.fsf@keithp.com>

On 5/18/2022 8:48 PM, Dimitar Dimitrov wrote:
> Only the following test case fails in tzset.c:
>      {"<+0123456789ABCDEF>3:33:33",               IN_SECONDS(3, 33, 33),   NO_TIME},

Oh, yes. You're right. This test *should* fail. I forgot to remove it 
from the "succeeding" tests.

> BTW, it took me a while to realize that your patch and the source code in
> newlib's GIT have different line endings 

That's unfortunate, I'm sorry. I'll watch out for it in the future.

On 5/18/2022 10:56 PM, Keith Packard wrote:
> Yeah, the code needs a fix to truncate the TZ name but then skip to the
> '>' and keep going.

I don't think it should. As we discussed earlier[1], it should fail in 
such cases.

I'm going fix my patch. Thanks for running the tests!


[1]: https://sourceware.org/pipermail/newlib/2022/019567.html


Cheers
---
🙎🏻‍♂️ jdoubleu
On 5/18/2022 10:56 PM, Keith Packard wrote:
> 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 '>' */
>       }
> 

  reply	other threads:[~2022-05-19  8:47 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
2022-05-19  8:47                                 ` jdoubleu [this message]
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=1060b8f4-b592-d883-acfe-b5d5193ee825@jdoubleu.de \
    --to=hi@jdoubleu.de \
    --cc=dimitar@dinux.eu \
    --cc=keithp@keithp.com \
    --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).