From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.comp.lib.gnulib.bugs,gmane.lisp.guile.devel Subject: =?UTF-8?Q?Re:_=e2=80=98mktime=e2=80=99_replacement_on_glibc_systems?= Date: Sun, 3 Jul 2016 13:13:22 +0200 Message-ID: <5778F352.2040705@cs.ucla.edu> References: <874m8b6q9a.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020006010105070504030903" X-Trace: ger.gmane.org 1467544437 6639 80.91.229.3 (3 Jul 2016 11:13:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Jul 2016 11:13:57 +0000 (UTC) Cc: bug-gnulib@gnu.org, guile-devel@gnu.org To: =?UTF-8?Q?Ludovic_Court=c3=a8s?= Original-X-From: bug-gnulib-bounces+gnu-bug-gnulib=m.gmane.org@gnu.org Sun Jul 03 13:13:47 2016 Return-path: Envelope-to: gnu-bug-gnulib@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bJfLP-0005j2-CH for gnu-bug-gnulib@m.gmane.org; Sun, 03 Jul 2016 13:13:47 +0200 Original-Received: from localhost ([::1]:42140 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJfLO-0002Rc-FM for gnu-bug-gnulib@m.gmane.org; Sun, 03 Jul 2016 07:13:46 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51275) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJfLC-0002RD-2f for bug-gnulib@gnu.org; Sun, 03 Jul 2016 07:13:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bJfL7-0005oS-Og for bug-gnulib@gnu.org; Sun, 03 Jul 2016 07:13:32 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:46191) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJfL7-0005oL-Fr; Sun, 03 Jul 2016 07:13:29 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B0E4716150E; Sun, 3 Jul 2016 04:13:28 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id lBtDWf-JlJ4G; Sun, 3 Jul 2016 04:13:27 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 55896161362; Sun, 3 Jul 2016 04:13:27 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 2u0RpHeVwpkz; Sun, 3 Jul 2016 04:13:27 -0700 (PDT) Original-Received: from [192.168.1.232] (unknown [2.224.134.180]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 67B0F160F53; Sun, 3 Jul 2016 04:13:26 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 In-Reply-To: <874m8b6q9a.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 131.179.128.68 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+gnu-bug-gnulib=m.gmane.org@gnu.org Original-Sender: "bug-gnulib" Xref: news.gmane.org gmane.comp.lib.gnulib.bugs:35979 gmane.lisp.guile.devel:18458 Archived-At: This is a multi-part message in MIME format. --------------020006010105070504030903 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable On 06/30/2016 10:21 AM, Ludovic Court=C3=A8s wrote: > Gnulib=E2=80=99s =E2=80=98mktime=E2=80=99 replacement gets used on glib= c systems (glibc 2.22 > here) due to =E2=80=98__mktime_internal=E2=80=99 being unavailable, eve= n though > gl_cv_func_working_mktime=3Dyes on these systems. Is this intended? No, and I don't observe it on Fedora 23 x86-64, which uses glibc 2.22. I=20 ran './gnulib-tool --create-testdir --dir foo mktime; cd foo;=20 ./configure; make' and the resulting build did not compile mktime.c. Perhaps your package is using the mktime-internal module? That would=20 explain why mktime.c is getting compiled for you. If not, could you=20 investigate why your package is compiling mktime.c even when glibc 2.22=20 is being used? > I believe =E2=80=9C#ifdef _LIBC=E2=80=9D should be changed to something= like: > > --8<---------------cut here---------------start------------->8--- > #ifdef _LIBC > __tzset (); > #else > tzset (); > #endif > --8<---------------cut here---------------end--------------->8--- > > otherwise the current =E2=80=98TZ=E2=80=99 variable value ends up being= ignored (we > noticed this problem with Guile=E2=80=99s test suite.) > Yes, thanks, the old code dated back to when the substitute mktime.c was=20 not intended to be thread-safe and so used localtime instead of=20 localtime_r, so there was no need to call tzset. I installed the=20 attached patch to fix that. --------------020006010105070504030903 Content-Type: text/x-patch; name="0001-mktime-call-tzset-as-per-POSIX.patch" Content-Disposition: attachment; filename="0001-mktime-call-tzset-as-per-POSIX.patch" Content-Transfer-Encoding: quoted-printable >From 913c424ef1a10bacf63597ca7565b29908d6135b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 3 Jul 2016 12:59:54 +0200 Subject: [PATCH] mktime: call tzset as per POSIX MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit Problem reported by Ludovic Court=C3=A8s in: http://lists.gnu.org/archive/html/bug-gnulib/2016-06/msg00068.html * lib/mktime.c (mktime) [!_LIBC && HAVE_TZSET]: Call tzset. * m4/mktime.m4 (gl_FUNC_MKTIME): Check for tzset. --- ChangeLog | 8 ++++++++ lib/mktime.c | 2 ++ m4/mktime.m4 | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 34b651f..ef33268 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2016-07-03 Paul Eggert + + mktime: call tzset as per POSIX + Problem reported by Ludovic Court=C3=A8s in: + http://lists.gnu.org/archive/html/bug-gnulib/2016-06/msg00068.html + * lib/mktime.c (mktime) [!_LIBC && HAVE_TZSET]: Call tzset. + * m4/mktime.m4 (gl_FUNC_MKTIME): Check for tzset. + 2016-06-26 P=C3=A1draig Brady =20 fts: handle readdir() errors diff --git a/lib/mktime.c b/lib/mktime.c index 87ab633..9eb3e76 100644 --- a/lib/mktime.c +++ b/lib/mktime.c @@ -470,6 +470,8 @@ mktime (struct tm *tp) time zone names contained in the external variable 'tzname' shall be set as if the tzset() function had been called. */ __tzset (); +#elif HAVE_TZSET + tzset (); #endif =20 return __mktime_internal (tp, __localtime_r, &localtime_offset); diff --git a/m4/mktime.m4 b/m4/mktime.m4 index 5a0f2d8..23cad73 100644 --- a/m4/mktime.m4 +++ b/m4/mktime.m4 @@ -1,4 +1,4 @@ -# serial 26 +# serial 27 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2016 Free Software Foundati= on, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -30,6 +30,7 @@ AC_DEFUN([gl_FUNC_MKTIME], dnl in Autoconf and because it invokes AC_LIBOBJ. AC_CHECK_HEADERS_ONCE([unistd.h]) AC_CHECK_DECLS_ONCE([alarm]) + AC_CHECK_FUNCS_ONCE([tzset]) AC_REQUIRE([gl_MULTIARCH]) if test $APPLE_UNIVERSAL_BUILD =3D 1; then # A universal build on Apple Mac OS X platforms. --=20 2.5.5 --------------020006010105070504030903--