Python for Windows reports wrong local time when run under Cygwin on Europe/Moscow TZ

Mike Kaganski
Tue Jun 8 13:30:17 GMT 2021

On 08.06.2021 16:04, L A Walsh wrote:
> On 2021/06/08 05:28, Mike Kaganski wrote:
>> No, I report a problem that a native program runs incorrectly *under 
>> Cygwin*, because Cygwin is indeed part of the picture.
> ---
>     The problem is in the MS-Win term program.  If you report
> it to them and tell them it only misbehaves when you have a 3rd
> party app injecting "dll's" (libraries) into the MS-program, they
> will _likely_ tell you that they can't support every 3rd party
> program that injects libraries into MS programs, and they can only
> support you running it without the 3rd party programs.

First of all - please stop telling me that I required support. I didn't 
demand anything, and was asking *in the hope*, but without any wrong 
expectations that anyone owes anything here. I never claimed that 
someone must support my use case - so please, please stop answering what 
wasn't said. I am a free software developer, working on LibreOffice 
project; I know what free software is, and what mailing list is. That 
they don't support something doesn't mean it's inappropriate to ask with 
a hope, a question that could be *possibly* answered, and which answer 
could happen to be helpful also to others.

>     Just like cygwin devs have noticed that various
> other programs (see 
> BLODA: )
> are known for causing problems in cygwin.  The cygwin devs can't
> support all the 3rd party programs that interfere.

See above.

>> and being not a prophet, I can't know in advance if the actual bug 
>> lies in Windows, in Python, or in Cygwin interaction with them. 
> ---
>     As I said before, python is probably picking up time-zone
> changes from _both_ cygwin and windows.  The workaround is to use
> the appropriate version of python with the correct OS.  Cygwin is
> an OS emulation, Win10 is another OS.  They both have versions of
> python designed for them.  If MS thought the cygwin version of python
> was good enough for every purpose, they wouldn't have issued their
> own version.

MS didn't. The native Windows builds of Python weren't from MS - they 
were from LibreOffice and from Python Software Foundation, as described 
in the initial mail (and at the sites linked there).

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

I will ask at Python, of course. I didn't yet, because I didn't want to 
cross-post same question to many places, and am waiting until it's clear 
that I need to ask there, not here.

>> And I assume that Cygwin is not declaring that its users "must never 
>> run native applications from Cygwin", so I find that passage above 
>> inappropriate and off-topic.
> ---
>     Just because they don't tell you to never run linux apps
> directly in cygwin doesn't mean they support it if you insist on 
> trying.  Most devs won't tell you all the things you can't do, because
> that list is endless.  That certainly doesn't suggest that they would
> support all the things that don't work.

See above.

>>> Though as to why -- likely the windows version is getting time zone
>>> clues + correction from BOTH cygwin and Windows, like it's told its
>>> in a TZ that is at 1 time, while Windows feeds it other data that
>>> says it is 2 hours off from the default. 
>> Maybe. It's OK if no one here knows the reason - I of course don't 
>> expect anyone here obliged to give an answer. My question was 
>> intended to ask if someone (e.g., a Cygwin dev) somehow can see the 
>> problem from their expertise, and - maybe - even know how to fix it. 
>> Maybe there's some technique how to workaround this problem - and 
>> even if it's not a Cygwin's bug, it still could be useful for Cygwin 
>> users, hence still the post to the list, accompanied by someone's 
>> workaround, would be reasonable and useful.
> ----
>     When you say you run the Win python on cygwin, what do you
> mean?

I mean "start Cygwin terminal - either C:\cygwin64\bin\mintty.exe, or 
C:\cygwin64\Cygwin.bat; then start Python using a command line as 
provided in the initial mail - I have provided there a full command line 
with the path".

>   ... I just ran python from windows (not the same version you
> have, but an old one python2.7.  I ran it from bash, but the resulting
> python doesn't have any cygwin libraries loaded -- that tells me that 
> python is looking at some absolute paths and the environment and picking
> up both -- it's a MS-python "bug".
> Look in its environment and remove any thing for timezone and try that.

I will try without TZ.

> Or look in your path and make sure there are no cygwin directories
> in the path that your win-python is using.  I'm pretty sure that
> will solve your problem.
> FWIW, here is a list of what python running from 'bash.exe' from
> cygwin has loaded -- and none of it is from cygwin:
> /prog/Sysinternals/cmd/exe> Listdlls python

Indeed there's no Cygwin's DLLs reported.


Best regards,

Mike Kaganski

More information about the Cygwin mailing list