delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/12/11/10:24:42

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <1ff86f510712110724n63ca41d2n7c44f5f13f08efd2@mail.gmail.com>
Date: Tue, 11 Dec 2007 10:24:13 -0500
From: "Jerry D. Hedden" <jdhedden AT cpan DOT org>
To: cygwin AT cygwin DOT com
Subject: Re: BUG: Timezone failures with threads under Cygwin 1.5.25
Cc: pp <perl5-porters AT perl DOT org>
In-Reply-To: <20071211150247.GH6618@calimero.vinschen.de>
MIME-Version: 1.0
References: <1ff86f510712101400w4e8160ccr47a0d949b7548949 AT mail DOT gmail DOT com> <20071211150247 DOT GH6618 AT calimero DOT vinschen DOT de>
X-Google-Sender-Auth: b27ad659919437f4
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

------=_Part_26009_13506379.1197386653749
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Jerry D. Hedden wrote:
> [...]
> Under 1.5.24, this test always passes.  Under 1.5.25, it is
> now frequently failing.  If I add a debugging call in the
> central most loop:
>
>             print("got: $lt  exp: $localtime\n");
>
> I get the following as typical of the problem:
>
>     5 perl-current > ./perl -Ilib ext/threads/t/libc.t
>     1..11
>     ok 1 - use threads
>     got: Wed Dec 31 20:00:08 1969  exp: Wed Dec 31 19:00:08 1969
> [...]
> This shows a 1 hour difference between the expected and
> actual results - which looks like a timezone issue.
>
> As the changes for 1.5.25 include numerous references to
> timezone handling changes, I suspect there may be some
> re-entrancy bug in those changes.

Corinna Vinschen wrote:
> It would be more helpful if you would send self-contained code which
> doesn't have to be tweaked to do a test.  I'm not a perl developer, so
> it took me some time to get it running.  I'd also really prefer
> testcases in plain C which I can simply run under GDB.  Interpreter code
> just adds unnecessary complexity.

I was working on this when I got your email.  Attached.

> I assume the perl libs are using localtime_r, right?  Otherwise you
> can't rely on reentrency nor thread-safety.  Anyway, localtime is
> supposed to be thread-safe in Cygwin.

I believe this is correct.

> The only change in 1.5.25 related to localtime is the fact that the
> environment variable "TZ" is now left alone by Cygwin.  Up to 1.5.24 the
> function tzset() (called by localtime()) also sets the environment
> variable "TZ", which is apparently incorrect according to POSIX.  "TZ"
> is used in later calls to decide whether some other code has to be run
> or not.
>
> And exactly that's the problem.  Since TZ is now never set, that other
> code, which is not thread-safe, is called much more frequent than
> necessary.  Actually it should only be called once per process, now it's
> called once per invocation of tzset().  I've applied a patch to the 1.5.x
> branch and will release an updated 1.5.25 in the next couple of days.

Hope my test program helps to verify this.

------=_Part_26009_13506379.1197386653749
Content-Type: text/plain; name=loctim_bug.c
Content-Transfer-Encoding: base64
X-Attachment-Id: f_fa2l3bh40
Content-Disposition: attachment; filename=loctim_bug.c

LyoqKioqDQogKg0KICogVGVzdCBwcm9ncmFtIHRoYXQgZXZva2VzICdsb2Nh
bHRpbWUnK3RocmVhZHMgYnVnDQogKg0KICogQnVpbGQ6ICBnY2MgLW8gbG9j
dGltX2J1ZyBsb2N0aW1fYnVnLmMNCiAqIFJ1bjogICAgLi9sb2N0aW1fYnVn
LmV4ZQ0KICoNCiAqKioqKi8NCg0KI2luY2x1ZGUgPHRpbWUuaD4NCiNpbmNs
dWRlIDxwdGhyZWFkLmg+DQoNCiNkZWZpbmUgTUFYX1RIUiAgMjUNCiNkZWZp
bmUgTUFYX0xPT1AgMTAwMDANCg0KLyogU2V0IHRoaX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TsNCiAgICAg
ICAgcHRocmVhZF9jcmVhdGUoJnBfdGhyZWFkW2lpXSwgTlVMTCwgdGltZV9s
b29wLCAodm9pZCopJmFyZ3NbaWldKTsNCiAgICB9DQoNCiAgICAvKiBNYWtl
IHN1cmUgdGhyZWFkcyBmaW5pc2ggKi8NCiAgICBhcmdzW01BWF9USFJdID0g
TUFYX1RIUjsNCiAgICB0aW1lX2xvb3AoKHZvaWQqKSZhcmdzW01BWF9USFJd
KTsNCiAgICBhcmdzW01BWF9USFIrMV0gPSBNQVhfVEhSKzE7DQogICAgdGlt
ZV9sb29wKCh2b2lkKikmYXJnc1tNQVhfVEhSKzFdKTsNCg0KICAgIHByaW50
ZigiRG9uZVxuIik7DQp9DQoNCi8qIEVPRiAqLw0K


------=_Part_26009_13506379.1197386653749
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
------=_Part_26009_13506379.1197386653749--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019