Subject: Tripwire on NetBSD/Sparc
To: None <port-sparc@netbsd.org>
From: LeRoy C. Miller III <qball@ansic.net>
List: port-sparc
Date: 06/28/2000 17:47:13
ok awhile ago I emailed the list asking if anyone had a fix for tripwire on the
netbsd sparc port, it seems to seg fault core dump.  A few ppl expressed
intrest in howto fix it but none had, either had time to work on it or bothered
that informed me.  I too didn't have time until recently and not much at that. 
I spent about 2 hours on tripwire (Sun4c machine) tring to figure out why it's
coredumping.  I have since come to the conclusion.. I have no clue why :) hehe

I removed the -O flag for compilation and replaced it with -g for debugging
here is what I found (not much but hey, I actaully was thinking this could be a
compiler problem?? comments?)

The seg fualt is coming from utils.c 
function direntry_print()
(this line actually)
(void) printf(" %-9.9s %7d %s", owner, statbuf.st_size, a_time + 4);

before this line I added some debugging code (fprintf's)
This is the modified block I was using
        (void) strcpy(a_time, ctime(&statbuf.st_mtime));
        a_time[24] = '\0';
        fprintf(stderr,"ATIME= %s\n", a_time + 4);

        print_perm((uint32)statbuf.st_mode);

        fprintf(stderr, " OWNER = %-9.9s \n", owner);
        fprintf(stderr, "statbuf.st_size = %7d", statbuf.st_size);
        (void) printf(" %-9.9s %7d %s", owner, statbuf.st_size,
                                                a_time + 4);

Now the fprintfs I have in there are working fine, and all the strings are null
terminated etc... gdb values <here>
2: a_time = "Thu Jun 29 14:39:05
2000\000\000Â\000\000\000çè\000\000\000\000\000\000\000\e\000\000\000\000\000\00
0\000\000\000"
1: owner = "root", '\000' <repeats 15 times>
4: statbuf.st_size = 27

here is a short bt output i was using any other info needed I would be glad to
provide.

Program received signal SIGSEGV, Segmentation fault.
0x100ba350 in strlen ()
#0  0x100ba350 in strlen ()
#1  0x100b82f4 in vfprintf ()
#2  0x100a7480 in printf ()
#3  0xb090 in direntry_print (
    name=0xefffca68 "/usr/local/etc/reboot.local-test", statbuf={
      st_dev = 268714048, st_ino = 21828, st_mode = 41453, st_nlink = 1, 
      st_uid = 0, st_gid = 0, st_rdev = 0, st_atimespec = {tv_sec = 962303945, 
        tv_nsec = 0}, st_mtimespec = {tv_sec = 962303945, 
        tv_nsec = 285212804}, st_ctimespec = {tv_sec = 962303945, 
        tv_nsec = 269069980}, st_size = 27, st_blocks = -1034297394109348504, 
      st_blksize = 4026528296, st_flags = 20528, st_gen = 17208, st_qspare = {
        87960930226196, -1152950744474806752}}, mode=2) at utils.c:703
#4  0xe9d4 in preen_report (interactive=0, ppp_updateentries=0x2a49c)
    at preen.report.c:129
#5  0xb99c in update_gather (interactive=0, ppp_updateentries=0x2a49c)
    at preen.c:97
#6  0x6534 in main (argc=1, argv=0xeffff79c) at main.c:595


sorry for the length and sloppiness of this message, anyoen who can be of help
here I would greatly apperciate it.

Thank you
LeRoy

LeRoy C. Miller III
Network Administrator ANSIC Networks
Email: qball@ansic.net
Phone: 610-681-6504
Whois NIC: LM4772
http://www.ansic.net <not fully functional yet>