NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/44255: parsedate(3) fails with most samples strings from the manpage



On Mon, Dec 20, 2010 at 04:20:00PM +0000, Nicolas Joly wrote:
> >Number:         44255
> >Category:       lib
> >Synopsis:       parsedate(3) fails with most samples strings from the manpage
> >Description:
> parsedate(3) fails for most sample strings from the manpage
> (unambiguous dates, times and relative items).

I just got some time to look into it ... and this is timezone related.
The testcase do not fail for UTC, but do for Europe/Paris (like other
ones east GMT).

njoly@lanfeust [~]> TZ=UTC /usr/tests/lib/libutil/t_parsedate dates
passed
njoly@lanfeust [~]> TZ=US/Pacific /usr/tests/lib/libutil/t_parsedate dates
passed
njoly@lanfeust [~]> TZ=Europe/Paris /usr/tests/lib/libutil/t_parsedate dates
*** Check failed: /local/src/NetBSD/src/tests/lib/libutil/t_parsedate.c:48: 
parsedate("69-09-10", NULL, NULL) != -1 not met
*** Check failed: /local/src/NetBSD/src/tests/lib/libutil/t_parsedate.c:49: 
parsedate("2006-11-17", NULL, NULL) != -1 not met
*** Check failed: /local/src/NetBSD/src/tests/lib/libutil/t_parsedate.c:50: 
parsedate("10/1/2000", NULL, NULL) != -1 not met
*** Check failed: /local/src/NetBSD/src/tests/lib/libutil/t_parsedate.c:51: 
parsedate("20 Jun 1994", NULL, NULL) != -1 not met
*** Check failed: /local/src/NetBSD/src/tests/lib/libutil/t_parsedate.c:52: 
parsedate("23jun2001", NULL, NULL) != -1 not met
*** Check failed: /local/src/NetBSD/src/tests/lib/libutil/t_parsedate.c:53: 
parsedate("1-sep-06", NULL, NULL) != -1 not met
*** Check failed: /local/src/NetBSD/src/tests/lib/libutil/t_parsedate.c:54: 
parsedate("1/11", NULL, NULL) != -1 not met
failed: 7 checks failed; see output for more details

The problem comes from the following code from parsedate() :

    Julian += yyTimezone * 60L;
    if (oJulian > Julian)
        return -1;
    oJulian = Julian;

which returns -1 for yyTimezone < 0 (actually -60 for Europe/Paris).

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.


Home | Main Index | Thread Index | Old Index