From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: strptime problems
Date: Thu, 8 May 2014 18:42:36 +0200 [thread overview]
Message-ID: <20140508164236.GS12324@port70.net> (raw)
In-Reply-To: <20140508043214.GA6149@brightrain.aerifal.cx>
* Rich Felker <dalias@libc.org> [2014-05-08 00:32:14 -0400]:
> to get it done now. However I'm not clear on what the behavior of
> strptime should be when reading "derived" fields that don't actually
> correspond to anything in the "struct tm". Should it just parse and
> ignore them, or should it somehow convert back? The week-based-year
> stuff is probably the biggest question but there are others too.
strptime seems to be underspecified, it's not clear what happens
in case of inconsistent input, what tm_* fields should be filled
out, etc
glibc sets tm.tm_wday when it can be calculated, musl doesn't
glibc sets __tm_gmtoff so strptime depends on the current tz setting
glibc supports %s in strptime (non-posix), musl doesn't
in musl invalid format strings don't fail now
in the numeric_range logic i think a <= can be changed into <
--- a/src/time/strptime.c
+++ b/src/time/strptime.c
@@ -138,10 +138,12 @@ char *strptime(const char *restrict s, const char *restrict f, struct tm *restri
case '%':
if (*s++ != '%') return 0;
break;
+ default:
+ return 0;
numeric_range:
if (!isdigit(*s)) return 0;
*dest = 0;
- for (i=1; i<=min+range && isdigit(*s); i*=10)
+ for (i=1; i<min+range && isdigit(*s); i*=10)
*dest = *dest * 10 + *s++ - '0';
if (*dest - min >= (unsigned)range) return 0;
*dest -= adj;
prev parent reply other threads:[~2014-05-08 16:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-08 4:32 Rich Felker
2014-05-08 13:44 ` Isaac Dunham
2014-05-08 16:42 ` Szabolcs Nagy [this message]
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=20140508164236.GS12324@port70.net \
--to=nsz@port70.net \
--cc=musl@lists.openwall.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).