delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/06/11/14:06:13

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 13A20397F420
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1623434772;
bh=ipwR9ly0t3uXlTk7TfjmrS2P1x1gyyOaE6/2zAGrCMI=;
h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=JcT2eCwi6LxBsPpPDBVhYijTAONUBaVpwTZflu29Pxws4TD6YRZfyERgvHOqRg7WO
w6ohUlTYzhZLvCU7ta97a22zUVIF/cagcwygR8KwKoqSABnssbAfEGJbXbFoJGwueE
9c1Amo1PDDW3silwvBxTkff7K8jBo35+YxXwqXQk=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 06F5C385782A
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=EjWOhFgJc1jb6kaVaeFsjw3q8gm3uJ6Ebx3dxGy0uhLv26MFKIpw2erhhIMkTy/yRqI/NvF1tebIQrCVDZ1vjidWAt42adSXaQg2juUgt60VOnmkUEkvsv+BbirbLM/+6KBJXcOsEOVZQ3UiYAiC7swwLsVTq05PSzdWGEvNrVSLVfKJXfDPfHZnhmfGMnBVHXdP3r/lw4fHR0gCEIdO8W/s2H5TMOsLYXArDkg/a6G27KU3dK214OncqibRcz+r4O7jjeOQyIA+YibwHdqu26/Xa+FZd6IMbP7x2l8PnwkhIONlUqTQlqEmd6v132Kd8HIz8rMAmIuNzhFXDCXgxw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector9901;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=4AunZSZQHdgsW2LZ6R3y+0pLR4TdFK35BxfKUDxcioc=;
b=KEAummlIZtsUtfA9npO5HKQZwTLTtD38VvqZjwCXo57gdvr5PLYVOpc/xFMrAIv//2+AfHWheC95TWp/DYv4GRrnIy0evPq2+j8afPkzN4mF+TyHjulWlMLtPbrqjTRDffLZry0oseEjXzgLCA1sd2e6BmZzPH3/VIR1KD1uVesf7zm6cMVs0vYYNd8d2UXDbaWnMvJQYdZxXh6pnFAtIaewnfI9k95MHbnWL+q8/5DZVHomK/Yqn7C4ljgzD/B0L8fZa6gJSUmo1IwblnCnZIMD/K40tBWfMfsi+QAtIzokrU3iMW2rRA1ni3WrjZUz39K8TYEvaJayoYAudRqGqA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu;
dkim=pass header.d=cornell.edu; arc=none
Subject: Re: Python for Windows reports wrong local time when run under Cygwin
on Europe/Moscow TZ
To: cygwin AT cygwin DOT com
References: <CAAHpriO6A+6bLXt0Qe-xpdXT1CiLjk7=7G31cHBtnVJ0kXb2Eg AT mail DOT gmail DOT com>
<CAAHpriOJ5EZ0YzXjNOV-fydCb6bWHmPKiFZUC7KtFAi8DnkkDQ AT mail DOT gmail DOT com>
<02d5b40f-aa35-f56c-5c5c-b10780355e91 AT SystematicSw DOT ab DOT ca>
<0fcfeb54-53c5-b83d-bb13-e83a68eed469 AT cornell DOT edu>
<28d9253d-71f4-c265-2861-9a3b0667799b AT SystematicSw DOT ab DOT ca>
<be106324-4371-a804-5ccc-dec22b37f4af AT cornell DOT edu>
<de7f3163-74c0-f304-ee58-a12064864196 AT SystematicSw DOT ab DOT ca>
Message-ID: <55e1f8cd-ae55-dbda-ea6e-b9c000ec329c@cornell.edu>
Date: Fri, 11 Jun 2021 14:05:34 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
In-Reply-To: <de7f3163-74c0-f304-ee58-a12064864196@SystematicSw.ab.ca>
X-Originating-IP: [2603:7081:7e41:6a00:15d5:b957:e333:52ec]
X-ClientProxiedBy: CH2PR02CA0020.namprd02.prod.outlook.com
(2603:10b6:610:4e::30) To BN7PR04MB4388.namprd04.prod.outlook.com
(2603:10b6:406:f8::19)
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id: 5093b6a5-6805-44ff-69f7-08d92d038370
X-MS-TrafficTypeDiagnostic: BN8PR04MB6370:
X-Microsoft-Antispam-PRVS: <BN8PR04MB63701B22994BADDA677072E6D8349 AT BN8PR04MB6370 DOT namprd04 DOT prod DOT outlook DOT com>
X-MS-Oob-TLC-OOBClassifiers: OLM:10000;
X-MS-Exchange-SenderADCheck: 1
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: eZSY9XsLtprQeq0jMye/tqjRlxS+GfmbY8ZfcIU5vckhAeg+4RJ9Wg2wS3PeYWeyDom/F6rJxKDKZW+8npc92QxzLY+f9jIRsPmpi+80BEY+hK8rzt3KdaONV5xjgMKnH3eBrFx8eZrsNw2wuLRuzhu/tmk9oSTF6/jl8oZZX6yDwMdPwu0udBJhUzN++FNPzH/Gf76y9jmIlPFvMbZl6PtdS7HCr6xNDT11rVkHEjMN8V8dWHvsTrouNoT3gvaZaol9EHgpoNbD5uLlM6HzF8tN4dhnXmIpJ4kGlOZFacUtZugFOYXEyFUvRY7duMv/o1P4s4g7PZQN+OiNkOsnkpANpvPxAT394UcxRCH5vyRd4Q42Se6midZG+vuKvpdKHvWUNdEbDNk4QpnjQSE2F+0IHfvUWWDQQsXfqQBCTNKOmZAOfQ6dVICmH1XYyDLMGmzGdruNHgopw6tOfZW+SOafRoQ+geiwYjG8uR27I1TlAYNHs7OVA8U13RXQ6w7FVeXFBEK93Ibe/sQuN0xJAkdGsFzq9cerx+HZvyA4EG50eibam8Vsf5xqkBF9oVTMgr1If1z6eDCO8hiMoa1zjYnjMZYX0zgaY/sStqp1Sep116Q2RXmOE8qSeDucBS+gQtaoLO64+SvwnZbnKxZU1VdkEbkmZCeMzwcqMOQ2bDZFYH5lKhuLoQNnkvZkDm4LOrryJhX/wUqKJNhkvzOCt9bQ7flWxZmOCs75An+9RAyq2NST8qzfnPNKsjCATz2GesKZfeSdileuYwH48ioB/pr9MnV3wjc0TQYbqRNX52EAulDkUdtRTSdd+cseUnZVLxPnOav9+P9g2owigtQb1A==
X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
IPV:NLI; SFV:NSPM; H:BN7PR04MB4388.namprd04.prod.outlook.com; PTR:; CAT:NONE;
SFS:(4636009)(376002)(396003)(366004)(346002)(39860400002)(136003)(66946007)(75432002)(16526019)(186003)(2616005)(36756003)(966005)(6486002)(66556008)(8676002)(8936002)(5660300002)(66476007)(478600001)(2906002)(786003)(316002)(31686004)(53546011)(86362001)(6916009)(31696002)(83380400001)(38100700002)(43740500002)(45980500001);
DIR:OUT; SFP:1102;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: =?Windows-1252?Q?a3bIKo/XU38eURtPxUN2xqrJBuIFEM288SK/SLCqMC8xutv6kqJJ/4ge?=
=?Windows-1252?Q?L0erLQeYOucmqN5R61AdFYuwOyvP/voy8mKJbF2GWbHGNacJlFn1Mc79?=
=?Windows-1252?Q?Fv04S8Uy29xhvmwF33NA2nDmxbryOjvAzvM8Qxrqr9AJcUfiakUjsSXg?=
=?Windows-1252?Q?hFRZaea3uNm+2h+iiTKiQaq3E+qJiuZsRN/I2VDX/w6VpCfcFUn4i3/K?=
=?Windows-1252?Q?VJSZkVFQXOcX7Uo2q0iWr8qKuc+LWwmGUHLV3Rpv0l/T4US1sm0nsB38?=
=?Windows-1252?Q?CSO6OQhw5y8YMyxu+3bKfD6KuBT7ETqX/tGMuNph2SSA2hw1ofgofIKf?=
=?Windows-1252?Q?KD2WA07nDysqRP/cnoUcfeGGOm3AJywXghhWLOHJtmdARoKKXsXJZeYl?=
=?Windows-1252?Q?2RiDgdgHutFJu+KSyJzOKSFhTzzFdQUGlOnQYvWXw4bVSCBMe3DRha2q?=
=?Windows-1252?Q?sqNhj8xwwlgio+ToXU1V0/IqGTBeDKSDhEdobvDHajXculJZkU9u+SIw?=
=?Windows-1252?Q?puPlGjzPFepBFO4HxvirfvodTr0CrJhLzWKxkIlD8XZLJ7zjPTjeQdHK?=
=?Windows-1252?Q?cfSE/c6byTdoM213h1XFvsZ7nkTg6IDgdJ8amjiO5dbgy2gv61wZ4NKu?=
=?Windows-1252?Q?EQV2lcuMsabSeAfbWeKf+X6XaeBotFG2lfHGwYCtZ68TVLAF32YXhXPL?=
=?Windows-1252?Q?f8nIieVYtkIEwl7wy6f/D12PSr1GGQ30LcOtw6IjZtksCfgyFm/iUGXO?=
=?Windows-1252?Q?UJNXtrhSuNoQ6KYh2upez57/JIMugbtR0SfQYqOHg5ZBtVr9+Embq68B?=
=?Windows-1252?Q?azAx/PzahjXz95FJdIWtEf1EFrohMHcP82XPrvnwiAR4i32VMdgdIkAc?=
=?Windows-1252?Q?xu2sd3cCjQurkwUrXJJW/3i8COXKSWcPrj7oFLSE+qEtcoz6Ky0s1Avd?=
=?Windows-1252?Q?oyOmuMfrgS0pUof01UFvi0AitfXHg7CnpJLK9BmqgPA0Ma2Qp+OnZO/u?=
=?Windows-1252?Q?pXHawhvsJ8QQQMft7Ns/SVvi+ReIkysvLGYqs2XIG04z9YAfBHCvxS9n?=
=?Windows-1252?Q?rTAoOVUcJEshgPTEM7QwqhQaWXrNJc+ne2VEoMpTyefaQqKsnl8WgdN4?=
=?Windows-1252?Q?KNVgsdK77/6J/QsOK7ZpLwmy3J9d1Rl0dAJ0SAIO4FLhb5nuDnKkXaLF?=
=?Windows-1252?Q?UQ5hHUx9w59EAlESr2DdrYKzM6h56SBu1/5pR87ZgNHzD/zI6uYLia7U?=
=?Windows-1252?Q?8u8RA8mMWBI59mPvbSrqDdt4EHjiWDbXy+WIE4cCWj2mycvJve71az10?=
=?Windows-1252?Q?NR3ICZW0DiJoncV/G5LDqIImwGzkTfDhgbzsnVxM0sC9QhS4tmeYWISZ?=
=?Windows-1252?Q?tES80JnqIAbyGWgfEmNA7Fqhw5qtwa4jdIRsAfMq69JaDwzaBqkNg0fG?=
=?Windows-1252?Q?JvjDRw2jASc8Ixu9K2SovnQfr3sm8GfRU72fsIXaXnusJixyohIOeSU/?=
=?Windows-1252?Q?bkIIdD4T?=
X-OriginatorOrg: cornell.edu
X-MS-Exchange-CrossTenant-Network-Message-Id: 5093b6a5-6805-44ff-69f7-08d92d038370
X-MS-Exchange-CrossTenant-AuthSource: BN7PR04MB4388.namprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2021 18:05:36.4489 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 5d7e4366-1b9b-45cf-8e79-b14b27df46e1
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: TaQBd/kp+ZcoTEbIOrpINzkqFKlo7xNak2a4hBcgOH+vmnQHUCfmmTc2XtQkAlkdZAnrJrZ7EU2C21fkNjegVQ==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR04MB6370
X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00, DKIM_INVALID,
DKIM_SIGNED, KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, NICE_REPLY_A,
RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS,
TXREP autolearn=no autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Ken Brown via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Ken Brown <kbrown AT cornell DOT edu>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id 15BI6D6O002184

