how to patch amavis to get SCORE with leading zeros? (Did I find a bug?)
Andy Spiegl
amavis.andy at spiegl.de
Thu Jun 20 16:25:20 CEST 2013
> Unfortunately since Debian wheezy (amavisd-new 1:2.7.1-2) I can't
> figure out how to do it anymore. I tried the following:
> 13796c13796
> < { $1 eq 'SCORE' ? (0+sprintf("%.3f",$spam_level))
> ---
> > { $1 eq 'SCORE' ? (0+sprintf("%06.2f",$spam_level))
Oops, I was blind! I forgot to remove the '0+' which undoes the usage
of sprintf. Uhm, why is it there anyway? My first thought was to
avoid an "Use of uninitialized value $spam_level" in case $spam_level
wasn't set yet but that can't be it as sprintf would complain about the
uninitialized value, too.
So, to put it differently, what is the difference between:
{ $1 eq 'SCORE' ? (0+sprintf("%.3f",$spam_level))
and
{ $1 eq 'SCORE' ? ($spam_level)
Anyway, the correct and best(tm) behaviour results with this line:
{ $1 eq 'SCORE' ? (sprintf("%06.2f",$spam_level))
Once again, I'd like to raise a feature request for this patch!
Have a nice day,
Andy.
--
Never say 'OOPS!' Always say 'Ah, Interesting!'
More information about the amavis-users
mailing list