This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: strptime bugs


Thorsten Kukuk <kukuk@suse.de> writes:

> strptime("12", "%I", &testbuf) should return tm_hour = 12
> The range is [1,12], not [0,11]. But we return tm_hour = 0.

Which is OK.  %I alone can be interpreted as 0 hours or 12 hours (12am
or 12pm).  And you are confusing input format specification [1,12]
with the allowed values for tm_hour (defined in <time.h>).

> strptime("0091 00 01", "%y %w %W", &testbuf) returns NULL.

Which I argue is acceptable.  The input for %y is up to two digits
wide.  I know that other systems do this differently but there is
nothing written which says this is the only or even right
interpretation.

> strptime("0091", "%y", &testbuf) returns tm_year = 100, but this
> should be tm_year = 91.

Same.

> The leading zeros are allowed.

Leading zeros refers to the zeros you can add before the digit for
numbers < 10.

> We dereference the strptime result without checking, if NULL was
> returned. So our test program seg.faults.

This is not really a bug but you can change it if you want.  Feel
free.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]