On 6/11/2021 1:33 PM, Brian Inglis wrote:
> On 2021-06-10 13:50, Ken Brown via Cygwin wrote:
>> On 6/10/2021 2:31 PM, Brian Inglis wrote:
>>> On 2021-06-10 08:57, Ken Brown via Cygwin wrote:
>>>> On 6/9/2021 10:36 PM, Brian Inglis wrote:
>>>>> On 2021-06-09 16:31, Keith Thompson via Cygwin wrote:
>>>>>> [Sorry if the threading is messed up.  I don't subscribe, so I'm
>>>>>> constructing this message from the web interface.  It should at least
>>>>>> show up under the correct subject.]
>>>>>>
>>>>>> Brian Inglis wrote:
>>>>>>> On 2021-06-08 14:03, Mike Kaganski via Cygwin wrote:
>>>>>>>> On 08.06.2021 16:04, L A Walsh wrote:
>>>>>>>>> You might ask on a python list if anyone else has experienced
>>>>>>>>> something similar with python or any other program.  I'm fairly sure
>>>>>>>>> that neither MS nor cygwin design their OS with python in mind and
>>>>>>>>> that it is python that is interacting funny when running under some
>>>>>>>>> merge of both.  Have you asked the python people about this problem?
>>>>>>>>> What did they suggest?
>>>>>>>>
>>>>>>>> FTR: filed https://bugs.python.org/issue44352.
>>>>>>>
>>>>>>> See Keith Thompson subthread and my reply with suggested fix:
>>>>>>>
>>>>>>> https://cygwin.com/pipermail/cygwin/2021-June/248692.html
>>>>>>>
>>>>>>> Windows does not recognize zoneinfo time zone identifiers in TZ only
>>>>>>> base format POSIX TZ strings with three alphabetic character identifiers:
>>>>>>>
>>>>>>> https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/tzset?view=msvc-160 
>>>>>>>
>>>>>>>
>>>>>>> That assumes US switch date "rules": for all years up to current, or
>>>>>>> just DST, and whether pre- or post-2007 is unstated!
>>>>>>>
>>>>>>> Otherwise it defaults to regional settings, used by Cygwin to map to
>>>>>>> zoneinfo time zone identifiers, so if Python for Windows could clear TZ
>>>>>>> before it is read by MSVCRT, it should DTRT.
>>>>>>>
>>>>>>> Windows does not recognize expanded POSIX TZ format strings with <>
>>>>>>> quoted alphanumeric characters, "-", "+", and start and end dates/times:
>>>>>>>
>>>>>>> https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#bottom 
>>>>>>>
>>>>>>>
>>>>>>> which make them usable outside of the US.
>>>>>>
>>>>>> Summary: IMHO Cygwin should adapt its default TZ setting to work
>>>>>> with Windows.
>>>>>>
>>>>>> The suggestion is to modify Python for Windows so it can deal with
>>>>>> the TZ format used by Cygwin.  I haven't used Python for Windows, but
>>>>>> as far as I know it's unrelated to Cygwin; rather it, like Cygwin, is
>>>>>> intended to work on top of Windows.  I'm not convinced it's appropriate
>>>>>> to ask Python for Windows to make a change purely for the sake of
>>>>>> interoperating with Cygwin, which many PfW users presumably aren't
>>>>>> even using.
>>>>>>
>>>>>> I've run into another application that has problems with Cygwin's
>>>>>> settings of $TZ.  It was a internal test application that isn't
>>>>>> going to change its timezone handling just for this problem.
>>>>>>
>>>>>> The ideal solution would be for Windows to recognize TZ values like
>>>>>> "America/Los_Angeles", but that's not likely to happen any time soon.
>>>>>>
>>>>>> My suggestion, since Cygwin is supposed to interoperate with Windows,
>>>>>> is one of the following:
>>>>>>
>>>>>> - Cygwin should avoid setting TZ to a value that Windows doesn't recognize
>>>>>>    (if I set TZ=PST8PDT, everything seems to work correctly); OR
>>>>>>
>>>>>> - Cygwin shouldn't set TZ at all by default.  (I've updated my
>>>>>>    $HOME/.bash_profile on Cygwin to unset TZ, and Cygwin commands seem
>>>>>>    to work correctly with TZ unset); OR
>>>>>>
>>>>>> - Cygwin, when invoking a non-Cygwin executable, should first either
>>>>>>    unset TZ or translate it to a format that Windows will recognize.
>>>>>>    I have no idea how difficult that would be.
>>>>>
>>>>> Impossible to set Windows TZ usefully as it obeys unstated US DST rules 
>>>>> (like posixrules, perhaps 2007+?), and may have limits on hour offset 
>>>>> magnitudes.
>>>>> MS libraries are stuck at POSIX 1996 and C 99 subset compatibility, but 
>>>>> non-standard-conformant including which headers contain definitions:
>>>>>
>>>>>      https://docs.microsoft.com/en-us/cpp/c-runtime-library/compatibility?view=msvc-160 
>>>>>
>>>>>
>>>>> It may be possible to unset TZ when running non-Cygwin programs (possibly 
>>>>> behind a CYGWIN env var setting e.g. winnotz) by adding TZ= to 
>>>>> conv_envvars, and writing new helper functions env_tz_to_posix to call 
>>>>> tzset and env_tz_to_win32 to remove TZ in:
>>>>>
>>>>>      https://sourceware.org/git/?p=newlib-cygwin.git;f=winsup/cygwin/environ.cc;a=blob 
>>>>>
>>>>>
>>>>> What is the opinion on this from both Windows users and Cygwin patchers?
>>>>
>>>> I'm not convinced it's worth the trouble.  I haven't seen anyone argue that 
>>>> it's useful for Cygwin to set TZ, and I have seen an argument that it's 
>>>> harmful:
>>>>
>>>>    https://cygwin.com/pipermail/cygwin/2017-May/232675.html .
>>>>
>>>> So I prefer Keith's second suggestion:
>>>>
>>>>  >> - Cygwin shouldn't set TZ at all by default.
>>>
>>> It does so in default startup scripts
>>
>> Right, and I'm agreeing with Bruno (in the message cited above) that the 
>> default startup scripts should stop doing that.
>>
>>> to get the correct behaviour from Cygwin DLL and programs,
>>
>> Can you be more specific?  What goes wrong if TZ is not set?  I haven't seen 
>> any POSIX or Linux documentation that says it should be set, and I've just 
>> checked on two different Linux distros that it's not set by default.
> 
> I would expect that date, ls, etc. would output UTC, or perhaps PST or EST, 
> depending on tzdata builds of Factory (tz -00/unset) and posixrules (Cygwin PST, 
> Debian EST) and use during system setup and startup, unless /etc/timezone and/or 
> /etc/localtime are set, and used during startup, often by systemd, or login by 
> profiles.

No, you can 'unset TZ' and everything works fine.  Try it yourself.

> How do you set or get useful local time on your systems?

Cygwin takes care of it.  If TZ is unset, Cygwin queries Windows via 
GetTimeZoneInformation.  See tzgetwintzi in 
winsup/cygwin/tzcode/localtime_wrapper.c.

Ken

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

- Raw text -


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