delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/08/01/17:47:51

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:to:from:subject:date:message-id:references
:mime-version:content-type:content-transfer-encoding; q=dns; s=
default; b=jVAKXC58ilyowxJZQjYJ+quq1vCAl5czYuhp5BMV8zsWtgkPKJA8D
9ZMnYQZ+sXHXYyE6ZbOUbfJ2jm8kA2uzIS8J8zQwPxHVVZznGd4qElvB+B2152/m
ZKOxQJ/FQyy77uMl4joQWuPCrk7uuqSlmDnMLoDn82gY+0ypbwK5gQ=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:to:from:subject:date:message-id:references
:mime-version:content-type:content-transfer-encoding; s=default;
bh=PYm3Rm3sx3HfA3IG1v+w35GNZN8=; b=SG9DcUfZ+8O8wrjcPzwi4rmbANKQ
bWXA4oSUJDmLO0GBPxAe0O6c/bIYV2m7Wst1JFA7ByYAYMh+PWYF7RiZklne7y4l
tNjCq7ds9ESR8/taewbigy8UcE1zbChdri/9HHRmeH4ODIpvLM1eA8qLJ1hyMz60
pFoxyvidI90e1GQ=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2
X-HELO: plane.gmane.org
To: cygwin AT cygwin DOT com
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Subject: Re: Seg Fault in strftime
Date: Sat, 1 Aug 2015 21:47:23 +0000 (UTC)
Lines: 41
Message-ID: <loom.20150801T233913-448@post.gmane.org>
References: <CAOC2fq9A1DSjy=7Af=wVCkNEsttpd4Fj-0w_nNwnSb76WFt5WA AT mail DOT gmail DOT com>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes

Michael Enright <mike <at> kmcardiff.com> writes:
> The tznam is set from the tmzone member and when this happens that
> member is garbage. This member is garbage POSSIBLY because of a
> configuration option in libmozjs. The calling code is in prmjtime.cpp
> fills in a struct tm from Spidermonkey's own broken-down time
> structure, 'a', and then if the configuration enables, it makes
> *another* struct tm with more fields filled in in order to get
> a.tm_zone's proper value. My guess is that the path is not enabled but
> the bits delivered to me do not disclose whether this righteous code
> path is enabled. __cygwin_gettzname is evidently compiled to expect
> the tm_zone member to exist because GDB shows it does exist.
> 
> So did any aspect of this change recently? The application and library
> were getting along okay before I did cygwin updates. The last time I
> had tried to run this code was early June, at which time I was running
> it dozens of times a day.
> 
> Also it appears that the tm_zone member is an extension. I haven't
> been able to find POSIX guidance about how applications are supposed
> use struct tm in compliance in the presence of implementation-defined
> fields. POSIX example code shows a usage that does access the 'at
> least' fields. The language allows for implementation-defined fields.
> No mechanism is provided within POSIX to allow an application to
> discover additional fields and take care of them. It seems to me that
> an application can then assume that when it provides a struct tm as
> input, filling in the time and date reasonably, it is always
> sufficient to fill in the 'at least' fields and the implementation is
> the one who has to assume that the rest of the fields might not be
> filled in.

Two problems I have encountered in the past with manually constructed struct tm:
- failing to set struct tm.tm_isdst member to -1, or any negative value, so
that mktime(3) will determine whether DST is in effect, and set the struct
tm.tzname array from the tzdb
- failing to call mktime(3) for each struct tm variable to normalize the
struct tm members, determine if DST is in effect if struct tm.tm_isdst
member is -1, and set the struct tm.tzname array from the tzdb.
Check back in the code to see if struct tm.tm_isdst is set and to what
value, and if mktime(3) is called on each struct tm after it is filled. 

- failing to call mktime()


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

- Raw text -


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