This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Setting TZ may break time() in non-Cygwin programs


Christopher Faylor wrote:
On Tue, Apr 17, 2012 at 09:06:15AM +0200, Corinna Vinschen wrote:
On Apr 11 20:52, Christian Franke wrote:
Yes. Patch is attached.

Christian

Thanks for the patch.  I'm just wondering if we shouldn't generalize
this right from the start by keeping an array of variables to skip
when starting native apps and a function to handle this, along the
lines of the getwinenv function and the conv_envvars array.
It might only contain TZ now, but there's always a chance we suddenly
stumble over a similar problem, isn't it?
I really hate having Cygwin be "smart" like this.  It seems like it's
asking for a follow-on "How do I set TZ for my Windoze program???"
email, followed by a "We need a CYGWIN environment variable option!"

What's the problem with just unsetting TZ again?  Yes, I know you
have to remember to do it but does this affect enough programs that
we need to add even more head standing code in Cygwin to accommodate
it.

It affects all C/C++ programs which use time() and friends from any version of MSVCRT as DLL or static library.


Which means that cygcheck is also affected:

$ echo $TZ
Europe/Berlin

$ objdump -p /bin/cygwin1.dll | grep 'Time/Date[^ ]'
Time/Date               Sun Apr 15 19:56:27 2012

$ cygcheck -v /bin/cygwin1.dll | grep 'cygwin1.*ts'
  "cygwin1.dll" v0.0 ts=2012/4/15 18:56

$ export TZ=America/Los_Angeles

$ objdump -p /bin/cygwin1.dll | grep 'Time/Date[^ ]'
Time/Date               Sun Apr 15 10:56:27 2012

$ cygcheck -v /bin/cygwin1.dll | grep 'cygwin1.*ts'
  "cygwin1.dll" v0.0 ts=2012/4/15 18:56

$ unset TZ

$ objdump -p /bin/cygwin1.dll | grep 'Time/Date[^ ]'
Time/Date               Sun Apr 15 19:56:27 2012

$ cygcheck -v /bin/cygwin1.dll | grep 'cygwin1.*ts'
  "cygwin1.dll" v0.0 ts=2012/4/15 19:56


In this case the effect is harmless. In other cases it may break functionality.


Christian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]