nasty bug in SA.pm (I think)
Jeff A. Earickson
jaearick at colby.edu
Sat Aug 12 01:59:56 IST 2006
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!
More information about the MailScanner
mailing list