question about config code

Graham Wilson bob at decoy.wox.org
Mon Nov 25 22:41:04 CET 2002


On Mon, Nov 25, 2002 at 04:03:29PM -0500, David Relson wrote:
> At 03:52 PM 11/25/02, Graham Wilson wrote:
> >it would seem to me both from looking at the code and from stepping
> >through it in gdb that the CP_ALGORITHM case is never reached, since
> >algorithm has a NULL in its addr field, which causes
> >process_config_parameter to pass return before even reaching the
> >switch statement:
> >
> >        if ( arg->addr.v == NULL )
> >                return ok;
> 
> It's working fine for me.  I'm sitting right now with gdb stopped by a "b 
> select_method" statement.
> 
> Have you tried the patch I sent you with debugging turned on?  What does it 
> print?

$ bogofilter -x c -vvv
Reading /etc/bogofilter.cf
user_config_file -> '~/.bogofilter/config'
Reading /home/bob/.bogofilter/config
spam_cutoff -> 0.500000
stats_prefix: '	'
Testing:  robx
Testing:  robs
Testing:  thresh_rtable
Testing:  stats_in_header
Testing:  spam_header_name
Testing:  user_config_file
   found.
Testing:  robx
Testing:  robs
Testing:  thresh_rtable
Testing:  stats_in_header
Testing:  spam_header_name
Testing:  user_config_file
Testing:  wordlist
Testing:  algorithm
   found.
Testing:  robx
Testing:  robs
Testing:  thresh_rtable
Testing:  stats_in_header
Testing:  spam_header_name
Testing:  user_config_file
Testing:  wordlist
Testing:  algorithm
Testing:  min_dev
Testing:  spam_cutoff
   found.
X-Bogosity: No, tests=bogofilter, spamicity=0.415000, version=0.9.0.1
     Token                    pgood      pbad        fw  invfwlog     fwlog
  1  P_Q_S_invsum_logsum    0.00000   0.00000  0.000000     0.000     0.000
^D

the process_config_line definitely sees the algorithm line, but,
process_config_parameter still seems to pass it over.

attached is a log of my gdb session. i have breakpoints set at
select_method and process_config_parameter.

> You mention gdb.  Are you perchance using it to step through optimized 
> code?  Since optimized code is reordered, stepping through it is a 
> deceptive nightmare.

i was when i first started debugging, but i figured that maybe gcc
optimized something out of existence so i have been turning it when i am
compiling bogofilter now.

--
gram
-------------- next part --------------
(gdb) r 
Starting program: /usr/bin/bogofilter -x c -vvv

Breakpoint 1, select_method (al=AL_ROBINSON) at config.c:135
135	    bool ok = true;
(gdb) c
Continuing.
Reading /etc/bogofilter.cf
Testing:  robx
Testing:  robs
Testing:  thresh_rtable
Testing:  stats_in_header
Testing:  spam_header_name
Testing:  user_config_file

Breakpoint 2, process_config_parameter (arg=0x806f308, 
    val=0xbffff93c " = ~/.bogofilter/config") at config.c:163
163	    bool ok = true;
(gdb) c
Continuing.
user_config_file -> '~/.bogofilter/config'
    found.
Reading /home/bob/.bogofilter/config
Testing:  robx
Testing:  robs
Testing:  thresh_rtable
Testing:  stats_in_header
Testing:  spam_header_name
Testing:  user_config_file
Testing:  wordlist
Testing:  algorithm

Breakpoint 2, process_config_parameter (arg=0x806f320, 
    val=0xbffff935 " = fisher") at config.c:163
163	    bool ok = true;
(gdb) s
164	    while (isspace(*val) || *val == '=') val += 1;
(gdb) s
165	    if ( arg->addr.v == NULL )
(gdb) info locals
ok = 1 '\001'
(gdb) info args
arg = (const struct {...} *) 0x806f320
val = 0xbffff938 "fisher"
(gdb) s
166		return ok;
(gdb) s
0x0804e1c0	244	}
(gdb) s
process_config_line (line=0xbffff92c "algorithm = fisher", parms=0x806f2f0)
    at config.c:268
268		    if (DEBUG_CONFIG(1) && ok )
(gdb) s
269			printf( "%s\n", "   found.");
(gdb) s
    found.
270		    return ok;
(gdb) s
274	}
(gdb) s
read_config_file (fname=0x807b268 "~/.bogofilter/config", 
    tilde_expand=1 '\001') at config.c:323
323	    }
(gdb) s
307		lineno += 1;
(gdb) s
308		if (fgets(buff, sizeof(buff), fp) == NULL)
(gdb)



More information about the bogofilter-dev mailing list