bb-larrdcolumn and NetBSD

Emmanuel Dreyfus manu at netbsd.org
Mon Jan 17 14:49:20 CET 2005


Hi

I'm trying to debug what goes wrong with bb-larrdcolumn on NetBSD:
# ./bb-larrdcolumn                         
Memory fault (core dumped) 

Is there a particular command line usage to get closer to how it is
executed during normal operation?

gdb says that:
Program received signal SIGSEGV, Segmentation fault.
0x480e000c in strcpy () from /usr/lib/libc.so.12
(gdb) bt
#0  0x480e000c in strcpy () from /usr/lib/libc.so.12
#1  0x0807cde0 in fdhead ()
#2  0x0804b540 in load_hostnames (bbhostsfn=0x0, extrainclude=0x0, fqdn=1, 
    docurl=0x0) at loadhosts_file.c:61
#3  0x0804a17d in main (argc=1, argv=0xbfbfedac) at bb-larrdcolumn.c:439
#4  0x080494c2 in ___start ()

Defining BBHOSTS and BBVAR in the environement works around theses crashes
I suggest the following patch:
--- bb-larrdcolumn.c.orig       2005-01-17 14:46:56.000000000 +0100
+++ bb-larrdcolumn.c    2005-01-17 14:48:59.000000000 +0100
@@ -428,8 +428,18 @@
        }
 
-       if (bbhostsfn == NULL) bbhostsfn = getenv("BBHOSTS");
+       if ((bbhostsfn == NULL) &&
+           ((bbhostsfn = getenv("BBHOSTS")) == NULL) {
+               errprintf("BBHOSTS is not defined");
+               exit(1);
+       }
+
        if (rrddir == NULL) {
                char dname[PATH_MAX];
 
+               if (getenv("BBVAR") == NULL) {
+                       errprintf("BBVAR is not defined");
+                       exit(1);
+               }
+
                sprintf(dname, "%s/rrd", getenv("BBVAR"));
                rrddir = strdup(dname);


If BBHOSTS and BBVAR are defined, it still crashes.
Program received signal SIGSEGV, Segmentation fault.
generate_larrd (rrddirname=0x807e060 "/usr/pkg/hobbit/data/rrd", 
    larrdcolumn=0x8051c47 "trends", larrd043=1, hobbitd=0)
    at bb-larrdcolumn.c:337
337                     while (graph->larrdrrdname) {
(gdb) bt
#0  generate_larrd (rrddirname=0x807e060 "/usr/pkg/hobbit/data/rrd", 
    larrdcolumn=0x8051c47 "trends", larrd043=1, hobbitd=0)
    at bb-larrdcolumn.c:337
#1  0x0804a19b in main (argc=1, argv=0xbfbfed5c) at bb-larrdcolumn.c:442
#2  0x080494c2 in ___start ()

I'll try to dig a bit deeper here, but some hints will be appreciated

-- 
Emmanuel Dreyfus
manu at netbsd.org



More information about the Xymon mailing list