Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJgzZorV1G_xgRSpBU6vF0D7Pd+kk9=Ky1GZuxy6Dq9jHeU4HQ@mail.gmail.com>
Date: Fri, 6 Jun 2025 10:52:53 -0400
From: enh <enh@...gle.com>
To: musl@...ts.openwall.com
Cc: Rafał Miłecki <zajec5@...il.com>, 
	Rafał Miłecki <rafal@...ecki.pl>
Subject: Re: [PATCH] strptime: support "Z" value for the %z field descriptor

openbsd (which is the implementation bionic uses) does. it's in their
man page along with all the other variants they suppor:
https://man.openbsd.org/strptime

macOS does not.

On Fri, Jun 6, 2025 at 10:41 AM Rich Felker <dalias@...ifal.cx> wrote:
>
> On Fri, Jun 06, 2025 at 11:05:45AM +0200, Rafał Miłecki wrote:
> > From: Rafał Miłecki <rafal@...ecki.pl>
> >
> > Field descriptor %z was added and described as an output of Austin Group
> > tracker issues 879 & 1727. It is documented as: "The offset from UTC in
> > the ISO 8601:2004 standard format (<tt>+hhmm</tt> or <tt>-hhmm</tt>)."
> >
> > It seems a bit vague as ISO 8601:2004 allows more formats than those
> > specified ones. One of allowed values is "Z" which represents UTC.
> > For a reference: glibc supports "Z" since 2015, see:
> > https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=900f33e23eaa20c0587f5a191b632a606e7fba5d
> >
> > To make ISO 8601 dates parsing reliable in musl make it accept "Z" as
> > well.
> >
> > Cc: Rich Felker <dalias@...ifal.cx>
> > Signed-off-by: Rafał Miłecki <rafal@...ecki.pl>
> > ---
> > For a reference: musl gained %z support in the commit fced99e93dae
> > ("strptime: implement conversion specifiers adopted for next POSIX
> > issue")
> >
> > Relevant issues:
> > https://www.austingroupbugs.net/view.php?id=879
> > https://www.austingroupbugs.net/view.php?id=1727
> >
> >  src/time/strptime.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/src/time/strptime.c b/src/time/strptime.c
> > index b1147242..b373aa9c 100644
> > --- a/src/time/strptime.c
> > +++ b/src/time/strptime.c
> > @@ -197,6 +197,11 @@ char *strptime(const char *restrict s, const char *restrict f, struct tm *restri
> >                       want_century = 0;
> >                       goto numeric_digits;
> >               case 'z':
> > +                     if (*s == 'Z') {
> > +                             tm->__tm_gmtoff = 0;
> > +                             s++;
> > +                             break;
> > +                     }
> >                       if (*s == '+') neg = 0;
> >                       else if (*s == '-') neg = 1;
> >                       else return 0;
> > --
> > 2.43.0
>
> At present we have another thread open reporting a bug from
> implementing behavior that was reasonable but outside the standard for
> strftime that looks like it's now nonconforming to the new standard.
>
> If the above is to be adopted, I'd like to have some assurance that
> it's not going to be contrary to future standards. Do other existing
> implementations support this? Is there any effort to standardize it?
>
> Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.