delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/06/06/12:52:03

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:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=c8nfeuNZrhVhBpRP
QIoiICFRY0CUq/kYHqOrcEX2TkfQ1Cr9QoF8SBiGPdV/1x5nv7/E5/l6SF7t0SEF
IJZO21ui3gPmtqCTiBLse50vx9xZnQCe4Tj6Sz5nynKxFW56p4ZGOoUacPfF+lX9
tz46EMkxcynYo3c3AIGPHYzybf8=
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:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=fR/GumQhgRlcdmKqeGRGwo
1bah8=; b=CRrgOhm6OnErEB40M28jYTn0TLj5YMXM8SOJb5k6A4XANavw0ffztv
oDBXMXjosxdZ4+sPZxNqj0THGS2DL+4x2J1JgWehMPuokG930IgilHbn4znnxOqg
X+LpwO4Rx8rtirh4b0TkxqpUI9cubd4GkRevIMwahOjnUzR32JiDM=
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: =?ISO-8859-1?Q?No, score=0.0 required=5.0 tests=AWL,BAYES_20,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=msk, =d0=a1=d0, MSK, Hx-spam-relays-external:sk:smtp-ou?=
X-HELO: smtp-out-so.shaw.ca
X-Authority-Analysis: v=2.2 cv=UpATD64B c=1 sm=1 tr=0 a=MVEHjbUiAHxQW0jfcDq5EA==:117 a=MVEHjbUiAHxQW0jfcDq5EA==:17 a=IkcTkHD0fZMA:10 a=yMhMjlubAAAA:8 a=mDV3o1hIAAAA:8 a=uZvujYp8AAAA:8 a=Y80oOiP9yoPwePq8RxYA:9 a=QEXdDO2ut3YA:10 a=iFMhqsKOWMMA:10 a=AomDDAB-fV4A:10 a=293GU_Mb5uAA:10 a=_FVE-zBwftR9WsbkzFJk:22 a=SLzB8X_8jTLwj6mN0q5r:22
Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca
Subject: Re: setting TZ is harmful
To: cygwin AT cygwin DOT com
References: <2397524 DOT 6dhiyKbjLM AT omega>
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Message-ID: <b9cc8896-5c15-715e-9e65-b191af7929ce@SystematicSw.ab.ca>
Date: Tue, 6 Jun 2017 10:51:43 -0600
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1
MIME-Version: 1.0
In-Reply-To: <2397524.6dhiyKbjLM@omega>
X-CMAE-Envelope: MS4wfGl/PsZ3PJ/tzmhO1zfBE6D9WVCUIlAUbvsKLY51bKQ21Pre6fMHiMfp76f76Mzr0jm7xpcBy3MZI6zBqIkT+HJXSX7OBibXN3TZ0Rces9T1wMCdOkLP SBv8VwVijzAZQ2e7ea6hREAtV3U2JhPEPjTgZva1ZZGVyqAZuoTsdbZX5YgTSZeiqU8oMycI5U1+ZA==
X-IsSubscribed: yes

On 2017-05-09 07:37, Bruno Haible wrote:
> Currently, all commands in a Cygwin command window are run with the TZ
> environment variable set.
> It is set by /etc/profile.d/tzset.sh (or its csh equivalent,
> /etc/profile.d/tzset.csh).
> Setting TZ is harmful in two ways:
>   1) When the user changes the time zone (through the Windows Control Panel) -
>      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.
>   2) It causes native Windows programs (built through mingw, MSVC) to assume
>      a time zone that is different from the intended one and different from
>      the one that the user has set in the Windows Control Panel (see APPENDIX 1
>      below). This is because in most geographies, the values of TZ (produced
>      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 syntax
>      - it understands only a different syntax
>      https://msdn.microsoft.com/en-us/library/90s5c885.aspx .
> When TZ is not set, both Cygwin and native Windows programs take their time
> 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 .
> What are the benefits of setting the TZ environment variable? I don't
> see any!

Windows TZ is not POSIX compliant:
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03
which allows up to TZNAME_MAX bytes from the portable character set in
the current locale and quoting using <> which allows alphanumeric, plus,
and minus characters from that set, e.g. TZ=<MSK+3>-6 instead of Asia/Omsk:

$ TZ='<MSK+3>-6' date -d2017-01-01 +%Z%z
MSK+3+0600
$ TZ=Asia/Omsk   date -d2017-01-01 +%Z%z
+06+0600
$ TZ='<MSK+3>-6' date -d2017-07-01 +%Z%z
MSK+3+0600
$ TZ=Asia/Omsk   date -d2017-07-01 +%Z%z
+06+0600

Now they have quoting, maybe they will consider allowing other
characters from the current locale e.g. UTF-8 <МСК+3>, which works with
Cygwin:

$ TZ='<МСК+3>-6' date -d2017-01-01 +%Z%z
МСК+3+0600
$ TZ='<МСК+3>-6' date -d2017-01-01 +%Z%z | cat -A
M-PM-^\M-PM-!M-PM-^Z+3+0600$

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

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