nasty bug in SA.pm (I think)
Julian Field
mailscanner at ecs.soton.ac.uk
Sat Aug 12 15:03:58 IST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
If there had been mis-matching brackets, then
perl -c SA.pm
would have failed. Remember that Perl compiles all the code before it
starts running it, it isn't an interpreted scripting language, it's a
compiled one. So the syntax basically has to be right before it will
start executing anything (apart from things like eval "" code and stuff
like that).
Jeff A. Earickson wrote:
> I came to this realization after a good dinner tonight. Sigh.
>
> Jeff Earickson
>
> On Fri, 11 Aug 2006, Logan Shaw wrote:
>
>> Date: Fri, 11 Aug 2006 17:26:57 -0500 (CDT)
>> From: Logan Shaw <lshaw at emitinc.com>
>> Reply-To: MailScanner discussion <mailscanner at lists.mailscanner.info>
>> To: MailScanner discussion <mailscanner at lists.mailscanner.info>
>> Subject: Re: nasty bug in SA.pm (I think)
>>
>> On Fri, 11 Aug 2006, Jeff A. Earickson wrote:
>>> So I stared at SA.pm. You commented out line 287:
>>>
>>> #if (MailScanner::Config::Value('compilespamassassinonce')) {
>>>
>>> at some point, which commented out half of a curly-bracket block.
>>> I can't find where the right curly-bracket for this line is, and I
>>> think something is mis-aligned here.
>>>
>>> Using the power feature of vi whereby you put the cursor over a
>>> bracket, paren, etc and then hit "%", I don't find the closing curly
>>> bracket for line 72 ("sub initialise {"). This routine seems
>>> mangled and I think this is the root cause of the loop-up bug.
>>
>> Beware of using "%" in vi on Perl code. vi's "%" feature was
>> written for C, and as you may have noticed, Perl's syntax is
>> not exactly the same as C's. :-) (It is similar enough to make
>> "%" work most of the time, though.)
>>
>> In particular, vi really doesn't understand braces that are
>> commented out with Perl comments:
>>
>> while (1)
>> {
>> bar1();
>>
>> # this brace will confuse vi ---> }
>>
>> bar2();
>> }
>>
>> Try putting your cursor on the "{" right after the "while" and
>> hitting "%". You'll see it matching against the wrong brace.
>>
>> In fact, I think that's what is happening with SA.pm. An easy
>> way to test it is to just delete the comment line with the brace
>> that's confusing vi. We are probably at different MailScanner
>> versions since the corresponding line on mine is at 285, but
>> if you delete the line with 'compilespamassassinonce' on it,
>> then try to match braces with "%", everything looks good.
>>
>> - Logan
>> --
>> MailScanner mailing list
>> mailscanner at lists.mailscanner.info
>> http://lists.mailscanner.info/mailman/listinfo/mailscanner
>>
>> Before posting, read http://wiki.mailscanner.info/posting
>>
>> Support MailScanner development - buy the book off the website!
- --
Julian Field
www.MailScanner.info
Buy the MailScanner book at www.MailScanner.info/store
MailScanner customisation, or any advanced system administration help?
Contact me at Jules at MailScanner.biz
PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
Get your PCs and servers from Transtec.de, very well built and reliable!
-----BEGIN PGP SIGNATURE-----
Version: PGP SDK 3.7.0
Charset: ISO-8859-1
wj8DBQFE3d/QEfZZRxQVtlQRApuXAJ9QcjEohJ3d3t0qDcbbQA+mZjAy0gCePcxd
Vy3ILt5jNc9BfLMFwtLXvjY=
=QAPx
-----END PGP SIGNATURE-----
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
For all your IT requirements visit www.transtec.co.uk
More information about the MailScanner
mailing list