X-Recipient: archive-cygwin@delorie.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:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type; q=dns; s=default; b=AB
	M6+8OcqRh3LXIJq6iLxuMxcx6dwwT7f8rDYzDIHAQkpC3ByqIbj2ZztclMvUS+Bq
	j9S7GuGub2SCRMYawrEux2X06fdBTNrnB8Qtq7lPqF2RveGk4Dn0S6cgyX1STD3k
	CUz8WYps1BHS/2iKjOTrlI115zm7bG7l8kQA+XRhk=
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:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type; s=default; bh=iKj+HfRm
	vv6gpZWoHsNJQR/ez04=; b=lgKVtVebevzr2adAq3O20ZCfK2OHu5DZKSlfFBLi
	Gyr0A3Y6/hVjMF541rbTP2I+RNvQZfdyh8kI2xNJmp7cTZEpjLfLvN9AAXUYzUT0
	CUrsppz4NrgeVSI6q1rr6DmBhEVrjpaDT0fqMwypGDs9e+Vxooul7onzdQ5WbW49
	a2E=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mail-lb0-f172.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=1e100.net; s=20130820;        h=x-gm-message-state:mime-version:in-reply-to:references:date         :message-id:subject:from:to:content-type;        bh=CMqfSJq47B8/Iza3Z6I3EZ0Z2c1WFt8dBbkJL57/e98=;        b=QtN4LyjrZq5qKSzIn6Qc7sAw1ompnL1deo5Eo0GgHN9BtT+XzWuEta5Q+prQjKGNJ0         dw17k+MWOJWN2zvJEY+B6CSwUa87AFqVCx92mq8EPdJ81bK21HxNXyTJellx3QrnQe+G         bc+C4VwPyvmU8ihY48jBsXb/pWz/Qxdt0HKTw7vp14mq+nh71UdPizHnjyTfW9EBP34W         NYdDQ6caPAux0LVORqefetp1lKqA1CvYrox/fA8bPb6L3jX/a+xkKv8rDWv1C1i0Xxx/         ++LEgYr1RzbTQXbUhR8141z4tQvPas2oHL3fzd1ghc2SgvOSBSR8mrTafcyN5S3EAmYd         uCpQ==
X-Gm-Message-State: ALoCoQnBRbLMjLVx46TwfHsp33oKm/QYKHbZLuq5SBAzjRl1i+8Dr6XbxU4Hf2YiznvSw2f12YR5
MIME-Version: 1.0
X-Received: by 10.152.5.65 with SMTP id q1mr5001221laq.110.1438372240650; Fri, 31 Jul 2015 12:50:40 -0700 (PDT)
In-Reply-To: <55BB6F59.8060905@dronecode.org.uk>
References: <CAOC2fq9A1DSjy=7Af=wVCkNEsttpd4Fj-0w_nNwnSb76WFt5WA@mail.gmail.com>	<55BB6F59.8060905@dronecode.org.uk>
Date: Fri, 31 Jul 2015 12:50:40 -0700
Message-ID: <CAOC2fq-MjJb3HuKHs5cuDMRAMxabXGQKW6heUsmyVbnnWWMXAA@mail.gmail.com>
Subject: Re: Seg Fault in strftime
From: Michael Enright <mike@kmcardiff.com>
To: cygwin@cygwin.com
Content-Type: text/plain; charset=UTF-8
X-IsSubscribed: yes

On Fri, Jul 31, 2015 at 5:51 AM, Jon TURNEY wrote:
> On 31/07/2015 01:16, Michael Enright wrote:
>>
> It would be very helpful if you could tweak the testcase there and produce
> one which reproduces your problem.
>
> [1]
> https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=commitdiff;h=75d5f68aabf62c42884ff935f888b12bbcd00001
> [2] https://sourceware.org/ml/newlib/2015/msg00321.html
>
I have not found it simple to reproduce the symptoms in the
intepreter, but I have found that if I do
struct tm manually_initialized;
manually_initialized.tm_year = 2000;
strftime(buf, buf_size, "%Z", &manually_initialized);
The printed time zone is garbage, which is an indication of danger.
Unlike my complex case, the tzname twins are not corrupted by this
exercise.

If I do
struct tm zeroed = {0};
manually_initialized.tm_year = 2000;
strftime(buf, buf_size, "%Z", &zero_initialized);
The printed time zone is PST (TZ happens to be "America/Los_Angeles")

Aside: I am not super-certain of the zero-initialized semantics with
respect to the language. The idiom I used is defined in C++ but the
program is C.

--
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

