🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
25 messages
25 total messages Started by Steve Mon, 21 Jul 2008 11:25
Cleanfeed Binary Checks
#79231
Author: Steve
Date: Mon, 21 Jul 2008 11:25
35 lines
2345 bytes
Hi all,

I've puzzled by some results I'm seeing from Cleanfeed filters relating
to binary checking.

I noticed some time ago that I was catching a lot of binary files in
emp.md5 filters.  This was odd as the articles in question should have
been caught by the misplaced binary filters.  To help narrow it down I
added this little check to my cleanfeed.local:-

sub local_filter_reject {
if (is_binary()) {
  saveart('emp.md5.bin', $vr, 2) if $vr =~ /^EMP\s\(md5/;
} else {
  saveart('emp.md5', $vr) if $vr =~ /^EMP\s\(md5/;
};

The result is that virtually no binary files end up in the emp.md5.bin
file whilst lots are caught in the emp.md5 file.  The conclusion I draw
from this is that the is_binary function isn't tagging all the articles
it should, despite the regex's in it being absolutely correct, (and
manually tested against articles).

This issue also has a knock-on effect that if fuzzy body checking is
enabled, it fuzzies the binary articles that slip through the is_binary
function.  This results in the EMP hash being based on nothing but the
filename of the encoded binary, (all that's left after fuzzying).

I was wondering if anyone else has experienced this issue, or perhaps
might not have noticed it's happening.

-- 
pub   1024D/228761E7 2003-06-04 Steven Crook
      Key fingerprint = 1CD9 95E1 E9CE 80D6 C885  B7EB B471 80D5 2287 61E7
uid                  Steven Crook <steve@mixmin.net>
Re: Cleanfeed Binary Checks
#79232
Author: Bert Hyman
Date: Mon, 21 Jul 2008 13:19
31 lines
2270 bytes
steve@mixmin.net (Steve) wrote in news:g61rme$nqb$1@news.mixmin.net:

> Hi all,
> 
> I've puzzled by some results I'm seeing from Cleanfeed filters
> relating to binary checking.
> 
> I noticed some time ago that I was catching a lot of binary files in
> emp.md5 filters.  This was odd as the articles in question should
> have been caught by the misplaced binary filters.  To help narrow it
> down I added this little check to my cleanfeed.local:-
> 
> sub local_filter_reject {
> if (is_binary()) {
>   saveart('emp.md5.bin', $vr, 2) if $vr =~ /^EMP\s\(md5/;
> } else {
>   saveart('emp.md5', $vr) if $vr =~ /^EMP\s\(md5/;
> };
> 
> The result is that virtually no binary files end up in the
> emp.md5.bin file whilst lots are caught in the emp.md5 file.  The
> conclusion I draw from this is that the is_binary function isn't
> tagging all the articles it should, despite the regex's in it being
> absolutely correct, (and manually tested against articles).

I haven't looked at the Cleanfeed code recently, but could this be due
to the order in which the tests are performed? Maybe the articles are
caught by the EMP test before they get to the binary test. 

-- 
Bert Hyman | St. Paul, MN | bert@iphouse.com
Re: Cleanfeed Binary Checks
#79233
Author: Steve
Date: Mon, 21 Jul 2008 14:28
51 lines
3399 bytes
On 21 Jul 2008 13:19:44 GMT, Bert Hyman wrote in
Message-Id: <Xns9AE254B58B161VeebleFetzer@127.0.0.1>:

> I haven't looked at the Cleanfeed code recently, but could this be due
> to the order in which the tests are performed? Maybe the articles are
> caught by the EMP test before they get to the binary test. 

Hi Bert,

Cleanfeed tests are performed in the following sequence.
(Some of these tests are only included in the modified version I produced
earlier this year.  I've regressed back to the formal version to ensure
none of these changes has caused the is_binary issue.)
* Bad Groups - Distribution includes a group listed in bad_groups
* Bad Host - Posting host is listed in bad_hosts
* Bad Path - Path contains a server listed in bad_path
* Simple Message-ID - Bots and bad cancel signatures
* Malformed Articles - Missing From, Subject, Message-ID
* local_filter_first - User-defined filters in cleanfeed.local
* Reposts - Reposting of cancelled articles
* Bad Adult Path - Adult group and bad_path matches
* Excessive Crossposting - Lots of ECP and hierarchy violation checks
* UUencoded Text - UUencoded txt/html/exe/url files
* Misplaced Binaries - Binary file encoding to non-binary group
* HTML - Attached and inline HTML filters
* Bot Checks - Lots of Bot signature checks
* EMP MD5 - EMP body checksum
* EMP PHL - EMP Posting-Host / Lines checksum
* EMP PHN - EMP Posting-Host / Newsgroup checksum
* EMP FSL - EMP From / Subject / Lines checksum
* EMP PHR - EMP Posting-Host / specific group checksum
* Supersedes - Various Supersedes filters
* local_filter_after_emp - User-defined filters in cleanfeed.local
* Scoring Filters - Lots of article scoring filters
* local_filter_last - User-defined filters in cleanfeed.local
* Cancel Filters - Catch bad cancels
* local_filter_cancel - User-defined filters in cleanfeed.local
* Bad New/Remove Groups - Bad create / delete group messages
* Bad Controls - Other bad control messages

The is_binary function is called from three of these filters:-
* Misplaced Binaries
* EMP MD5 (If fuzzy_md5 is enabled)
* EMP PHL
The result from the first call of is_binary is cached and so the regex
is only checked once per article.

-- 
pub   1024D/228761E7 2003-06-04 Steven Crook
      Key fingerprint = 1CD9 95E1 E9CE 80D6 C885  B7EB B471 80D5 2287 61E7
uid                  Steven Crook <steve@mixmin.net>
Re: Cleanfeed Binary Checks
#79235
Author: Julien ÉLIE
Date: Mon, 21 Jul 2008 16:38
33 lines
2460 bytes
Hi Steve,

> The conclusion I draw
> from this is that the is_binary function isn't tagging all the articles
> it should, despite the regex's in it being absolutely correct, (and
> manually tested against articles).

Yep, it was also what I noticed.
When I received tons of binaries in pt.binarios and it.binari.x.erotismo.*
two years ago, I wondered what was going on.
I ended up rejecting articles posted to these groups with more than 500 lines.

Note that if you manually feed such articles to cleanfeed, it correctly
marks them as binaries.
If you want to test that, you can use Frédéric's tester:

    http://news.lacave.net/inn/cf_tester.pl


As you also noticed, if you write to the disk the contents of such
articles as they are seen by Cleanfeed (with saveart()), they look good.

I do not know what is happening...

A Perl bug?  An innd bug?  Another thing?

-- 
Julien ÉLIE

« -- Ils s'arrêtaient tous les jours à 5 heures,
  pour boire de l'eau chaude...
  -- Je prendrai un nuage de lait, je vous prie. » (Astérix)
Re: Cleanfeed Binary Checks
#79236
Author: Steve
Date: Tue, 22 Jul 2008 09:02
39 lines
2759 bytes
On Mon, 21 Jul 2008 18:38:00 +0200, Julien ÉLIE wrote in
Message-Id: <g62e1h$ejc$1@news.trigofacile.com>:

> Yep, it was also what I noticed.
> When I received tons of binaries in pt.binarios and it.binari.x.erotismo.*
> two years ago, I wondered what was going on.
> I ended up rejecting articles posted to these groups with more than 500 lines.

Hi Julien,
It's a relief that I'm not the only one who has experienced this.  It's
one of those bugs I can stare at for days and then have somebody point
out the most obvious of mistakes.  :)

> Note that if you manually feed such articles to cleanfeed, it correctly
> marks them as binaries.
Yes, I've found the same thing.  I've also reconstructed the regexs's in
separate code and validated them against binary articles.

> If you want to test that, you can use Frédéric's tester:
>     http://news.lacave.net/inn/cf_tester.pl
This will be very useful, thanks.

> As you also noticed, if you write to the disk the contents of such
> articles as they are seen by Cleanfeed (with saveart()), they look good.
Just this week I added a flag to report through saveart if articles
were being fuzzied during the md5 filter. This is what confirmed that
binary articles were being fuzzied and subsequently rejected on nothing
more than the filename.

> I do not know what is happening...
Me neither but I think it's safe to say it's not an error in Cleanfeed
itself. Another thing I'll do some testing on; I think the filter
works correctly for a short period straight after an inn restart but not
after a filter reload.

-- 
pub   1024D/228761E7 2003-06-04 Steven Crook
      Key fingerprint = 1CD9 95E1 E9CE 80D6 C885  B7EB B471 80D5 2287 61E7
uid                  Steven Crook <steve@mixmin.net>
Re: Cleanfeed Binary Checks
#79239
Author: Marco d'Itri
Date: Wed, 30 Jul 2008 23:29
17 lines
1425 bytes
iulius@nom-de-mon-site.com.invalid wrote:

>As you also noticed, if you write to the disk the contents of such
>articles as they are seen by Cleanfeed (with saveart()), they look good.
>
>I do not know what is happening...
>
>A Perl bug?  An innd bug?  Another thing?
It's a well known INN bug, which has been around for more than 5 years
now.
The $hdr{__BODY__} scalar, which is magic, is not created correctly by
innd and regexps matching new lines fail.
An XS expert is needed.

-- 
ciao, |
Marco | * The Internet is full. Go away.  -- Joel Furr *
Re: Cleanfeed Binary Checks
#79241
Author: Julien ÉLIE
Date: Thu, 31 Jul 2008 06:15
77 lines
4019 bytes
Hi Marco,

> It's a well known INN bug, which has been around for more than 5 years
> now.
> The $hdr{__BODY__} scalar, which is magic, is not created correctly by
> innd and regexps matching new lines fail.


Seeing innd/perl.c:

    http://inn.eyrie.org/viewcvs/trunk/innd/perl.c?view=markup


    /* Create %hdr and stash a copy of every known header.  Path has to be
       handled separately since it's been munged by article processing. */
    hdr = perl_get_hv("hdr", 1);
    for (i = 0 ; i < MAX_ARTHEADER ; i++) {
        if (HDR_FOUND(i)) {
            hp = &ARTheaders[i];
            hv_store(hdr, (char *) hp->Name, hp->Size, newSVpv(HDR(i), 0), 0);
        }
    }

    /* Store the article body.  We don't want to make another copy of it,
       since it could potentially be quite large.  Instead, stash the
       pointer in the static SV * body.  We set LEN to 0 and inc the
       refcount to tell Perl not to free it (either one should be enough).
       Requires 5.004.  In testing, this produced a 17% speed improvement
       over making a copy of the article body for a fairly heavy filter. */
    if (artBody) {
        if (!body) {
            body = newSV(0);
            (void) SvUPGRADE(body, SVt_PV);
        }
        SvPVX(body) = artBody;
        SvCUR_set(body, artLen);
        SvLEN_set(body, 0);
        SvPOK_on(body);
        (void) SvREADONLY_on(body);
        (void) SvREFCNT_inc(body);
        hv_store(hdr, "__BODY__", 8, body, 0);
    }

    hv_store(hdr, "__LINES__", 9, newSViv(lines), 0);

    ENTER;
    SAVETMPS;
    PUSHMARK(SP);
    rc = perl_call_sv((SV *) filter, G_EVAL|G_SCALAR|G_NOARGS);
    SPAGAIN;

    hv_undef(hdr);




I do not understand well
    SvPVX(body) = artBody;
because normally, SvPVX returns a pointer to the physical string in the SV:
    char* SvPVX(SV* sv)
whereas it looks as though it was set here.

As for hv_store, "the return value will be NULL if the operation failed or
if the value did not need to be actually stored within the hash (as in the case
of tied hashes).  Otherwise it can be dereferenced to get the original SV*.
Note that the caller is responsible for suitably incrementing the reference
count of val before the call, and decrementing it if the function returned NULL."
Decrementing is not taken into account here.


Source : http://perldoc.perl.org/perlapi.html

-- 
Julien ÉLIE

« Ambo florentes aetatibus, Arcades ambo » (Virgile, _Églogue VII_)
Re: Cleanfeed Binary Checks
#79240
Author: Matija Nalis
Date: Fri, 01 Aug 2008 02:23
48 lines
3061 bytes
On 31 Jul 2008 01:29:26 +0200, Marco d'Itri <md@Linux.IT> wrote:
> iulius@nom-de-mon-site.com.invalid wrote:
>>As you also noticed, if you write to the disk the contents of such
>>articles as they are seen by Cleanfeed (with saveart()), they look good.
>>
>>I do not know what is happening...
>>
>>A Perl bug?  An innd bug?  Another thing?
> It's a well known INN bug, which has been around for more than 5 years
> now.

INN probabaly really needs some bug tracking system; this "well known bug"
was not known by me at all, even after some moderate amount of time wasted
searching around. :(

> The $hdr{__BODY__} scalar, which is magic, is not created correctly by
> innd and regexps matching new lines fail.
> An XS expert is needed.


I'm not XS expert by any measure, but I was stumbling upon similar problem
for some time now (but never found enough time to track it down and make
nice bug report and/or fix). The problem manifested itself by is_binary()
returning wrong results sometimes, while saveart() articles looked good and
checked manually.

One of the things I did while trying to track it down and which *seems* to
have worked around the problem (but I have not done any good checking) was
to replace all:

if ($hdr{__BODY__} =~ /whatever/)

regexp-matching constructs in cleanfeed with:

my $BODY=$hdr{__BODY__}; if ($BODY =~ /whatever/)

which SEEMS to have fixed the problem for me (but note warning above --
could someone with spare time try to reproduce it and see if this helps ?)

If that is really the case (so that making the copy of the variable is
fixing the problem), then the problem might be (just wild guessing) that
optimisation in inn quite some time ago which was something to effect: "make
$hdr{__BODY__} read-only to gain some speed by avoiding making a copy in
memory"


-- 
Opinions above are GNU-copylefted.
Re: Cleanfeed Binary Checks
#79242
Author: Russ Allbery
Date: Fri, 01 Aug 2008 03:20
29 lines
2483 bytes
Matija Nalis <mnalis-news@voyager.hr> writes:

> INN probabaly really needs some bug tracking system; this "well known
> bug" was not known by me at all, even after some moderate amount of time
> wasted searching around. :(

Yup, will be working on it.

> I'm not XS expert by any measure, but I was stumbling upon similar
> problem for some time now (but never found enough time to track it down
> and make nice bug report and/or fix). The problem manifested itself by
> is_binary() returning wrong results sometimes, while saveart() articles
> looked good and checked manually.

Well, one obvious thing that could be done is to replace the current code
for initializing the __BODY__ key with the standard, normal way of making
a copy of the article body and storing that in the Perl variable.  It will
be slower and take more memory, but it may work more reliably.

It's probably also worth investigating whether Perl has since acquired
some function to make an SV of a read-only chunk of external memory of a
known length and, if so, replace the innd code with something that calls
that rather than cobbling up its own version.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Cleanfeed Binary Checks
#79243
Author: Julien ÉLIE
Date: Fri, 01 Aug 2008 06:22
41 lines
3095 bytes
Hi Russ,

> Well, one obvious thing that could be done is to replace the current code
> for initializing the __BODY__ key with the standard, normal way of making
> a copy of the article body and storing that in the Perl variable.  It will
> be slower and take more memory, but it may work more reliably.

However, as such an initialization of __BODY__ works most of the time, I do not
understand why it is sometimes broken.
On particular conditions perhaps?  Or a bug somewhere else.


> It's probably also worth investigating whether Perl has since acquired
> some function to make an SV of a read-only chunk of external memory of a
> known length and, if so, replace the innd code with something that calls
> that rather than cobbling up its own version.

Maybe this one?  (Is the "string table" including the body?)

newSVpvn_share

Creates a new SV with its SvPVX_const pointing to a shared string in the string table.
If the string does not already exist in the table, it is created first.
Turns on READONLY and FAKE.  If the hash parameter is non-zero, that value is used;
otherwise the hash is computed.  The string's hash can be later be retrieved from
the SV with the SvSHARED_HASH() macro.  The idea here is that as the string table
is used for shared hash keys these strings will have SvPVX_const == HeKEY and hash
lookup will avoid string compare.

    SV* newSVpvn_share(const char* s, I32 len, U32 hash)


New in Perl 5.7.1.

-- 
Julien ÉLIE

« -- Heureusement, nous aurons bientôt le TGV !
  -- C'est quoi le tégévé ?
  -- C'est le Transport Gaulois Véloce » (Astérix)
Re: Cleanfeed Binary Checks
#79244
Author: Marco d'Itri
Date: Fri, 01 Aug 2008 09:26
19 lines
1660 bytes
mnalis-news@voyager.hr wrote:

>One of the things I did while trying to track it down and which *seems* to
>have worked around the problem (but I have not done any good checking) was
>to replace all:
>
>if ($hdr{__BODY__} =~ /whatever/)
Obviously this works, since it converts the magic scalar to a plain one.

>If that is really the case (so that making the copy of the variable is
>fixing the problem), then the problem might be (just wild guessing) that
>optimisation in inn quite some time ago which was something to effect: "make
>$hdr{__BODY__} read-only to gain some speed by avoiding making a copy in
>memory"
No, it used to work.

-- 
ciao, |
Marco | * The Internet is full. Go away.  -- Joel Furr *
Re: Cleanfeed Binary Checks
#79245
Author: Russ Allbery
Date: Fri, 01 Aug 2008 20:55
29 lines
2455 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:

> Maybe this one?  (Is the "string table" including the body?)
>
> newSVpvn_share
>
> Creates a new SV with its SvPVX_const pointing to a shared string in the
> string table.  If the string does not already exist in the table, it is
> created first.  Turns on READONLY and FAKE.  If the hash parameter is
> non-zero, that value is used; otherwise the hash is computed.  The
> string's hash can be later be retrieved from the SV with the
> SvSHARED_HASH() macro.  The idea here is that as the string table is
> used for shared hash keys these strings will have SvPVX_const == HeKEY
> and hash lookup will avoid string compare.
>
>    SV* newSVpvn_share(const char* s, I32 len, U32 hash)
>
> New in Perl 5.7.1.

Yup, that looks like exactly what you want.  You probably want to pass in
some nonsense for the hash rather than having it compute a hash of the
body of the message, since we won't use the hash for innd's use case (I
think).

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Cleanfeed Binary Checks
#79248
Author: Julien ÉLIE
Date: Sat, 02 Aug 2008 10:25
83 lines
4157 bytes
Hi Russ,

[Steve and Matija, could you please test Cleanfeed with the following change?]

>>    SV* newSVpvn_share(const char* s, I32 len, U32 hash)
>>
>> New in Perl 5.7.1.
>
> Yup, that looks like exactly what you want.  You probably want to pass in
> some nonsense for the hash rather than having it compute a hash of the
> body of the message, since we won't use the hash for innd's use case (I
> think).


All right.  Here is a suggestion for innd/perl.c:


#if (PERL_REVISION == 5) && ((PERL_VERSION < 7) || ((PERL_VERSION == 7) && (PERL_SUBVERSION < 1)))
    static SV *body = NULL;
    if (artBody) {
        if (!body) {
            body = newSV(0);
            (void) SvUPGRADE(body, SVt_PV);
        }
        SvPVX(body) = artBody;
        SvCUR_set(body, artLen);
        SvLEN_set(body, 0);
        SvPOK_on(body);
        (void) SvREADONLY_on(body);
        (void) SvREFCNT_inc(body);
        hv_store(hdr, "__BODY__", 8, body, 0);
    }
#else
    if (artBody) {
        /* For Perl not to compute a hash for artBody, we give it "42". */
        hv_store(hdr, "__BODY__", 8, newSVpvn_share(artBody, artLen, 42), 0);
    }
#endif /* Perl <= 5.7.1 */


I do not think we need all the other functions (SVt_PV which specifies body is
a scalar and SvPOK_on that it is a string).  READONLY (and FAKE) are implicit.


I have also added PERL_REVISION (5) to include/ppport.h for compatibility with
older Perl versions, if not set.  Otherwise, it will cause problems with Perl 6:

--- include/ppport.h    (révision 7932)
+++ include/ppport.h    (copie de travail)
@@ -150,6 +150,7 @@
 #      endif
 #endif
 #ifndef PERL_VERSION
+#       define PERL_REVISION (5)
 #       ifdef PERL_PATCHLEVEL
 #               define PERL_VERSION    PERL_PATCHLEVEL
 #       else
@@ -162,7 +163,7 @@
 #      define ERRSV perl_get_sv("@",false)
 #endif

-#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 4))
+#if (PERL_REVISION == 5) && ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 4)))
 #      define PL_sv_undef      sv_undef
 #      define PL_sv_yes        sv_yes
 #      define PL_sv_no         sv_no
@@ -174,7 +175,7 @@
 #      define PL_copline       copline
 #endif

-#if (PERL_VERSION < 5)
+#if (PERL_REVISION == 5) && (PERL_VERSION < 5)
 #      undef dTHR
 #      ifdef WIN32
 #              define dTHR extern int Perl___notused


-- 
Julien ÉLIE

« Balnea, uina, Venus corrumpunt corpora nostra,
  Sed uitam faciunt balnea, uina, Venus. » 
Re: Cleanfeed Binary Checks
#79249
Author: Steve
Date: Sat, 02 Aug 2008 11:54
14 lines
1705 bytes
On Sat, 2 Aug 2008 12:25:42 +0200, Julien ÉLIE wrote in
Message-Id: <g71cn9$jfb$1@news.trigofacile.com>:

> [Steve and Matija, could you please test Cleanfeed with the following change?]

Julien,

Thanks for the patch.  I've applied it and will leave it running for a
few hours and report back on how it's performing.

-- 
pub   1024D/228761E7 2003-06-04 Steven Crook
      Key fingerprint = 1CD9 95E1 E9CE 80D6 C885  B7EB B471 80D5 2287 61E7
uid                  Steven Crook <steve@mixmin.net>
Re: Cleanfeed Binary Checks
#79253
Author: Russ Allbery
Date: Sun, 03 Aug 2008 19:54
18 lines
1960 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:

>    if (artBody) {
>        /* For Perl not to compute a hash for artBody, we give it "42". */
>        hv_store(hdr, "__BODY__", 8, newSVpvn_share(artBody, artLen, 42), 0);
>    }

> I do not think we need all the other functions (SVt_PV which specifies
> body is a scalar and SvPOK_on that it is a string).  READONLY (and FAKE)
> are implicit.

Yup, that looks right to me.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Cleanfeed Binary Checks
#79254
Author: Julien ÉLIE
Date: Sun, 03 Aug 2008 21:41
32 lines
2813 bytes
Hi Marco,

>>If that is really the case (so that making the copy of the variable is
>>fixing the problem), then the problem might be (just wild guessing) that
>>optimisation in inn quite some time ago which was something to effect: "make
>>$hdr{__BODY__} read-only to gain some speed by avoiding making a copy in
>>memory"
>
> No, it used to work.

It used to work but I do not see any changes in that part of the code
after the moment when it was first implemented.
Maybe that code still works on Perl 5.004_03 but does not after
an upgrade to a newer version of Perl (?)

Maybe the best thing to do right now, in case Steve reports that the share SV
works well, is to use it for Perl >= 5.7.1 and to use the *reliable* but slow
SV copy for older versions (as Russ also seems to suggest in another article).


It would also be interesting to know whether the share SV is as fast as the
current (not reliable) implementation.
An idea can be given by the innd timer "perl filter" (gathered in Usenet
daily reports, if status is enabled in inn.conf).  However, values differ
a lot between days (16s to 25s for my server) so it is not reliable.
Profiling should perhaps be done with a set of small and long articles.

-- 
Julien ÉLIE

« L'ordinateur obéit à vos ordres, pas à vos intentions. » 
Re: Cleanfeed Binary Checks
#79255
Author: Steve
Date: Mon, 04 Aug 2008 09:16
27 lines
2401 bytes
On Sun, 3 Aug 2008 23:41:54 +0200, Julien ÉLIE wrote in
Message-Id: <g758n6$3gh$1@news.trigofacile.com>:

> Maybe the best thing to do right now, in case Steve reports that the share SV
> works well, is to use it for Perl >= 5.7.1 and to use the *reliable* but slow
> SV copy for older versions (as Russ also seems to suggest in another article).

Hi Julien,
I can report that it seems to be working very well.  Since applying your
patch, I've seen none of the mis-reported binaries that I was
previously.

> It would also be interesting to know whether the share SV is as fast
> as the current (not reliable) implementation.  An idea can be given by
> the innd timer "perl filter" (gathered in Usenet daily reports, if
> status is enabled in inn.conf).  However, values differ a lot between
> days (16s to 25s for my server) so it is not reliable.  Profiling
> should perhaps be done with a set of small and long articles.

I've just enabled 'status' and 'timing' in inn.conf, both with settings
of 1800.  Not sure if this is a sensible value, there is no
recommendations for them in the inn.conf man page.

-- 
pub   1024D/228761E7 2003-06-04 Steven Crook
      Key fingerprint = 1CD9 95E1 E9CE 80D6 C885  B7EB B471 80D5 2287 61E7
uid                  Steven Crook <steve@mixmin.net>
Re: Cleanfeed Binary Checks
#79259
Author: Julien ÉLIE
Date: Mon, 04 Aug 2008 17:53
44 lines
3433 bytes
Hi Steve,

>> Maybe the best thing to do right now, in case Steve reports that the share SV
>> works well, is to use it for Perl >= 5.7.1 and to use the *reliable* but slow
>> SV copy for older versions (as Russ also seems to suggest in another article).
>
> I can report that it seems to be working very well.  Since applying your
> patch, I've seen none of the mis-reported binaries that I was
> previously.

That is very great news!
Thanks for the report.  I assume Cleanfeed would have already been missing
some binaries, hadn't this patch fixed the issue.

By the way, maybe Cleanfeed will now reject more spam (not only binaries)
as other articles might have slipped into its regexps.



>> It would also be interesting to know whether the share SV is as fast
>> as the current (not reliable) implementation.  An idea can be given by
>> the innd timer "perl filter" (gathered in Usenet daily reports, if
>> status is enabled in inn.conf).  However, values differ a lot between
>> days (16s to 25s for my server) so it is not reliable.  Profiling
>> should perhaps be done with a set of small and long articles.
>
> I've just enabled 'status' and 'timing' in inn.conf, both with settings
> of 1800.  Not sure if this is a sensible value, there is no
> recommendations for them in the inn.conf man page.

It does not matter.  Once the timing is enabled, internal counters are set
and only reported every n seconds in news.notice; innreport will gather
these values the next time it runs.

However, I doubt they will be useful here since you did not have them
for the previous SV manipulation.  Therefore, you cannot compare them.

-- 
Julien ÉLIE

« Les légionnaires ont adopté pour attaquer la redoutable tactique
  dite de la tortue. Pour battre en retraite, les légionnaires
  adoptent l'efficace tactique dite du lièvre. » (Astérix) 
Re: Cleanfeed Binary Checks
#79262
Author: Steve
Date: Tue, 05 Aug 2008 09:05
39 lines
2793 bytes
On Mon, 4 Aug 2008 19:53:04 +0200, Julien ÉLIE wrote in
Message-Id: <g77fm4$74p$1@news.trigofacile.com>:

> That is very great news!
> Thanks for the report.  I assume Cleanfeed would have already been missing
> some binaries, hadn't this patch fixed the issue.

Yes, I think after this period of time there would be clear evidence if
it was still missing articles.

> By the way, maybe Cleanfeed will now reject more spam (not only binaries)
> as other articles might have slipped into its regexps.

That seems to be the case.  I have some quick and dirty filters for
catching various url's and they are certainly matching more articles
with the patch applied.

There is also the benefit that EMP MD5 fuzzying is not being applied to
binary articles.  This will speed up the filter and should prevent false
positives.

> It does not matter.  Once the timing is enabled, internal counters are set
> and only reported every n seconds in news.notice; innreport will gather
> these values the next time it runs.
>
> However, I doubt they will be useful here since you did not have them
> for the previous SV manipulation.  Therefore, you cannot compare them.

It would be nice to have this comparison but I'm reluctant to back out
your patch whilst it's doing such a good job.  At the moment the perl
timings are:

Code region	Time		Pct	Invoked	Min(ms)	Avg(ms)	Max(ms)
perl filter	00:05:05.167	0.5%	158732	1.454	1.923	2.617

-- 
pub   1024D/228761E7 2003-06-04 Steven Crook
      Key fingerprint = 1CD9 95E1 E9CE 80D6 C885  B7EB B471 80D5 2287 61E7
uid                  Steven Crook <steve@mixmin.net>
Re: Cleanfeed Binary Checks
#79261
Author: Julien ÉLIE
Date: Tue, 05 Aug 2008 18:24
42 lines
2944 bytes
Hi Steve,

>> By the way, maybe Cleanfeed will now reject more spam (not only binaries)
>> as other articles might have slipped into its regexps.
>
> That seems to be the case.  I have some quick and dirty filters for
> catching various url's and they are certainly matching more articles
> with the patch applied.

Good news.



> It would be nice to have this comparison but I'm reluctant to back out
> your patch whilst it's doing such a good job.

:)



> At the moment the perl timings are:
>
> Code region          Time      Pct    Invoked   Min(ms)    Avg(ms)    Max(ms)
> perl filter    00:05:05.167   0.5%     158732     1.454      1.923      2.617

Your box is faster than mine.  *grin*

perl filter      00:00:23.121   0.0%       4767     2.000      4.850     25.667


You see that I receive very few articles (only French hierarchies and some news.*).
My average time and my global time are like the ones without the patch.

I think it is OK to validate the patch because on mine, I do not see any changes
and on your full feed, the average time is very good:  2 ms per message (with 2.6 ms
for the maximum), that's very good.

-- 
Julien ÉLIE

« A man who is not married is incomplete; a man who is married is finished. »
Re: Cleanfeed Binary Checks
#79265
Author: Wolfgang Schelongowski
Date: Wed, 06 Aug 2008 19:32
17 lines
1787 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:

>#if (PERL_REVISION == 5) && ((PERL_VERSION < 7) || ((PERL_VERSION == 7) && (PERL_SUBVERSION < 1)))
...
>#else
...
>#endif /* Perl <= 5.7.1 */

ITYM    /* Perl <  5.7.1 */


Besides, there's the silent and hopefully true assumption that the
#else-part will never be interpreted by a PERL_REVISION < 5.
-- 
The first entry of Sin into the mind occurs when, out of cowardice or
conformity or vanity, the Real is replaced by a comforting lie.
  -- Integritas, Consonantia, Claritas
Re: Cleanfeed Binary Checks
#79264
Author: Russ Allbery
Date: Thu, 07 Aug 2008 03:38
23 lines
2066 bytes
Wolfgang.Schelongowski@gmx.de (Wolfgang Schelongowski) writes:
> Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:

>> #if (PERL_REVISION == 5) && ((PERL_VERSION < 7) || ((PERL_VERSION == 7) && (PERL_SUBVERSION < 1)))
> ...
>> #else
> ...
>> #endif /* Perl <= 5.7.1 */
>
> ITYM    /* Perl <  5.7.1 */
>
>
> Besides, there's the silent and hopefully true assumption that the
> #else-part will never be interpreted by a PERL_REVISION < 5.

Yeah, we won't get anywhere near that far in the build with a pre-5.0
Perl.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Cleanfeed Binary Checks
#79266
Author: Julien ÉLIE
Date: Thu, 07 Aug 2008 06:32
31 lines
2630 bytes
Hi Wolfgang,

>>#if (PERL_REVISION == 5) && ((PERL_VERSION < 7) || ((PERL_VERSION == 7) && (PERL_SUBVERSION < 1)))
> ...
>>#else
> ...
>>#endif /* Perl <= 5.7.1 */
>
> ITYM    /* Perl <  5.7.1 */

Yes, thanks for having pointed it out.
I realized it after having posted my message.  Note that I committed the right version
to both STABLE and CURRENT two days ago (on Tuesday).


> Besides, there's the silent and hopefully true assumption that the
> #else-part will never be interpreted by a PERL_REVISION < 5.

It cannot because PERL_REVISION was introduced in one of the Perl 5 release.
As Russ says, INN will not compile with Perl 4 (and anyway, configure will complain)
and lots of Perl scripts will not work.

Besides, I added "#define PERL_REVISION (5)" for Perl versions which do not have it defined.

-- 
Julien ÉLIE

« -- Du potage : c'est tout ce que le cuisinier a pu faire !
  -- Ce blocus devient très horripilant !
  -- Blocus, c'est ton cuisinier ? » (Astérix)
Re: Cleanfeed Binary Checks
#79267
Author: Steve
Date: Sat, 09 Aug 2008 16:45
20 lines
2119 bytes
On Tue, 5 Aug 2008 20:24:05 +0200, Julien ÉLIE wrote in
Message-Id: <g7a5sb$9mo$1@news.trigofacile.com>:

> I think it is OK to validate the patch because on mine, I do not see
> any changes and on your full feed, the average time is very good:  2
> ms per message (with 2.6 ms for the maximum), that's very good.

Patch is still working nicely.  The only new revelation is the sheer
volume of misplaced binaries it's trapping.  On my text only service I'm
seeing more volume of incoming misplaced binary than I am of entire text
feed.

Hopefully when the versions of INN with the patch incorporated become
more widely deployed this problem will diminish as servers trap it
nearer to the source.

-- 
pub   1024D/228761E7 2003-06-04 Steven Crook
      Key fingerprint = 1CD9 95E1 E9CE 80D6 C885  B7EB B471 80D5 2287 61E7
uid                  Steven Crook <steve@mixmin.net>
Re: Cleanfeed Binary Checks
#79692
Author: Matija Nalis
Date: Wed, 19 Nov 2008 13:53
76 lines
4026 bytes
On 2008-07-21, Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> wrote:
> If you want to test that, you can use Frédéric's tester:
>
>     http://news.lacave.net/inn/cf_tester.pl

By the way, here is the patch which adds several new features to it
(also sent to the author):

- adds new standard headers introduced in INN 2.4.5 and soon-to-be-2.4.6

- allows user to specify one (or more) files on command line - in
  that case just those messages are checked in verbose mode (instead of
  running corpus check). Useful for debugging cleanfeed.local rules.

- adds suport for exit level of 0 if everything is ok (or > 0 if
  corpus test has failed)

--- orig/cf_tester.pl	2007-03-30 13:09:11.000000000 +0200
+++ cf_tester.pl	2008-11-17 19:26:45.000000000 +0100
@@ -39,7 +42,19 @@
           "Followup-To" => 1, "Organization" => 1, "Content-Type" => 1, "Content-Base" => 1,
           "Content-Disposition" => 1, "X-Newsreader" => 1, "X-Mailer" => 1,
           "X-Newsposter" => 1, "X-Cancelled-By" => 1, "X-Canceled-By" => 1,
-          "Cancel-Key" => 1, "User-Agent" => 1, "X-Original-Message-ID" => 1 );
+          "Cancel-Key" => 1, "User-Agent" => 1, "X-Original-Message-ID" => 1,
+          "Cancel-Lock" => 1, "Content-Transfer-Encoding" => 1, "Face" => 1,
+          "Injection-Info" => 1, "List-ID" => 1, "MIME-Version" => 1, "Originator" => 1,
+          # since innd 2.4.5 
+          "X-Auth" => 1, "X-Complaints-To" => 1, "X-Face" => 1, "X-HTTP-UserAgent" => 1,
+          "X-HTTP-Via" => 1, "X-Modbot" => 1, "X-Modtrace" => 1, "X-No-Archive" => 1,
+          "X-Original-Trace" => 1, "X-Originating-IP" => 1, "X-PGP-Key" => 1, 
+          "X-PGP-Sig" => 1, "X-Poster-Trace" => 1, "X-Postfilter" => 1, "X-Proxy-User" => 1,
+          "X-Submissions-To" => 1, "X-Usenet-Provider" => 1, "In-Reply-To" => 1,
+          "Injection-Date" => 1, "NNTP-Posting-Date" => 1, 
+          # since innd 2.4.6
+          "X-User-ID" => 1,"X-Auth-Sender" => 1, "X-Original-NNTP-Posting-Host" => 1,
+          "Original-Sender" => 1, "NNTP-Posting-Path" => 1 );
 
 # And rock'n'roll.  No user servicable parts below.
 require "cleanfeed.local";
@@ -48,6 +63,21 @@
 @r = (0, 0, 0,
       0, 0, 0);
 
+if (@ARGV) {
+  foreach my $f (@ARGV) {
+    %hdr = {};
+    cft_parse_art("$f");
+    my $r = filter_art();
+    print "$f : ";
+    if($r) {
+      print $r."\n";
+    } else {
+      print $r."accepted\n";
+    }
+  }
+  exit 0;
+}      
+
 foreach my $d (('corpus/good','corpus/bad')) {
   foreach my $f (<$d/*>) {
     %hdr = {};
@@ -76,6 +106,9 @@
 printf("\t".'TOTAL     : %4d ok, %4d bad,  %3d%%'."\n",$r[0] + $r[3], $r[1] + $r[4],
   (($r[0] + $r[3]) * 100/ ($r[2] + $r[5]))) if($r[2] + $r[5]);
 
+# return level - 0 if ok, otherwise number of bad checks. For use in makefile /mn/
+exit ($r[1] + $r[4]);
+
 sub cft_parse_art {
   my $fn=shift;
   my @l;


-- 
Opinions above are GNU-copylefted.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads