Subject: TZ="" causes Bus error with rdate
To: None <current-users@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: current-users
Date: 04/25/2001 07:00:16
rainier:~$ TZ="Africa/Dar_es_Salaam" /usr/sbin/rdate -p pilchuck            
Wed Apr 25 16:41:49 2001
rainier:~$ TZ="" /usr/sbin/rdate -p pilchuck
Bus error (core dumped)
rainier:~$ TZ="Africa/Dar_es_Salaam" date                       
Wed Apr 25 16:43:45 EAT 2001
rainier:~$ TZ="" date
Wed Apr 25 13:43:52 GMT 2001

Program terminated with signal 10, Bus error.
...
#0  0x480ca00a in strftime ()
#1  0x480cb2eb in tzsetwall ()
#2  0x480cb436 in localtime ()
#3  0x480cb988 in ctime ()
#4  0x8048e55 in dladdr ()
#5  0x8048969 in close ()

rainier:~$ uname -prs
NetBSD 1.5.1_BETA i386
rainier:~$ ident /usr/sbin/rdate 
/usr/sbin/rdate:
     $NetBSD: crt0.c,v 1.11 2000/06/14 22:52:49 cgd Exp $
     $NetBSD: rdate.c,v 1.10.4.1 2000/07/27 16:25:17 itojun Exp $
rainier:~$ ident /usr/src/lib/libc/time/strftime.c
/usr/src/lib/libc/time/strftime.c:
     $NetBSD: strftime.c,v 1.10.4.1 2000/09/07 14:52:32 taca Exp $
     $NetBSD: strftime.c,v 1.10.4.1 2000/09/07 14:52:32 taca Exp $

I looked at the CVS logs for strftime.c and related PRs, but didn't see
anything related other than PR lib/10950 implementing:
 > - Fix strftime(3) not to ignore tm_zone filed of last parameter,
 >   and "%Z" in format string is converted as proper time zone.
 >   This was taken from tzcode2000f.  Fix PR lib/10950.

So I tried on a NetBSD 1.4.2 system and no Bus Error.

On a side note, how can I get ktrace to show the library calls:
 18763 rdate    RET   socket 3
 18763 rdate    CALL  connect(0x3,0x804e260,0x10)
 18763 rdate    RET   connect 0
 18763 rdate    CALL  read(0x3,0xbfbfdb84,0x4)
 18763 rdate    GIO   fd 3 read 4 bytes
       "\M->\M^QS\M^Q"
 18763 rdate    RET   read 4
 18763 rdate    CALL  close(0x3)
 18763 rdate    RET   close 0
 18763 rdate    PSIG  SIGBUS SIG_DFL
 18763 rdate    NAMI  "rdate.core"

In other words, how can I trace the system calls to also see
close(), dladdr(), ctime(), localtime(), tzsetwall(), and then strftime()?

   Jeremy C. Reed
   http://www.reedmedia.net/