delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/01/07/16:50:25

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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=I6FYiMamON/qw4tqrrbKl2k5y5YWmT9yXBr1zH77/arQJid4fRIqY
xQtSpdJHX7HGX4195z6OD6WdAR5TRpC6T4ExmVcm25htgJIv2qPgA+IjGRtDtb1X
lf56COiYH8s890qKLNaCi7IsqurawBvCPetLnAoP35q2Ore8QXDwlc=
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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=e1zeYItTPUpmQqE8AdvwILXjPq8=; b=WlBhfxvW8ZIlz6Q6UiWZbjvWAj9i
sHCl/ZffiZNjrqeYSBX69auojuqaHAxErLlgFojqpgIxSe9FzKQxINWvuvMs1VDm
KwK4NBRSCGkUlAwUp3znIU4bRAqhpKqGQH7AAi/f7T7JH2DSHEBtP35eL5+XZGmB
ot2qVoYHHPuxdho=
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=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Wed, 7 Jan 2015 22:50:04 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Bug in strftime %z (was: Possible defect in email.exe re: sent timestamp)
Message-ID: <20150107215004.GC4190@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <003701d01ba3$a444b5d0$ecce2170$@belarc.com> <54947202 DOT 3010007 AT t-online DOT de>
MIME-Version: 1.0
In-Reply-To: <54947202.3010007@t-online.de>
User-Agent: Mutt/1.5.23 (2014-03-12)

--i7F3eY7HS/tUJxUd
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Christian,


thanks for the testcase!

On Dec 19 19:44, Christian Franke wrote:
> Richard DeFuria wrote:
> >Hello,
> >
> >I noticed a defect in the latest cygwin email.exe tool.
> >
> >The defect is that the SENT timestamp is 1 hour off (i.e., one hour too
> >"old" compared to the current system time).
> >
> >My current email.exe version is as follows:
> >                 $ email -v
> >                 email - By Dean Jones; Version 3.2.0-git
> >
> >When I send an email using this tool (through my internal smtp server, w=
hich
> >is unchanged), the SENT timestamp is 1 hour old.
> >
> >When I send an email (via the same command line invocation) from an older
> >box using an older version of this tool, the SENT timestamp is correct.
> >
> >...
> >TZ is unchanged, but it set as follows on both systems:
> >                 $ echo $TZ
> >                 America/New_York
> >
> >Is there anything you recommend I check?
> >
> >This seems to have cropped up after my 12/15/2014 update of cygwin.
>=20
> The email tool use strftime() to format the "Date" header line.
>=20
> There is apparently a bug in the implementation of "%z" (offset from UTC)
> format in recent Cygwin strftime(). Affected are latest release and test
> versions of Cygwin:
>=20
> Testcase:
>=20
> $ uname -srvm
> CYGWIN_NT-6.1-WOW64 1.7.33-2(0.280/5/3) 2014-11-13 15:45 i686 Cygwin
> # (and also 1.7.34-003)
>=20
> $ cat strftest.c
> #include <time.h>
> #include <stdio.h>
> #include <stdlib.h>
>=20
> int main(int argc, char **argv)
> {
>   time_t t =3D (argc > 1 ? atol(argv[1]) : time(NULL));
>   struct tm *tm =3D localtime(&t);
>   char buf[100];
>   strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %z (%Z)", tm);
>   printf("%s\n", buf);
>   return 0;
> }
>=20
> $ gcc -o strftest strftest.c
>=20
> $ echo $TZ
> Europe/Berlin
>=20
> $ ./strftest 1419010000
> 2014-12-19 18:26:40 +0200 (CET)
>=20
> $ ./strftest 1436200000
> 2015-07-06 18:26:40 +0053 (CEST)

Surprisingly this is an old problem which exists in this form since 2011.
Weird that nobody noticed it so far.  Or I missed earlier bug reports :}
The underlying cause was that the info for std and dst offsets was taken
from the wrong spot in the file.  The weird 0053 offset is a result of
wrongly using the LMT offset for Europe/Berlin.

While this fixes the problem for recent timestamps, it will probably
fail for older timestamps when other dst rules were active.

The latest Cygwin versions come with an extended struct tm which adds
members tm_offset and tm_zone for newly built applications.  I'm working
on a patch so strftime utilizes these members if they are available.
I hope to get this finished tomorrow.


Thanks,
Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--i7F3eY7HS/tUJxUd
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJUraoMAAoJEPU2Bp2uRE+g5EoP/Aj5Ae9yRb3aMCf7cdOUi33f
f22KmAsrgn2bo846ZKfSt12L/4DMOYXRScKMTcdKcDmaMxIso70UqHvd58dYKTJq
QIt3jbxVlOf0PfhHq7GkGoc/8ltbCXF9KR4Pradi+w4MWRovZ01OnZQ7CbtrCwoH
wRzj9QT/wdD42+f8T9N/M20i8Ag3GypDqwjDdYH6maLpNoxkDX8AkPkaTLdIhgn5
yI5EcL98K7rxjvHjCwZnLRVE85WOYm4eHuD87JFF3b30UR5fmeCHQajn7qTXjUR2
as81W9uhxui+vrBiIPFrsWpyFizWzG3WKgRtV9ZluRdyNXd8QUOf/7wd8f2TaGvP
jZiepFlergINs/p1KP7yE7mmFNpT4BaH8C6mchLCKCLqOZ2o+R4hDu1172kYZeBy
5r/3SOJs28/Ix+HeOKohqgMBCZYuCm5akYmJsfNbVvms62NuKCy8r3OyGBTZaiqp
P8Ls+Pplpj+XP0Ui2ry22rQ6rkHJ9tzvbw7fkJG8cjiL5rYLIZuoKqZz92xK3B4K
8HxCzUktggVGkK3NctZd+GHHOwbVGkTjeUcmrsFtTHcqU2W9hPFLEi8qTx1WNAiV
JEVid1+bdieG/U6mnnPfNf5czh9GNtXuaDBotufYbDxQCGzxfw/eYlHlZ7RaRgge
JStzScMF9JwACksDXoSo
=UNsp
-----END PGP SIGNATURE-----

--i7F3eY7HS/tUJxUd--

- Raw text -


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