NetBSD Problem Report #44255

From njoly@lanfeust.sis.pasteur.fr  Mon Dec 20 16:15:55 2010
Return-Path: <njoly@lanfeust.sis.pasteur.fr>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id C29DC63B883
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 20 Dec 2010 16:15:55 +0000 (UTC)
Message-Id: <20101220161551.C2F5CDC9BB@lanfeust.sis.pasteur.fr>
Date: Mon, 20 Dec 2010 17:15:51 +0100 (CET)
From: njoly@pasteur.fr
Reply-To: njoly@pasteur.fr
To: gnats-bugs@gnats.NetBSD.org
Subject: parsedate(3) fails with most samples strings from the manpage
X-Send-Pr-Version: 3.95

>Number:         44255
>Category:       lib
>Synopsis:       parsedate(3) fails with most samples strings from the manpage
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 20 16:20:00 +0000 2010
>Closed-Date:    Sun Dec 26 07:45:36 +0000 2010
>Last-Modified:  Sun Dec 26 07:45:36 +0000 2010
>Originator:     Nicolas Joly
>Release:        NetBSD 5.99.41
>Organization:
Institut Pasteur
>Environment:
System: NetBSD lanfeust.sis.pasteur.fr 5.99.41 NetBSD 5.99.41 (LANFEUST) #3: Mon Dec 20 13:08:07 CET 2010 njoly@lanfeust.sis.pasteur.fr:/local/src/NetBSD/obj.amd64/sys/arch/amd64/compile/LANFEUST amd64
Architecture: x86_64
Machine: amd64
>Description:
parsedate(3) fails for most sample strings from the manpage (unambiguous dates,
times and relative items).
>How-To-Repeat:
Run the testcase that will quickly follow.
>Fix:

>Release-Note:

>Audit-Trail:
From: "Nicolas Joly" <njoly@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44255 CVS commit: src
Date: Mon, 20 Dec 2010 16:23:01 +0000

 Module Name:	src
 Committed By:	njoly
 Date:		Mon Dec 20 16:23:01 UTC 2010

 Modified Files:
 	src/distrib/sets/lists/tests: mi
 	src/tests/lib/libutil: Makefile
 Added Files:
 	src/tests/lib/libutil: t_parsedate.c

 Log Message:
 Add testcase from PR/44255, that exercize parsedate(3) with sample
 strings taken from the manpage.


 To generate a diff of this commit:
 cvs rdiff -u -r1.182 -r1.183 src/distrib/sets/lists/tests/mi
 cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libutil/Makefile
 cvs rdiff -u -r0 -r1.1 src/tests/lib/libutil/t_parsedate.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: lib/44255: parsedate(3) fails with most samples strings from
 the manpage
Date: Sun, 26 Dec 2010 07:41:24 +0000

 (not sent to gnats)

    ------

 From: Nicolas Joly <njoly@pasteur.fr>
 To: lib-bug-people@netbsd.org, gnats-admin@netbsd.org,
 	netbsd-bugs@netbsd.org
 Subject: Re: lib/44255: parsedate(3) fails with most samples strings from the
 	manpage
 Date: Tue, 21 Dec 2010 16:11:41 +0100

 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.


 From: Christos Zoulas <christos@zoulas.com>
 To: Nicolas Joly <njoly@pasteur.fr>, lib-bug-people@netbsd.org,
 	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
 Subject: Re: lib/44255: parsedate(3) fails with most samples strings from the
 	manpage
 Date: Tue, 21 Dec 2010 13:13:18 -0500

 On Dec 21,  4:11pm, njoly@pasteur.fr (Nicolas Joly) wrote:
 -- Subject: Re: lib/44255: parsedate(3) fails with most samples strings from 

 Fixed, thanks.

 christos

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 26 Dec 2010 07:45:36 +0000
State-Changed-Why:
fixed (right?)


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.