This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
newlib's asctime() does not comply with "The Single UNIX Specification, Version 2"
- To: <cygwin at sourceware dot cygnus dot com>
- Subject: newlib's asctime() does not comply with "The Single UNIX Specification, Version 2"
- From: Egor Duda <deo at logos-m dot ru>
- Date: Wed, 10 May 2000 17:03:24 +0400
- Organization: DEO
- Reply-To: Egor Duda <deo at logos-m dot ru>
Hi!
Single UNIX Specification V2 says that asctime () must use the
following method to format it's output.
sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
wday_name[timeptr->tm_wday],
mon_name[timeptr->tm_mon],
timeptr->tm_mday, timeptr->tm_hour,
timeptr->tm_min, timeptr->tm_sec,
1900 + timeptr->tm_year);
whereas current asctime from anoncvs.cygnus.com uses
"%.3s %.3s %.2d %.2d:%.2d:%.2d %d\n" string.
Easy to see, that when tm_mday < 10, newlib will pad it with
leading zero. according to standard it must pad it with space.
One of the problems arising from this noncompliance is described
below.
yesterday, i've checked out (quite large) parts of anoncvs repository
to my machine at work, which is running cygwin. As long as CVS uses
asctime and friends to fill timestamp field if CVS/Entries file, some
of those entries looked like
/Makefile.in/1.2/Sun Apr 09 06:15:43 2000/-ko/
(note the leading zero in timestap). As long as i use cvs at work
there're no problems -- cvs uses the same newlib's asctime to check if
timestamp had been changed. But then i tar.gz'ed my working copy, burn
it on cd and take it to my home machine, which is running linux with
glibc-2.1.1. I've uncompressed working copy and run "cvs update".
Since my home machine has rather slow connection to internet, i've
immediately noticed too much traffic to update yesterday's working
copy. When i turn on cvs's trace mode (cvs -t) i've seen that cvs's
checking out all the files again! Removing leading zeroes in
CVS/Entries solves the problem.
I'm not attaching a (trivial) patch for asctime_r. instead i'm
attaching small perl script i've used to convert all my CVS/Entries
files to correct format (after newlib's fixed). call it with command
like
find /src -path "*/CVS/Entries" -exec perl fix_cvs_entries.pl {} ;
Egor. mailto:deo@logos-m.ru ICQ 5165414 FidoNet 2:5020/496.19
fix_cvs_entries.pl
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com