From tim@robbins.dropbear.id.au  Sun Jan 13 02:49:11 2002
Return-Path: <tim@robbins.dropbear.id.au>
Received: from raven.robbins.dropbear.id.au (121.a.004.mel.iprimus.net.au [210.50.36.121])
	by hub.freebsd.org (Postfix) with ESMTP id 5DCC837B402
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 13 Jan 2002 02:49:03 -0800 (PST)
Received: (from tim@localhost)
	by raven.robbins.dropbear.id.au (8.11.6/8.11.6) id g0DALGU03643;
	Sun, 13 Jan 2002 21:21:16 +1100 (EST)
	(envelope-from tim)
Message-Id: <200201131021.g0DALGU03643@raven.robbins.dropbear.id.au>
Date: Sun, 13 Jan 2002 21:21:16 +1100 (EST)
From: "Tim J. Robbins" <tim@robbins.dropbear.id.au>
Reply-To: "Tim J. Robbins" <tim@robbins.dropbear.id.au>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: strptime(3) is misleading
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         33834
>Category:       kern
>Synopsis:       strptime(3) is misleading
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 13 02:50:01 PST 2002
>Closed-Date:    
>Last-Modified:  Mon Sep 29 03:30:21 UTC 2008
>Originator:     Tim J. Robbins
>Release:        FreeBSD 4.5-RC i386
>Organization:
>Environment:
System: FreeBSD raven.robbins.dropbear.id.au 4.5-RC FreeBSD 4.5-RC #3: Sat Jan 12 17:11:56 EST 2002 tim@raven.robbins.dropbear.id.au:/usr/obj/usr/src/sys/RAVEN i386


	
>Description:
strptime(3) claims that the conversion specifiers are exactly as those for
strftime(3); this is an exaggeration: %n %t %G %g %u %V %v %z are not
implemented in strptime.c.

>How-To-Repeat:
man 3 strptime
>Fix:

Explain that these conversions aren't implemented. If I get time, I'll
try to implement the missing ones.

--- strptime.3.old	Sun Jan 13 20:59:01 2002
+++ strptime.3	Sun Jan 13 21:12:31 2002
@@ -57,8 +57,21 @@
 All ordinary characters are matched exactly with the buffer, where
 white space in the format string will match any amount of white space
 in the buffer.
-All conversion specifications are identical to those described in
-.Xr strftime 3 .
+Conversion specifications are identical to those described in
+.Xr strftime 3 ,
+except for
+.Fa \&%n
+and
+.Fa \&%t
+which are unnecessary (white space is always ignored), and
+.Fa \&%G ,
+.Fa \&%g ,
+.Fa \&%u ,
+.Fa \&%V ,
+.Fa \&%v
+and
+.Fa \&%z
+which are not implemented.
 .Pp
 Two-digit year values, including formats
 .Fa %y
>Release-Note:
>Audit-Trail:

From: "Tim J. Robbins" <tim@robbins.dropbear.id.au>
To: freebsd-gnats-submit@FreeBSD.ORG
Cc:  
Subject: Re: bin/33834
Date: Sun, 13 Jan 2002 21:37:35 +1100

 On second thought, %n and %t might be necessary. Here is a corrected patch.
 
 
 --- strptime.3.old	Sun Jan 13 20:59:01 2002
 +++ strptime.3	Sun Jan 13 21:36:32 2002
 @@ -57,8 +57,19 @@
  All ordinary characters are matched exactly with the buffer, where
  white space in the format string will match any amount of white space
  in the buffer.
 -All conversion specifications are identical to those described in
 -.Xr strftime 3 .
 +Conversion specifications are identical to those described in
 +.Xr strftime 3 ,
 +except for
 +.Fa \&%n ,
 +.Fa \&%t ,
 +.Fa \&%G ,
 +.Fa \&%g ,
 +.Fa \&%u ,
 +.Fa \&%V ,
 +.Fa \&%v
 +and
 +.Fa \&%z
 +which are not implemented.
  .Pp
  Two-digit year values, including formats
  .Fa %y

