From 84ef74c402afedb118ae96e8e20646cc0ffe6ff8 Mon Sep 17 00:00:00 2001 From: Andy Dougherty Date: Thu, 5 Feb 1998 08:55:23 -0500 Subject: [PATCH] Re: posix::strftime (core dumped) p4raw-id: //depot/perl@481 --- MANIFEST | 2 ++ ext/POSIX/hints/linux.pl | 5 +++++ ext/POSIX/hints/sunos_4.pl | 6 ++++++ hints/linux.sh | 8 -------- hints/sunos_4_1.sh | 4 ---- t/lib/posix.t | 10 ++++++++-- 6 files changed, 21 insertions(+), 14 deletions(-) create mode 100644 ext/POSIX/hints/linux.pl create mode 100644 ext/POSIX/hints/sunos_4.pl diff --git a/MANIFEST b/MANIFEST index 36fe3b8..68708c1 100644 --- a/MANIFEST +++ b/MANIFEST @@ -181,7 +181,9 @@ ext/POSIX/Makefile.PL POSIX extension makefile writer ext/POSIX/POSIX.pm POSIX extension Perl module ext/POSIX/POSIX.pod POSIX extension documentation ext/POSIX/POSIX.xs POSIX extension external subroutines +ext/POSIX/hints/linux.pl Hint for POSIX for named architecture ext/POSIX/hints/next_3.pl Hint for POSIX for named architecture +ext/POSIX/hints/sunos_4.pl Hint for POSIX for named architecture ext/POSIX/typemap POSIX extension interface types ext/SDBM_File/Makefile.PL SDBM extension makefile writer ext/SDBM_File/SDBM_File.pm SDBM extension Perl module diff --git a/ext/POSIX/hints/linux.pl b/ext/POSIX/hints/linux.pl new file mode 100644 index 0000000..7994f24 --- /dev/null +++ b/ext/POSIX/hints/linux.pl @@ -0,0 +1,5 @@ +# libc6, aka glibc2, seems to need STRUCT_TM_HASZONE defined. +# Thanks to Bart Schuller +# See Message-ID: <19971009002636.50729@tanglefoot> +# XXX A Configure test is needed. +$self->{CCFLAGS} = $Config{ccflags} . ' -DSTRUCT_TM_HASZONE' ; diff --git a/ext/POSIX/hints/sunos_4.pl b/ext/POSIX/hints/sunos_4.pl new file mode 100644 index 0000000..59b45bc --- /dev/null +++ b/ext/POSIX/hints/sunos_4.pl @@ -0,0 +1,6 @@ +# SunOS 4.1.3 has two extra fields in struct tm. This works around +# the problem. Other BSD platforms may have similar problems. +# This state of affairs also persists in glibc2, found +# on linux systems running libc6. +# XXX A Configure test is needed. +$self->{CCFLAGS} = $Config{ccflags} . ' -DSTRUCT_TM_HASZONE' ; diff --git a/hints/linux.sh b/hints/linux.sh index af7d0a8..8ff7f5d 100644 --- a/hints/linux.sh +++ b/hints/linux.sh @@ -29,14 +29,6 @@ esac # gcc-2.6.3 defines _G_HAVE_BOOL to 1, but doesn't actually supply bool. ccflags="-Dbool=char -DHAS_BOOL $ccflags" -# libc6, aka glibc2, seems to need STRUCT_TM_HASZONE defined. -# Thanks to Bart Schuller -# See Message-ID: <19971009002636.50729@tanglefoot> -# This is currently commented out for maintenance releases -# but should probably be uncommented for 5.005 or after -# more widespread testing. -#POSIX_cflags='ccflags="$ccflags -DSTRUCT_TM_HASZONE"' - # BSD compatability library no longer needed set `echo X "$libswanted "| sed -e 's/ bsd / /'` shift diff --git a/hints/sunos_4_1.sh b/hints/sunos_4_1.sh index 07cd89f..9f342d1 100644 --- a/hints/sunos_4_1.sh +++ b/hints/sunos_4_1.sh @@ -37,10 +37,6 @@ d_tzname and i_unistd. Keep the recommended values. See hints/sunos_4_1.sh for more information. EOM -# SunOS 4.1.3 has two extra fields in struct tm. This works around -# the problem. Other BSD platforms may have similar problems. -POSIX_cflags='ccflags="$ccflags -DSTRUCT_TM_HASZONE"' - # The correct setting of groupstype depends on which version of the C # library is used. If you are in the 'System V environment' # (i.e. you have /usr/5bin ahead of /usr/bin in your PATH), and diff --git a/t/lib/posix.t b/t/lib/posix.t index 6ae88c0..d63e695 100755 --- a/t/lib/posix.t +++ b/t/lib/posix.t @@ -10,11 +10,11 @@ BEGIN { } } -use POSIX qw(fcntl_h signal_h limits_h _exit getcwd open read write); +use POSIX qw(fcntl_h signal_h limits_h _exit getcwd open read strftime write); use strict subs; $| = 1; -print "1..17\n"; +print "1..18\n"; $testfd = open("TEST", O_RDONLY, 0) and print "ok 1\n"; read($testfd, $buffer, 9) if $testfd > 2; @@ -80,6 +80,12 @@ if ($Config{d_strtoul}) { # Pick up whether we're really able to dynamically load everything. print &POSIX::acos(1.0) == 0.0 ? "ok 17\n" : "not ok 17\n"; +# This can coredump if struct tm has a timezone field and we +# didn't detect it. If this fails, try adding +# -DSTRUCT_TM_HASZONE to your cflags when compiling ext/POSIX/POSIX.c. +# See ext/POSIX/hints/sunos_4.pl and ext/POSIX/hints/linux.pl +print POSIX::strftime("ok 18 # %H:%M, on %D\n", localtime()); + $| = 0; print '@#!*$@(!@#$'; _exit(0); -- 2.7.4