From rfg@monkeys.com  Wed Jul  4 15:37:56 2001
Return-Path: <rfg@monkeys.com>
Received: from segfault.monkeys.com (236.dsl9226.surewest.net [63.92.26.236])
	by hub.freebsd.org (Postfix) with ESMTP id 8B43D37B406
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  4 Jul 2001 15:37:56 -0700 (PDT)
	(envelope-from rfg@monkeys.com)
Received: by segfault.monkeys.com (Postfix, from userid 1237)
	id 046B14DA76; Wed,  4 Jul 2001 15:37:55 -0700 (PDT)
Message-Id: <20010704223755.046B14DA76@segfault.monkeys.com>
Date: Wed,  4 Jul 2001 15:37:55 -0700 (PDT)
From: rfg@monkeys.com
Reply-To: rfg@monkeys.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: strptime(3) %d format specifier not completely documented
X-Send-Pr-Version: 3.2

>Number:         28699
>Category:       docs
>Synopsis:       strptime(3) %d format specifier not completely documented
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    trhodes
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 04 15:40:00 PDT 2001
>Closed-Date:    Thu May 08 08:10:28 PDT 2003
>Last-Modified:  Thu May 08 08:10:28 PDT 2003
>Originator:     Ronald F. Guilmette
>Release:        FreeBSD 4.2-RELEASE i386
>Organization:
Infinite Monkeys & Co.
>Environment:

	Nothing special

>Description:

	The %d format specifier, when supplied as part of the format
	string argument in a call to strptime(3), will match *either*
	a pair of consecutive digit characters (as documented for the
	%d specifier on the strftime(3) man page) *or*, additionally,
	it appears to also be willing to match a single space character
	followed by a single digit character.

	This extended functionality of the %d format specifier, when used
	with the strptime(3) function, is very useful (please don't remove
	it!) but it ought to be documented.

>How-To-Repeat:

	man 3 strptime
	man 3 strftime

>Fix:

	Add a note to the strptime(3) man page saying that %d matches either
	two digits or a space followed by a single digit.
>Release-Note:
>Audit-Trail:

From: jkoshy@FreeBSD.ORG (Joseph Koshy)
To: freebsd-gnats-submit@freebsd.org
Cc:  
Subject: Re: docs/28699: strptime(3) %d format specifier not completely documented
Date: Fri, 20 Jul 2001 04:41:34 -0700 (PDT)

 I'm not sure that this isn't a bug.  
 
 `strftime(3)' states that '%d' generates 2 digits numbers in the range
 01--31. Coming to `strptime(3)', looking at file 
 "src/lib/libc/stdtime/strptime.c":
 
 		...
                 case 'd':
                 case 'e':
                         /*
                          * The %e specifier is explicitly documented as not
                          * being zero-padded but there is no harm in allowing
                          * such padding.
                          *
                          * XXX The %e specifier may gobble one too many
                          * digits if used incorrectly.
                          */
                         if (!isdigit((unsigned char)*buf))
                                 return 0;
 		...
 
 
 We see that '%d' will accept a single digit date ONLY if a preceding format
 specifier had gobbled up whitespace before it.  A format specification 
 with a leading '%d' will fail to recognize a single digit date.  
 
 We probably need to check that the input to %d is exactly 2 digits long.
 
 Regards, 
 Koshy 
 <jkoshy@freebsd.org>
 

From: "Tim J. Robbins" <tim@robbins.dropbear.id.au>
To: freebsd-gnats-submit@FreeBSD.ORG
Cc:  
Subject: Re: docs/28699
Date: Mon, 14 Jan 2002 03:01:26 +1100

 strptime(3) does not accept "a space followed by a single digit" for %d.
 It chews off up to 2 digits and uses them. It doesn't do anything about
 whitespace.
 
 tim@raven$ date -j -f "%d" " 1" +%d
 Failed conversion of `` 1'' using format ``%d''
 date: illegal time format
 usage: date [-jnu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ... 
             [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]
 
 
 Tim
State-Changed-From-To: open->feedback 
State-Changed-By: trhodes 
State-Changed-When: Tue May 6 17:26:56 PDT 2003 
State-Changed-Why:  
Switch to feedback, this doesn't appear to be a bug and I'll ask Tim about it. 


Responsible-Changed-From-To: freebsd-doc->trhodes 
Responsible-Changed-By: trhodes 
Responsible-Changed-When: Tue May 6 17:26:56 PDT 2003 
Responsible-Changed-Why:  
Over to me for now. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=28699 
State-Changed-From-To: feedback->closed 
State-Changed-By: trhodes 
State-Changed-When: Thu May 8 08:10:02 PDT 2003 
State-Changed-Why:  
Closed.  This is not a bug. 

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