From: "Tim J. Robbins" <tim@robbins.dropbear.id.au>
To: freebsd-gnats-submit@FreeBSD.ORG
Cc:  
Subject: bin/33834
Date: Sun, 13 Jan 2002 22:38:11 +1100

 Looks like these weren't implemented for a reason: they're not possible from
 the information given because the rest of the `tm' struct can't be assumed
 to be correct (except in the case of %n and %t which aren't very useful).
 I guess they could be checked and ignored like some of the other conversions.

From: "Tim J. Robbins" <tim@robbins.dropbear.id.au>
To: freebsd-gnats-submit@FreeBSD.ORG
Cc:  
Subject: Re: bin/33834
Date: Tue, 15 Jan 2002 09:54:43 +1100

 NetBSD's strptime(3) manual page is nice and their strptime()
 implementation supports the `tricky' %G %g etc. conversions.
 Maybe it'd be best to fix the manual page in 4.x then think about
 overhauling strptime for 5.x.

From: Sheldon Hearn <sheldonh@starjuice.net>
To: "Tim J. Robbins" <tim@robbins.dropbear.id.au>
Cc: bug-followup@freebsd.org
Subject: Re: bin/33834 
Date: Tue, 15 Jan 2002 13:15:48 +0200

 On Mon, 14 Jan 2002 15:00:02 PST, "Tim J. Robbins" wrote:
 
 >  NetBSD's strptime(3) manual page is nice and their strptime()
 >  implementation supports the `tricky' %G %g etc. conversions.
 >  Maybe it'd be best to fix the manual page in 4.x then think about
 >  overhauling strptime for 5.x.
 
 I seem to remember Garrett Wollman objecting to replacing our strptime()
 with NetBSD's, because of some work he'd done on ours that he didn't
 think we should loose.  It might have been David O'Brien, though.
 
 I've played around in this area a bit, and I'd recommend building a
 regression testing suite before contemplating any serious overhaul.
 
 Ciao,
 Sheldon.

From: "Tim J. Robbins" <tim@robbins.dropbear.id.au>
To: Sheldon Hearn <sheldonh@starjuice.net>
Cc: bug-followup@FreeBSD.ORG
Subject: Re: bin/33834
Date: Wed, 16 Jan 2002 14:16:10 +1100

 The Single Unix Spec V2 at
 http://www.opengroup.org/onlinepubs/007908799/xsh/strptime.html
 makes no mention of %G, %g, %u, %V, %v, %z, so I think it would be
 wasted effort to support them, they should just be documented as
 exceptions to the "All conversion specifications are identical to those
 described in strptime(3)" statement.
 
 %n and %t are described by SUSV2, here is a patch to add them:
 
 --- strptime.c.old	Sun Jan 13 21:33:40 2002
 +++ strptime.c	Wed Jan 16 13:41:18 2002
 @@ -121,6 +121,12 @@
  				return 0;
  			break;
  
 +		case 't':
 +		case 'n':
 +			while (*buf != '\0' && isspace((unsigned char)*buf))
 +				buf++;
 +			break;
 +
  		case '+':
  			buf = _strptime(buf, Locale->date_fmt, tm);
  			if (buf == 0)
 
 If this patch is used the manual page should be updated to explain that
 %t and %n eat any whitespace, not just a tab for %t and newline for %n
 like strftime().
 
 The "BUGS" section of strptime(3) talks of specifiers being "defined",
 but does not say by what. It says %e and %l may scan too many digits,
 but SUSV2 allows this; it can scan as many digits as it likes. Similarly,
 the zero-padded values comment doesn't apply to SUSV2 either. The comments
 in the code say the same kind of thing.
 
 I don't have the expertise with calendar systems to implement the
 %U or %W specifiers.
 
 
 Tim
Responsible-Changed-From-To: freebsd-bugs->tjr 
Responsible-Changed-By: tjr 
Responsible-Changed-When: Sun Jun 30 01:17:03 PDT 2002 
Responsible-Changed-Why:  
I will work on this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=33834 
Responsible-Changed-From-To: tjr->freebsd-bugs 
Responsible-Changed-By: tjr 
Responsible-Changed-When: Sat Feb 14 23:44:36 PST 2004 
Responsible-Changed-Why:  
Unassign due to lack of time and interest. Perhaps someone else 
will pick this up. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=33834 
>Unformatted:
