New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] 5.8.8 Handle cases where localtime_r does not call tzset #8799
Comments
From @spotrhThis is a bug report for perl from tcallawa@redhat.com, As part of the review process for Perl, I'm opening bugs for the In Fedora, we've found that our multi-threaded perl builds use This was originally filed and discussed here: Inline Patch--- perl-5.8.8/config_h.SH.bz172396 2005-10-31 13:13:05.000000000 -0500
+++ perl-5.8.8/config_h.SH 2006-05-11 16:20:36.000000000 -0400
@@ -1912,7 +1912,18 @@
*/
#$d_localtime_r HAS_LOCALTIME_R /**/
#define LOCALTIME_R_PROTO $localtime_r_proto /**/
-
+/* LOCALTIME_R_NEEDS_TZSET :
+ * many libc's localtime_r implementations do not call tzset,
+ * making them differ from localtime(), and making timezone
+ * changes using $ENV{TZ} without explicitly calling tzset
+ * impossible. This symbol makes us call tzset before localtime_r:
+ */
+#$d_localtime_r_needs_tzset LOCALTIME_R_NEEDS_TZSET /**/
+#ifdef LOCALTIME_R_NEEDS_TZSET
+#define L_R_TZSET tzset(),
+#else
+#define L_R_TZSET
+#endif
/* HAS_LONG_DOUBLE:
* This symbol will be defined if the C compiler supports long
* doubles.
--- perl-5.8.8/reentr.inc.bz172396 2006-05-11 16:20:36.000000000 -0400
+++ perl-5.8.8/reentr.inc 2006-05-11 16:20:36.000000000 -0400
@@ -1368,10 +1368,10 @@
#ifdef HAS_LOCALTIME_R
# undef localtime
# if !defined(localtime) && LOCALTIME_R_PROTO == REENTRANT_PROTO_S_TS
-# define localtime(a) (localtime_r(a,
Inline Patch--- perl-5.8.8/Configure.bz172396 2006-05-11 16:20:36.000000000 -0400
+++ perl-5.8.8/Configure 2006-05-11 16:21:47.000000000 -0400
@@ -542,6 +542,7 @@
d_libm_lib_version=''
d_link=''
d_localtime_r=''
+d_localtime_r_needs_tzset=''
localtime_r_proto=''
d_locconv=''
d_lockf=''
@@ -14261,7 +14262,59 @@
*) localtime_r_proto=0
;;
esac
+: see if localtime_r calls tzset
+case "$localtime_r_proto" in
+REENTRANT_PROTO*)
+ $cat >try.c <<EOCP
+/* Does our libc's localtime_r call tzset ?
+ * return 0 if so, 1 otherwise.
+ */
+#include <sys/types.h>
+#include <unistd.h>
+#include <time.h>
+#include <string.h>
+#include <malloc.h>
+int main()
+{
+ time_t t = time(0L);
+ char w_tz[]="TZ=GMT+5",
+ e_tz[]="TZ=GMT-5",
+ *tz_e = (char*)malloc(16),
+ *tz_w = (char*)malloc(16);
+ struct tm tm_e, tm_w;
+ memset(&tm_e,'\0',sizeof(struct tm));
+ memset(&tm_w,'\0',sizeof(struct tm));
+ strcpy(tz_e,e_tz);
+ strcpy(tz_w,w_tz);
+ putenv(tz_e);
+ localtime_r(&t, &tm_e);
+
+ putenv(tz_w);
+ localtime_r(&t, &tm_w);
+
+ if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
+ return 1;
+ return 0;
+}
+EOCP
+ set try
+ if eval $compile; then
+ if ./try; then
+ d_localtime_r_needs_tzset=undef;
+ else
+ d_localtime_r_needs_tzset=define;
+ fi;
+ rm -f ./try;
+ else
+ d_localtime_r_needs_tzset=undef;
+ fi;
+ rm -f try.c;
+ ;;
+ *)
+ d_localtime_r_needs_tzset=undef;
+ ;;
+esac
: see if localeconv exists
set localeconv d_locconv
eval $inlibc
@@ -21220,6 +21273,7 @@
d_libm_lib_version='$d_libm_lib_version'
d_link='$d_link'
d_localtime_r='$d_localtime_r'
+d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
d_locconv='$d_locconv'
d_lockf='$d_lockf'
d_longdbl='$d_longdbl'
-----------------------------------------------------------------
---
This perlbug was built using Perl v5.8.8 in the Red Hat build system. Site configuration information for perl v5.8.8: Configured by Red Hat, Inc. at Wed Jan 24 08:06:27 EST 2007. Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Locally applied patches: @INC for perl v5.8.8: Environment for perl v5.8.8: PATH=/usr/lib/qt-3.3/bin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/spot/bin:/usr/java/j2re1.4.2_02/javaws/ |
From @TuxOn Thu, 22 Feb 2007 15:19:03 -0800, Tom Callaway (via RT)
I don't exactly know whether this report was the source, but this http://public.activestate.com/cgi-bin/perlbrowse/p/29207 Change 29207 by merijn@merijn-lt09 on 2006/11/06 09:27:56 RE: [perl #26136] localtime(3) calls tzset(3), but localtime_r(3) may not. Affected files ... ... //depot/metaconfig/U/threads/d_localtime_r.U#20 edit and shortly followed by http://public.activestate.com/cgi-bin/perlbrowse/p/29209 Change 29209 by merijn@merijn-lt09 on 2006/11/06 09:43:30 RE: [perl #26136] localtime(3) calls tzset(3), but localtime_r(3) may not. Affected files ... ... //depot/perl/Configure#627 edit BTW, it also looks like this particular patch has already made it to the
-- |
The RT System itself - Status changed from 'new' to 'open' |
@smpeters - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#41591 (status was 'resolved')
Searchable as RT41591$
The text was updated successfully, but these errors were encountered: