You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by OpenMacNews <op...@gmail.com> on 2006/09/25 04:16:44 UTC

help tracing thru SA code

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

i've resorted to manually step-by-stepping thru SA (trunk, r449343) 
code, tracing the cause of a 100% reproducible perl588 crash on, simply:

	spamd --daemonize

i've, apparently, been unable to grok perl_debugger well enough to keep 
following into various forked subs ...

so, below, starting in 'spamd' i play the "die;" before/after game, and 
ID the errant, crash-causing-statements, by "##>", and begin to burrow 
further.

i've followed the code to a line:

		next;

in:

	/usr/local/perl_libs/sitelib/Mail/SpamAssassin/Conf/Parser.pm

but, have now gone cross-eyed ... and find myself lost in a SA loop.

where do i follow this problem next?

richard



details:

in spamd:

	760:	## DAEMONIZE! ##
	761:	
	762:	$opt{'daemonize'} and daemonize();
	763:	
	764:	# should be done post-daemonize such that any files created by 
this
	765:	# process are written with the right ownership and everything.
##>	766:	preload_modules_with_tmp_homedir();


then:

	2152:	
	2153:	sub preload_modules_with_tmp_homedir {
	2154:	
	...
	2173:	  mkdir( $tmphome,  0700 ) or die "spamd: cannot create 
$tmphome: $!";
	2174:	  mkdir( $tmpsadir, 0700 ) or die "spamd: cannot create 
$tmpsadir: $!";
	2175:	  $ENV{HOME} = $tmphome;
	2176:	
##>	2177:	  $spamtest->compile_now(0,1);  # ensure all modules etc. are 
loaded
	2178:	  $/ = "\n";                    # argh, Razor resets this!  Bad 
Razor!
	2179:	
	2180:	  # now clean up the stuff we just created, and make us 
taint-safe
	...

now, if I poke around in SpamAssassin source tree, I find in:

	./lib/Mail/SpamAssassin.pm

@ lineno: 1151

	=item $f->compile_now ($use_user_prefs, $keep_userstate)
	
	Compile all patterns, load all configuration files, and load all
	possibly-required Perl modules.
	...
	sub compile_now {
	  my ($self, $use_user_prefs, $deal_with_userstate) = @_;
	...

which, in the install, is, of course, found in:

	/usr/local/perl_libs/sitelib/Mail/SpamAssassin.pm

continuing to trace therein @:

	1174:	sub compile_now {
	1175:	  my ($self, $use_user_prefs, $deal_with_userstate) = @_;
	1176:	
	1177:	  # tell plugins we are here
	1178:	  $self->call_plugins("compile_now_start",
	1179:				  { use_user_prefs => $use_user_prefs,
	1180:				keep_userstate => $deal_with_userstate});
	...
	1198:	  }
	1199:	
##>	1200:	  $self->init($use_user_prefs);
	1201:	
	1202:	  # if init() didn't change the value from default, forget about 
it.


continuing:

	1348:	# non-public methods.
	1349:	
	1350:	sub init {
	1351:	  my ($self, $use_user_pref) = @_;
	1352:	
	1353:	  # Allow init() to be called multiple times, but only run once.
	...
	
	1436:	  # Go and parse the config!
	1437:	  $self->{conf}->{main} = $self;
##>	1438:	  $self->{conf}->parse_rules ($self->{config_text});
	1439:	  $self->{conf}->finish_parsing ();
	1440:	  delete $self->{conf}->{main};	# to allow future GC'ing

following into:

	/usr/local/perl_libs/sitelib/Mail/SpamAssassin/Conf.pm


	2668:	sub parse_rules {
	2669:	  my ($self) = @_;
##>	2670:	  $_[0]->{parser}->parse ($_[1], 0);
	2671:	}

moving next into:

	/usr/local/perl_libs/sitelib/Mail/SpamAssassin/Conf/Parser.pm


	202:	sub parse {
	203:	  my ($self, undef, $scoresonly) = @_; # leave $rules in $_[1]
	
	398:		goto failed_line;
	399:	  }
	400:	  else {
##>	401:		next;
	402:	  }
	403:	}
	404:
	405:	# last ditch: try to see if the plugins know what to do with it

so, where next @ 'next'?

- -- 

/"\
\ /  ASCII Ribbon Campaign
 X   against HTML email, vCards
/ \  & micro$oft attachments

[GPG] OpenMacNews at gmail dot com
fingerprint: 50C9 1C46 2F8F DE42 2EDB  D460 95F7 DDBD 3671 08C6
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iEYEARECAAYFAkUXPA0ACgkQlffdvTZxCMbSpACcD3QNIMEna3IwH4aoU0cBngOY
lG8An1O7TKMefoR73x3rWf+78H31pqmN
=k6vV
-----END PGP SIGNATURE-----