Quoting Matt Sergeant:
> Are there any solaris C experts on cpan-testers that can help
> out with this?
Matt,
I tried the following commands:
% perl Makefile.PL && make && make test
[...]
PERL_DL_NONLAZY=1 /usr/local/perl/bin/perl -Iblib/arch -Iblib/lib
-I/usr/local/perl/lib/5.6.1/sun4-solaris -I/usr/local/perl/lib/5.6.1 -e 'use
Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
t/01base.......ok
t/02core.......FAILED tests 76-77
Failed 2/77 tests, 97.40% okay
t/03compare....ok
t/04mjd........ok
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
t/02core.t 77 2 2.60% 76-77
Failed 1/4 test scripts, 75.00% okay. 2/98 subtests failed, 97.96% okay.
make: *** [test_dynamic] Error 9
First, I tried again #77 from the command line:
% perl -Iblib/lib -Iblib/arch -MTime::Piece -e 'print Time::Piece->strptime("12:00",
"%H:%M")->hour . "\n"'
0
To test #77, I runned this:
% perl -Iblib/lib -Iblib/arch -MTime::Piece -e '$,=" "; print map {
Time::Piece->strptime($_, "%Y")->year } 1900..2100'
And got something like:
1970 1970 1901 1902 [...] 2036 2037 1970 [...] 1970
While expected values were, at least:
???? 1901 1902 [...] 2037 ???? [...]
Also tried #76 on linux 2.4.28-3 i686-linux (glibc-2.2.5-34),
which failed my cpansmoke automatic test, and got this other
results:
1970 1970 [...] 1970 1971 1972 [...] 2037 2038 1970 [...] 1970
Weird, isn't it? Shouldn't have the same behaviour? AFAIK, the
strptime(3) call is conforming to POSIX and XPG4 on linux (I
couldn't guess on solaris). Maybe this excerpt from linux
strptime(3) manpage may bring light to this issue:
The 'y' (year in century) specification is taken to spec-
ify a year in the 20th century by libc4 and libc5. It is
taken to be a year in the range 1950-2049 by glibc 2.0. It
is taken to be a year in 1969-2068 since glibc 2.1.
I guess that strptime output depends on system libc version
available, at least it does for linux, as stated on the manpage
above.
Finally, I compiled the following trivial C program to test
strptime(3) in both linux and solaris:
#include <stdio.h>
#include <time.h>
int main(void) {
struct tm tm;
strptime("1945", "%Y", &tm);
printf("year=%d\n", tm.tm_year);
strptime("12:00", "%H:%M", &tm);
printf("hour=%d\n", tm.tm_hour);
return 0;
}
These are the results on solaris:
% gcc -g3 strptime.c
% ./a.out
year=45
hour=12
And these, on linux:
% gcc -g3 strptime.c
% ./a.out
Segmentation fault
% gdb a.out
[...]
(gdb) run
Starting program: /home/alexm/tmp/Time-Piece-1.03/a.out
Program received signal SIGSEGV, Segmentation fault.
0x420ab338 in day_of_the_week () from /lib/i686/libc.so.6
The I swapped the calls to strptime and got the following:
% ./a.out
hour=12
Segmentation fault
Ok, so my libc6 is broken, I guess...
BTW, I'm not a really a Solaris C guru, but I'll try my best
if you need something more specific, just ask me (I have access
to a half-dozen of solaris boxes with solaris 7 and 8).
Best regards.
--
Alex Muntada <[EMAIL PROTECTED]>
http://people.ac.upc.es/alexm/