tcsh 6.15.00 TZ environmental variable - unexpected behaviour.

roger.broadbent@dstintl.com roger.broadbent@dstintl.com
Wed Aug 1 11:09:00 GMT 2007


It appears that tcsh treats the "TZ" environmental variable in a special
way - upon entry into tcsh, some commands see TZ as set. Using unsetenv to
attempt to unset it is fruitless:

    bash-3.2$ unset TZ
    bash-3.2$ printenv TZ
    bash-3.2$ echo $TZ

    bash-3.2$ bash -c "printenv TZ"
    bash-3.2$ tcsh
    tcsh$ printenv TZ
    tcsh$ echo $TZ
    GMTST0GMTDT-1,M3.5.0/1,M10.5.0/2
    tcsh$ bash -c "printenv TZ"
    GMTST0GMTDT-1,M3.5.0/1,M10.5.0/2
    tcsh$ unsetenv TZ
    tcsh$ printenv TZ
    tcsh$ echo $TZ
    GMTST0GMTDT-1,M3.5.0/1,M10.5.0/2
    tcsh$ bash -c "printenv TZ"
    GMTST0GMTDT-1,M3.5.0/1,M10.5.0/2

Unfortunately our application requires TZ to be unset to function correctly
(see below for why).

Can anyone give me a pointer as to how to ensure TZ is unset in tcsh?

I have googled for "cygwin tcsh TZ" and searched the Cygwin mailing list
for "tcsh TZ", but have been unable to find any relevant threads.

I also looked briefly at the source for tcsh. From my investigations, it
appears that tcsh has various features related to time; the time of
execution of each command line is held in the history, and there is also
the facility to print the time in the prompt. As part of these facilities,
tcsh calls Cygwin functions such as ctime(), gettimeofday() and
localtime(), which call tzset(). tzset() sets the TZ environmental variable
if it is not currently set. This is then visible in the environment used
for some commands.


Why don't I simply get rid of the tcsh monstrosity and use a sensible shell
instead?

An excellent idea and my personal preference. Unfortunately this would
require considerable effort and thus the buy-in of my superiors, which is
not currently forthcoming. Additionally, the use of tcsh as an interactive
shell would need to be forbidden, which would be unpopular and difficult to
enforce both internally and with clients.


Why can't I just set TZ to the required value?

Our application uses both Cygwin binaries and binaries compiled using MSVC
from tcsh. There is no value for TZ that will produce correct time and date
information for both categories of binaries for all times of the year for
timezones outside the US that use DST. This is because the MSVC
implementation of tzset() assumes that daylight savings time is always one
hour, and starts and ends on the dates and times that happen to prevail in
the US at the time MSVC was written.

Thanks for your attention,


Roger Broadbent


All opinions expressed are my own and do not necessarily represent those of
DST International Limited.

=============================================================================================================================

http://www.dstinternational.com

Notice: This e-mail and any attachments are intended only for the individual or company to which it is addressed and may contain information which is privileged, confidential and prohibited from disclosure or unauthorized use under applicable law.  If you are not the intended recipient of this e-mail, you are hereby notified that any use, dissemination or copying of this e-mail or the information contained in this e-mail is strictly prohibited by the sender.

Whilst we run anti-virus software on all internet e-mails we are not liable for any loss or damage.  The recipient is advised to run their own anti-virus software.

If you have received this transmission in error, please return the material  received to the sender and delete all copies from your system. Thank you.

DST International Limited is a company registered in England and Wales with company number 1772349.
DST International Group Services Limited is a company registered in England and Wales with company number 5211646.
DST International Billing Limited is a company registered in England and Wales with company number 4370287.
DST International Output Limited is a company registered in England and Wales with company number 4220397.
The registered office for all the above mentioned companies is: DST House, St Mark's Hill, Surbiton, Surrey, KT6 4QD, England.


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



More information about the Cygwin mailing list