Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Mar 2001 14:19:13 +0900
From:      Makoto MATSUSHITA <matusita@jp.FreeBSD.org>
To:        current@freebsd.org, stable@freebsd.org
Cc:        ache@freebsd.org, kjm@rins.ryukoku.ac.jp
Subject:   Our strptime(3) doesn't conform to other standards/implementations
Message-ID:  <20010318141913L.matusita@jp.FreeBSD.org>

next in thread | raw e-mail | index | archive | help

Summary:
Our strptime(3) format string '%A' does not conform to Single UNIX
Specification v2, Solaris2, NetBSD, and maybe other implementation.
This comes from the changes of src/lib/libc/stdtime/strptime.c rev
1.13, which is commited by ache. Backout this changes (and apply to
4-stable) should fix the problem, but we also modify the manapage of
strptime(3) which isn't also conform to other spec/implementation.

***

Our strptime(3) implementation distinguishs '%A' and '%a', just like
strftime(3) does. However, the Single UNIX Specification v2 doesn't
say that '%A' and '%a' is different.

<URL:http://www.opengroup.org/onlinepubs/007908799/xsh/strptime.html>;
is a spec of strptime(3) of SUSv2. It says:

	%a is the day of week, using the locale's weekday names;
	   either the abbreviated or full name may be specified.
	%A is the same as %a.

Note that strftime(3) specification says that '%'a and '%A' is different.
<URL:http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html>;
says:

	%a is replaced by the locale's abbreviated weekday name.
	%A is replaced by the locale's full weekday name.

You can easily check that strptime(3) implementation of Solaris2 and
NetBSD are conformed to this standard. FreeBSD's implementation is
different from others.

I've asked via IRC, and told from eivind that this is because the
changes of src/lib/libc/stdtime/strptime.c rev 1.13 (by ache) causes
this misimplementation.

<URL:http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/stdtime/strptime.c#rev1.13>;

The commitlog apprantly say that he misunderstands that '%A' and '%a'
is different operation. But we cannot beat him, since our strptime(3) manpage,
<URL:http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/stdtime/strptime.3>;
says:

     The format string consists of zero or more conversion
     specifications and ordinary characters.  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 identi- cal to those described
     in strftime(3).

It's true in the viewpoint of 'the manual should describe its
implementation', but completely wrong in the view point of SUSv2
specification and/or other implementations.

NetBSD, the one of implementation of strptime(3), have a correct
manpages of strptime(3):
<URL:http://cvsweb.netbsd.org/cgi-bin/cvsweb.cgi/basesrc/lib/libc/time/strptime.3>;

So.. there are two bugs in our strptime(3):

- Our implementation of strptime(3) distingush '%A' and '%a'.
	We can  fix this with backouting rev 1.13. It can be easily
	MFCed to  4-stable.
- Our manpage of strptime(3) says its format string is the same of
  strftime(3).
	We can fix strptime(3) manpage, importing most of description
	from strftime(3) and modify it. We can also refer NetBSD's
	manpage to how to describe strptime(3).

***

Acknowledgement: This problem is first reported to japanaese list, by
Kojima-san (this is why I cc:-ed to him). We also says that without
this GNU wget does misunderstands Date: format defined by RFC850. If
you wanna check what he says first (and understand japanese), check
<URL:http://home.jp.freebsd.org/cgi-bin/showmail/FreeBSD-users-jp/59521>.

Kojima-san, can I describe all your problems?

-- -
Makoto `MAR' MATSUSHITA

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010318141913L.matusita>