Subject: lib/12750: TZ="" causes Bus error / Segmentation fault with rdate
To: None <gnats-bugs@gnats.netbsd.org>
From: None <reed@reedmedia.net>
List: netbsd-bugs
Date: 04/25/2001 08:14:50
>Number:         12750
>Category:       lib
>Synopsis:       rdate coredumps with TZ="" -- strftime.c problem?
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 25 08:15:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Jeremy C. Reed
>Release:        not current
>Organization:
>Environment:
	
System: NetBSD rainier 1.5.1_BETA NetBSD 1.5.1_BETA (JCR-1.5-20010407) #0: Sat Apr 7 01:44:35 PDT 2001 reed@rainier:/usr/src/sys/arch/i386/compile/JCR-1.5-20010407 i386


>Description:
rainier:~$ TZ="" /usr/sbin/rdate -p pilchuck
Bus error (core dumped)

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:~$ 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 $

Also, a received an email regarding 1.5U for i386:

 $ TZ="" /usr/sbin/rdate -p private
 Segmentation fault - core dumped

 Program terminated with signal 11, Segmentation fault.
 ...
 #0  0x480ce880 in strftime ()
 #1  0x480cfb97 in tzsetwall ()
 #2  0x480cfce2 in localtime ()
 #3  0x480d0234 in ctime ()
 #4  0x8048e79 in dladdr ()
 #5  0x8048985 in close ()

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, so I guess the
error was caused from that fix.

>How-To-Repeat:
TZ="" /usr/sbin/rdate -p your-RFC868-time-server
>Fix:
relook at basesrc/lib/libc/time/strftime.c Revision 1.11 changes.

>Release-Note:
>Audit-Trail:
>Unformatted: