Subject: IRIX GMT SPT_NONE fix: beta-13 works; beta-16 breaks

From: Mark Bergstrom <[email-masked]>
Date: Wed, 4 Mar 1998 18:03:12 -0600 (CST)

There is probably a subtle address-shift bug, but I can't see what causes
this without stepping through each side-by-side in gdb or the ProDev
debugger and my time for this is limited.  

What I notice between the two ftpd.c versions is that 16 is attempting to be
all-comprehensive with its initsetproctitle and rewritten SPT_TYPE cases
while in 13, it was simply an oversight in the config.h since SPT_REUSEARGV
doesn't work in IRIX.  Nothing else in the contrast jumps out at me.

The ctime(&curtime) pointers look identical for both releases and this
pointer to the 26 character string should pull the value from /etc/TIMEZONE
correctly since this is actually read by init following the system boot and
is understood by other syslog calls independent of needing to set the
environment variable TZ locally in the shell that builds wu-ftpd.  However,
the default values of altzone [the difference in seconds from UTC] and
timezone are zero {UTC}. Why beta-16's syslog() calls cannot see the correct
time is not obvious.

The declarations in the /usr/include/time.h are standard.

Beta-13 with SPT_TYPE set to SPT_NONE built on IRIX5.3,6.2,6.4 (but without
the -n32 ABI) does produce the correct timestamps in both /var/adm/SYSLOG
and /usr/local/logs/xferlog.  Setting the ABI for enhanced 32-bit produces
only warnings, but other minor mysteries show up so I gave up on that.
Porting to 64 bit is the next challenge for all the newer Origin boxes.  

Mark Bergstrom
_____________________________________________________________________________
UNIX TEAM--Dedicated to the proposition that the last good thing written in C
	   was not Shubert's 9th Symphony

---

From: Craig Lee <[email-masked]>
Date: Wed, 4 Mar 1998 22:24:53 -0600 (CST)

>Date: Wed, 4 Mar 1998 18:15:13 -0800
>From: [email-masked] (Craig Lee)
>To: Mark Bergstrom <[email-masked]>
>Subject: Re:  IRIX GMT SPT_NONE fix: beta-13 works; beta-16 breaks
>Reply-To: [email-masked]
>
>Hi Mark!
>
>No, the above is wrong.  ctime() doesn't touch /etc/TIMEZONE, it checks
>TZ, and it expects init to have read /etc/TIMEZONE at system boot time
>and for all processes created by init or its descendants to have TZ set
>correctly.
>
>syslog() is not independent of TZ.  It's independent of /etc/TIMEZONE.
>
>Cut&pasting the following worked on an irix6.3 O2 and an irix5.3
>Indigo^2 here, so i'd expect it to work at your place too:
>
>#++ begin ++
>cat /etc/TIMEZONE
>cat >ctimetest.c <<EOF
>#include <stdio.h>
>#include <time.h>
>main(){time_t t;printf(ctime((t=time(0),&t)));}
>EOF
>make ctimetest
>./ctimetest
>csh unsetenv TZ
>./ctimetest
>exit
>./ctimetest
>#-- end --
>
>The above conlusively proves (at least on SGI's here) that "ctime()"
>does not check /etc/TIMEZONE but does check the environment variable
>TZ.
>
>And when i cut&pasted this on an irix6.3 O2 and an irix5.3 Indigo^2:
>
>#++
>cat >syslogtest.c <<EOF
>#include <syslog.h>
>main(int c,char**v){syslog(LOG_USER,c>1?v[1]:"test");}
>EOF
>make syslogtest
>./syslogtest
>csh
>unsetenv TZ
>./syslogtest test2
>exit
>./syslogtest
>tail -f /usr/adm/SYSLOG
>#--
>
>tail showed:
>	Mar  4 17:22:27 0B:basenji syslog: test
>	Mar  5 01:22:28 0B:basenji syslog: test2
>	Mar  4 17:22:28 0B:basenji syslog: test
>and similarly for the other.
>
>The above pretty conclusively proves (at least on the SGI's here) that,
>when using "syslog()", /etc/TIMEZONE is not checked but the environment
>variable TZ is checked.
>
>init et al do check /etc/TIMEZONE, then they set environment variables
>like TZ.  But, as the above tests show, the setting of /etc/TIMEZONE is
>irrelevant to the problem at hand, the setting of TZ is relevant.
>
>I think it's probably like you said last night: somewhere beta-16 is
>doing something that's overwriting the saved environment strings so
>that when "syslog()", via "ctime()", tries to check TZ, it's been
>zapped.
>
>Or TZ isn't getting set.
>
>Or the wuftpd daemon is doing a an exec*() call w/out the "char*
>envp[]" array correctly set.
>
>But it has nothing to do /etc/TIMEZONE.
>
>-- -- --
>C Code.  C Code Run.  Run, Code, RUN!
>