delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/06/06/11:05:39

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=DKulQ4OXDj3KZ9xtMp33Atqv7JqB4ax9qFmq46hNAR2xfz2YUG+Cv
LTxN9hDdrGdLCE4bnaQXttOCawKADzifZyYXOy/mQJhLPX1Tp+Taka3qlFFCFT9l
aYiQMY6ji0RIBiCstgUlywmaBGf/b9H9g8Vpv27hdudkkQRxxML//E=
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=y90jAJRh0Go7Yt83giCIobrTYBA=; b=RpC8t41OEEm6xcd9ngedS7eNHW+C
axELnRzoupV44tdM1wWwk2XWrUiZM4/4Ahv4JhYFnkRk0wOE89IHjqzhwf3m/sV3
MITHN9XC0NGYCf2Qy1EYySn69Qze2GXiMM305Wit1ETl6aDvsGjI6lV0BOhveYO7
oBVHDkLwok9eSZ0=
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=-101.9 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Panel, opted, Side, Hx-languages-length:2566
X-HELO: drew.franken.de
Date: Tue, 6 Jun 2017 17:04:59 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: setting TZ is harmful
Message-ID: <20170606150459.GB23208@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <2397524 DOT 6dhiyKbjLM AT omega>
MIME-Version: 1.0
In-Reply-To: <2397524.6dhiyKbjLM@omega>
User-Agent: Mutt/1.8.0 (2017-02-23)

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

On May  9 15:37, Bruno Haible wrote:
> Hi,
>=20
> Currently, all commands in a Cygwin command window are run with the TZ
> environment variable set.
>=20
> It is set by /etc/profile.d/tzset.sh (or its csh equivalent,
> /etc/profile.d/tzset.csh).
>=20
> Setting TZ is harmful in two ways:
>=20
>   1) When the user changes the time zone (through the Windows Control Pan=
el) -
>      for example when traveling - the programs run in the Cygwin command
>      window will display a stale notion of local time. Only after the user
>      closes and re-opens a new Cygwin command window, will the programs
>      display local time according to the new time zone.
>=20
>   2) It causes native Windows programs (built through mingw, MSVC) to ass=
ume
>      a time zone that is different from the intended one and different fr=
om
>      the one that the user has set in the Windows Control Panel (see APPE=
NDIX 1
>      below). This is because in most geographies, the values of TZ (produ=
ced
>      by winsup/utils/tzset.c and winsup/utils/tzmap.h) contains a slash, =
and
>      the tzset() function in the Microsoft CRT does not understand this s=
yntax
>      - it understands only a different syntax
>      https://msdn.microsoft.com/en-us/library/90s5c885.aspx .
>=20
> When TZ is not set, both Cygwin and native Windows programs take their ti=
me
> zone information from the Windows Control Panel settings. See APPENDIX 2
> below and https://lists.gnu.org/archive/html/bug-gnulib/2017-05/msg00035.=
html .
>=20
> What are the benefits of setting the TZ environment variable? I don't
> see any!

If we don't do that the tzname variable contains gibberish, because the
only information we have is the Windows timezone info, and the content
is (who would expect that) non-standard.  See also
https://cygwin.com/ml/cygwin-developers/2012-01/msg00039.html
That's why we opted for always setting TZ.

> =3D=3D=3D> Please remove /etc/profile.d/tzset.{sh,csh} ! <=3D=3D=3D
>=20
> Side note: An empty TZ value is equivalent to an unset TZ variable for mi=
ngw
> and MSVC compiled programs, but not for Cygwin programs (which interpret =
it as
> GMT). See APPENDIX 2 below.

We're not striving for Windows compatibility, exactly.  What you
describe as problem is working the same way in glibc on Linux, see
https://linux.die.net/man/3/tzset:

  "If the TZ variable does appear in the environment,  but  its  value  is
   empty,  or  its  value  cannot  be interpreted using any of the formats
   specified below, then Coordinated Universal Time (UTC) is used.


Corinna

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

--ZoaI/ZTpAVc4A5k6
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJZNsSbAAoJEPU2Bp2uRE+gQbIP/jqm+kX8I+NvIk9gyBW352Zo
lMFfBEtmDsJH55Ai1zi3O1Fbokt33+Qfm14W4idLGiyP/jjfcEUGsdZI5u+FF088
o3QLOAi4LL+IQ2+7y6ig11piQ7n8YKcuSOD/bh3dUoirEb0fWAnkU6CVD6XkKDHM
ENKUxNIwm+yzyQXmlInizmUeZPgT2P35Wig4pGNMI5UaNVLqQYGgxbXwlK+fgFgZ
ALn0Eax/Q+RuwyQbBbaYTrHzHB7eIz4G0RwyTPyWIw0eiiNfBa8UXV885I+ceCkC
nQpHezOvu2/+9yG9uFPXqRk9XWQvuvyK6PxEEFaTuJ6ZsHD4l+jcQQiqGxg4UV/2
yygvmpW1Os9k0xarcxirWMl5xVakxlOP0HwMOGjfdLV5DMQoyRotWyoUOvHW2q4O
5t7D8gvlnImCkNWxm/d7LJ324nKmD+mY0GNkDrRKkLUjXDDzQYuSfP1DovDV3Beb
QOl8THRKrht+TpP6giYNFL59u/VQPVqmpE7RGYrJ8BKlopybxlWpYd7ezdc4By98
PP+18L0nIse6pzwqb5Zbg4e/vUeVNLyAFJuC/SCMFq2c8+MdpZq5v0gWIUlkeW5j
tL4VckMSPSjmCq6MgvSU6+VVn5f01Oo9zFp8h/2WiZI7YvUDlbLa7lXPkxFco5j4
BYiVBzWR9e2st3IwYnoN
=VsiI
-----END PGP SIGNATURE-----

--ZoaI/ZTpAVc4A5k6--

- Raw text -


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