🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
20 messages
20 total messages Started by Matti.Suuronen Thu, 21 Apr 2005 13:18
News::Gateway recreating Message-Id unnecessarily
#71105
Author: Matti.Suuronen
Date: Thu, 21 Apr 2005 13:18
13 lines
1884 bytes
Hi,

I've been using News::Gateway 0.42 (Thanks, Russ :-) to get mailing 
lists onto a news server. I'm using Message-ID munging, and it works 
perfectly for most cases. However, when the original Message-Id does 
_not_ contain a dot, the Gateway renames the original id as 
"X-Original-Message-ID" and creates a new Message-Id. This confuses 
threading, since now this Message-ID is not derived from the original 
one, but is instead a completely different string.

Has anyone seen the same, or perhaps even fixed this problem ?

--Matti
Re: News::Gateway recreating Message-Id unnecessarily
#71107
Author: Marco d'Itri
Date: Thu, 21 Apr 2005 17:52
149 lines
4990 bytes
first.last@iki.fi.invalid wrote:

>Has anyone seen the same, or perhaps even fixed this problem ?
You really need to munge *every* Message-ID.
This is the code which I use for the mail->news side of linux.*:

$News::Gateway::HOOKS{rewriteid} = ['iddomain'];

    $gw->modules(
        'rewriteid'     => [$gw->datadir],
...
    );

sub News::Gateway::rewriteid_conf {
    my ($self, $directive, $domain) = @_;

    if ($directive eq 'iddomain') {
        $self->{rewriteid}{iddomain} = $domain;
    }
}

use BerkeleyDB;

sub News::Gateway::rewriteid_init {
    my ($self, $dir) = @_;

    return if $::ID_N2M_DB;

    my $env = BerkeleyDB::Env->new(
        -Flags => DB_CREATE|DB_INIT_MPOOL|DB_INIT_CDB,
        -Home => "$dir/db",
        -ErrFile => "$dir/db/err.log",
        -Verbose => 1|2|4|8,
    );
    die "Cannot create DB environment: $BerkeleyDB::Error" if not defined $env;

    $::ID_M2N_DB = BerkeleyDB::Hash->new(
        -Env => $env,
        -Flags => DB_CREATE,
        -Filename => 'id_m2n.db',
        -Pagesize => 512,
    );
    die "Cannot open DB id_m2n.db: $BerkeleyDB::Error"
        if not defined $::ID_M2N_DB;

    $::ID_N2M_DB = BerkeleyDB::Hash->new(
        -Env => $env,
        -Flags => DB_CREATE,
        -Filename => 'id_n2m.db',
        -Pagesize => 512,
    );
    die "Cannot open DB id_n2m.db: $BerkeleyDB::Error"
        if not defined $::ID_N2M_DB;
}

sub News::Gateway::rewriteid_mesg {
    my $self = $_[0];
    my $article = $self->{article};

    # from mailtonews.al
    my $rid = $article->header('In-Reply-To');
    if ($rid and $rid =~ /(<[^\s\@>]+\@[^\s.>]+(\.[^.\s>]+)*>)/) {
        $rid = $1;
        my $references = $article->header('References');
        if (not $references) {
            $article->set_headers(References => $rid);
        } elsif ((split(' ', $references))[-1] ne $rid) {
            $references .= ' ' . $rid;
            $article->set_headers(References => $references);
        }
        $article->drop_headers('In-Reply-To');
    }

    my $domain = $self->{rewriteid}{iddomain};
    my $id = $article->header('Message-ID');
    $article->set_headers(
        'Message-ID' => idconvert($id, $domain),
        'X-Original-Message-ID' => $id || '(none)',
    );

    my $ref = $article->header('References');
    if ($ref) {
        my $newref = '';
        foreach my $refid (split(/\s+/, $ref)) {
            $newref .= ' ' if $newref;
            $newref .= idconvert($refid, $domain);
        }
        $article->set_headers(
            'References' => $newref,
            'X-Original-References' => $ref,
        );
    }

    undef;
}

sub idconvert {
    my ($id, $domain) = @_;

    if (not $id) {                  # the article has no Message-ID
        return gen_message_id($domain);
    }

    my $val;
    my $r = $::ID_M2N_DB->db_get($id, $val);
    die $r if $r and $r !~ /^DB_NOTFOUND/;

    if ($r) {   # not found => ID not seen yet
        my $newid = gen_message_id($domain);
        $r = $::ID_M2N_DB->db_put($id, $newid . ' ' . time, DB_NOOVERWRITE);
        die "$r ($id, $newid ...)" if $r;
        $r = $::ID_N2M_DB->db_put($newid, $id, DB_NOOVERWRITE);
        die "$r ($newid, $id)" if $r;
        return $newid;
    } else {    # already processed ID
        return (split(/ /, $val))[0];
    }
}

sub gen_message_id {
    my ($domain, $prefix) = @_;
    my $offset = 1056000000;
    $prefix ||= '';

    $UniqueCounter++;
    return "<$prefix" . dec2k(time - $offset, 62) .  '-' . dec2k($$, 62)
        . '-' . $UniqueCounter++ . '@' . "$domain>";
}

sub dec2k {
    my ($num, $base, $symbols) = @_;
    $symbols ||= '0123456789' .
        'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $base ||= length $symbols;

    use integer;

    my $ret = '';
    while ($num != 0) {
        $ret .= substr($symbols, $num % $base, 1);
        $num /= $base;
    }

    return reverse $ret;
}

-- 
ciao, |
Marco | * The Internet is full. Go away.  -- Joel Furr *
Re: News::Gateway recreating Message-Id unnecessarily
#71108
Author: Russ Allbery
Date: Thu, 21 Apr 2005 19:02
18 lines
1865 bytes
Matti Suuronen <first.last@iki.fi.invalid> writes:

> I've been using News::Gateway 0.42 (Thanks, Russ :-) to get mailing
> lists onto a news server. I'm using Message-ID munging, and it works
> perfectly for most cases. However, when the original Message-Id does
> _not_ contain a dot, the Gateway renames the original id as
> "X-Original-Message-ID" and creates a new Message-Id. This confuses
> threading, since now this Message-ID is not derived from the original
> one, but is instead a completely different string.

My impression is that some servers will reject message IDs not containing
a dot.

-- 
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: News::Gateway recreating Message-Id unnecessarily
#71109
Author: Bert Hyman
Date: Thu, 21 Apr 2005 19:29
27 lines
2066 bytes
rra@stanford.edu (Russ Allbery) wrote in
news:87hdi02bs1.fsf@windlord.stanford.edu: 

> Matti Suuronen <first.last@iki.fi.invalid> writes:
> 
>> I've been using News::Gateway 0.42 (Thanks, Russ :-) to get
>> mailing lists onto a news server. I'm using Message-ID munging,
>> and it works perfectly for most cases. However, when the original
>> Message-Id does _not_ contain a dot, the Gateway renames the
>> original id as "X-Original-Message-ID" and creates a new
>> Message-Id. This confuses threading, since now this Message-ID is
>> not derived from the original one, but is instead a completely
>> different string. 
> 
> My impression is that some servers will reject message IDs not
> containing a dot.

The standard for USENET message formats, RFC-1036, references RFC-822
for the format of a Message-ID, which says that they "must" look
like 

       <unique@full_domain_name>

So, at least one period is required.

-- 
Bert Hyman | St. Paul, MN | bert@iphouse.com
Re: News::Gateway recreating Message-Id unnecessarily
#71110
Author: Matti Suuronen
Date: Thu, 21 Apr 2005 19:50
28 lines
2471 bytes
>>
>>My impression is that some servers will reject message IDs not
>>containing a dot.

In fact it seems like Message-ID of my posting was in non-dot format. I 
really should fix that ;-). Anyway, it seems like the posting made it's 
way through to at least some servers.

> 
> 
> The standard for USENET message formats, RFC-1036, references RFC-822
> for the format of a Message-ID, which says that they "must" look
> like 
> 
>        <unique@full_domain_name>
> 
> So, at least one period is required.
> 

Yes, that is the case. However, there are several sites/clients broken 
out there, and rather than trying to fix them it would be far simpler to 
fix the gateway. Or is there some other reason why I should reject the 
non-confiming Message-IDs ? The news server is for internal use, and 
these articles will never make it to the ouside world. Therefore I would 
imagine I could any Message-ID I want, as long as it is unique.

--Matti
Re: News::Gateway recreating Message-Id unnecessarily
#71111
Author: Bruno Hertz
Date: Thu, 21 Apr 2005 20:21
10 lines
1448 bytes
Marco d'Itri <md@Linux.IT> writes:

> first.last@iki.fi.invalid wrote:
>
>>Has anyone seen the same, or perhaps even fixed this problem ?
> You really need to munge *every* Message-ID.

Just out of curiosity, why *every* ?

Regards, Bruno.
Re: News::Gateway recreating Message-Id unnecessarily
#71112
Author: Matti Suuronen
Date: Thu, 21 Apr 2005 20:28
19 lines
2141 bytes
Marco d'Itri wrote:
> first.last@iki.fi.invalid wrote:
> 
> 
>>Has anyone seen the same, or perhaps even fixed this problem ?
> 
> You really need to munge *every* Message-ID.
> This is the code which I use for the mail->news side of linux.*:
> 
Not having user Perl for a few years, it will take me some time before I 
really understand how the magic in you code works ;-). Did you write 
this because the munging in News::Gateway did not work for non-dot 
Message-IDs, or was there some other reason ?

In our case it seems like the "standard" munging algorithm with 
prepending the ID with the group name would be ok, if it also worked for 
the non-dot ones.

--Matti
Re: News::Gateway recreating Message-Id unnecessarily
#71113
Author: Russ Allbery
Date: Thu, 21 Apr 2005 23:07
18 lines
1903 bytes
Matti Suuronen <first.last@iki.fi.invalid> writes:

> Yes, that is the case. However, there are several sites/clients broken
> out there, and rather than trying to fix them it would be far simpler to
> fix the gateway.

The point is that News::Gateway is adjusting for a broken message ID, on
the grounds that breaking the thread is better than having the article not
be accepted at all.

Yeah, unfortunately, right now there isn't an easy way to reconfigure
that.

-- 
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: News::Gateway recreating Message-Id unnecessarily
#71114
Author: Russ Allbery
Date: Thu, 21 Apr 2005 23:07
14 lines
1613 bytes
Bruno Hertz <brrhtz@y4h00d0td3.invalid> writes:
> Marco d'Itri <md@Linux.IT> writes:

>> You really need to munge *every* Message-ID.

> Just out of curiosity, why *every* ?

It saves you if there are multiple gateways of the same group.

-- 
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: News::Gateway recreating Message-Id unnecessarily
#71115
Author: Russ Allbery
Date: Thu, 21 Apr 2005 23:09
30 lines
2594 bytes
Matti Suuronen <first.last@iki.fi.invalid> writes:

> Not having user Perl for a few years, it will take me some time before I
> really understand how the magic in you code works ;-). Did you write
> this because the munging in News::Gateway did not work for non-dot
> Message-IDs, or was there some other reason ?

> In our case it seems like the "standard" munging algorithm with
> prepending the ID with the group name would be ok, if it also worked for
> the non-dot ones.

This is a pretty easy modification, but I'm not sure it's one I want to
make upstream.

(BTW, I am, after a very long hiatus, working on a new release of
News::Gateway in conjunction with Tim Skirvin, and hope to finally get
something out sometime this summer that will be a bit easier to extend and
will include a lot of fixes to the standard rewrite modules that I've
accumulated over the years.  Unfortunately, there are also some API
differences, since I redid things in ways that I think will be more
extensible going forward.  I'm going to try to get a test release out
hopefully sometime this month, although I'm also substantially increasing
the amount of work I'm doing for Debian at the same time and I'm a bit
behind in dealing with INN, so that may be aggressive.)

-- 
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: News::Gateway recreating Message-Id unnecessarily
#71116
Author: Bruno Hertz
Date: Thu, 21 Apr 2005 23:35
17 lines
1855 bytes
Russ Allbery <rra@stanford.edu> writes:

> Bruno Hertz <brrhtz@y4h00d0td3.invalid> writes:
>> Marco d'Itri <md@Linux.IT> writes:
>
>>> You really need to munge *every* Message-ID.
>
>> Just out of curiosity, why *every* ?
>
> It saves you if there are multiple gateways of the same group.

Thanks for your reply. Besides this and mail crossposts potentially
being fed through different gateways, could there be any other
imaginable reason for unconditionally munging mail MIDs? (just want to
know them all ...)

Regards, Bruno.
Re: News::Gateway recreating Message-Id unnecessarily
#71117
Author: Russ Allbery
Date: Thu, 21 Apr 2005 23:41
38 lines
3076 bytes
Bruno Hertz <brrhtz@y4h00d0td3.invalid> writes:
> Russ Allbery <rra@stanford.edu> writes:

>> It saves you if there are multiple gateways of the same group.

> Thanks for your reply. Besides this and mail crossposts potentially
> being fed through different gateways, could there be any other
> imaginable reason for unconditionally munging mail MIDs? (just want to
> know them all ...)

Well, it fixes all of the problems with invalid message IDs breaking
threading.  If you just rewrite everything, then you maintain a local
database of mail to news message ID mappings and transform the References
header as well, and the result keeps all the threading and looks fairly
clean.  You could attempt partial solutions, but transforming everything
is easy.

The only problem is getting followups back to the mailing list while
restoring threading in mail.  This works fine so long as someone is only
posting to a bunch of newsgroups that are all gated back into mail by the
same system with access to the same database.  Unfortunately, as soon as
you want to follow up to something in a gated mailing list and then also
cc some other address that doesn't have a corresponding news to mail
gateway, you end up sending weird References headers and people get a
little annoyed.

(I've run into this with the linux.debian.* groups when following up to
bug threads crossposted to linux.debian.devel, since of course there's no
newsgroup corresponding to NNNNN@bugs.debian.org, which is cc'd on the
traffic.)

There's no really good solution to that situation, unfortunately.

-- 
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: News::Gateway recreating Message-Id unnecessarily
#71119
Author: Bruno Hertz
Date: Fri, 22 Apr 2005 00:32
52 lines
3837 bytes
Russ Allbery <rra@stanford.edu> writes:

> Bruno Hertz <brrhtz@y4h00d0td3.invalid> writes:
>> Russ Allbery <rra@stanford.edu> writes:
>
>>> It saves you if there are multiple gateways of the same group.
>
>> Thanks for your reply. Besides this and mail crossposts potentially
>> being fed through different gateways, could there be any other
>> imaginable reason for unconditionally munging mail MIDs? (just want to
>> know them all ...)
>
> Well, it fixes all of the problems with invalid message IDs breaking
> threading.  If you just rewrite everything, then you maintain a local
> database of mail to news message ID mappings and transform the References
> header as well, and the result keeps all the threading and looks fairly
> clean.  You could attempt partial solutions, but transforming everything
> is easy.
>
> The only problem is getting followups back to the mailing list while
> restoring threading in mail.  This works fine so long as someone is only
> posting to a bunch of newsgroups that are all gated back into mail by the
> same system with access to the same database.  Unfortunately, as soon as
> you want to follow up to something in a gated mailing list and then also
> cc some other address that doesn't have a corresponding news to mail
> gateway, you end up sending weird References headers and people get a
> little annoyed.
>
> (I've run into this with the linux.debian.* groups when following up to
> bug threads crossposted to linux.debian.devel, since of course there's no
> newsgroup corresponding to NNNNN@bugs.debian.org, which is cc'd on the
> traffic.)
>
> There's no really good solution to that situation, unfortunately.

OK, I got the picture, thanks for elaborating on this. The reason I
asked actually is a discussion we recently had on the German Debian
user list about these issues.

It was unwillingly provoked by me, since I said it was possible to
read Debian lists through Gmane but post directly to the lists at the
same time. Since ppl had bad experiences with bofh.it in this regard
they jumped at me, and I had to tell them that Gmane did no munging,
while actually not really knowing the exact reasons myself. I even
contacted Lars on that issue, who was kind enough to explain possible
reasons for muning to me, and why he didn't need it being a standalone
server.

So, since this thread was already going on, I thought I might ask as
well here again, just to complete and close the discussion for me.

Thanks, Bruno.
Re: News::Gateway recreating Message-Id unnecessarily
#71120
Author: Russ Allbery
Date: Fri, 22 Apr 2005 01:05
22 lines
2415 bytes
Bruno Hertz <brrhtz@y4h00d0td3.invalid> writes:

> It was unwillingly provoked by me, since I said it was possible to read
> Debian lists through Gmane but post directly to the lists at the same
> time. Since ppl had bad experiences with bofh.it in this regard they
> jumped at me, and I had to tell them that Gmane did no munging, while
> actually not really knowing the exact reasons myself.

This works fine for bofh.it; Marco unmunges the message IDs on replies.
You just have to be careful to always follow up to the newsgroup, not cc
mailing list addresses, and there's the problem mentioned previously when
some of the addresses you want to cc don't have newsgroups.

I still use the bofh.it-gated groups for all the Debian groups I check
infrequently, and only subscribe to the lists when I think it's likely
that I'm going to want to reply to threads or cc bug addresses.

-- 
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: News::Gateway recreating Message-Id unnecessarily
#71121
Author: Bruno Hertz
Date: Fri, 22 Apr 2005 01:39
29 lines
2392 bytes
Russ Allbery <rra@stanford.edu> writes:

> Bruno Hertz <brrhtz@y4h00d0td3.invalid> writes:
>
>> It was unwillingly provoked by me, since I said it was possible to read
>> Debian lists through Gmane but post directly to the lists at the same
>> time. Since ppl had bad experiences with bofh.it in this regard they
>> jumped at me, and I had to tell them that Gmane did no munging, while
>> actually not really knowing the exact reasons myself.
>
> This works fine for bofh.it; Marco unmunges the message IDs on replies.

Misunderstanding (I just follow up for the records). What I do is

        Gmane

          |
   read   |
         \|/

         Me ---------------> xxx@lists.debian.org
             post/followup


and that's of course not possible with bofh.it. I.e. one can't
substitute Gmane with a regular usenet server in this picture, due to
munging. That's why ppl jumped at me :)

Regards, Bruno.
Re: News::Gateway recreating Message-Id unnecessarily
#71122
Author: Russ Allbery
Date: Fri, 22 Apr 2005 02:07
26 lines
2036 bytes
Bruno Hertz <brrhtz@y4h00d0td3.invalid> writes:

> Misunderstanding (I just follow up for the records). What I do is

>         Gmane

>           |
>    read   |
>          \|/

>          Me ---------------> xxx@lists.debian.org
>              post/followup


> and that's of course not possible with bofh.it.

Oh, right, I get it.

BTW, Lars does munge IDs sometimes, when they're so invalid that INN won't
accept them.

-- 
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: News::Gateway recreating Message-Id unnecessarily
#71123
Author: Bruno Hertz
Date: Fri, 22 Apr 2005 02:50
13 lines
2059 bytes
Russ Allbery <rra@stanford.edu> writes:

> BTW, Lars does munge IDs sometimes, when they're so invalid that INN won't
> accept them.

Yes, he mentioned it to me, but it should be a rare case after all.

I myself didn't break a thread that way yet, but if it occured more
than really, really seldom in discussions I partake in, I'd of course
adjust my posting methods (although it still might be interesting to
catch those situations live and maybe investigate them a little).

Regards, Bruno.
Re: News::Gateway recreating Message-Id unnecessarily
#71124
Author: John Schmidt
Date: Fri, 22 Apr 2005 11:06
14 lines
1490 bytes
Bert Hyman wrote:

> The standard for USENET message formats, RFC-1036, references RFC-822
> for the format of a Message-ID, which says that they "must" look
> like 
> 
>        <unique@full_domain_name>
> 
> So, at least one period is required.

A full domain name doesn't require a period - there are TLDs with A records.

JS
Re: News::Gateway recreating Message-Id unnecessarily
#71125
Author: Bert Hyman
Date: Fri, 22 Apr 2005 12:46
21 lines
1785 bytes
js@radix.net (John Schmidt) wrote in
news:116hmv1omsk8697@corp.supernews.com: 

> Bert Hyman wrote:
> 
>> The standard for USENET message formats, RFC-1036, references
>> RFC-822 for the format of a Message-ID, which says that they
>> "must" look like 
>> 
>>        <unique@full_domain_name>
>> 
>> So, at least one period is required.
> 
> A full domain name doesn't require a period - there are TLDs with A
> records. 

Well, it looks like the people who implemented the Message-ID
verification code in a number of products didn't know that :-) 

-- 
Bert Hyman | St. Paul, MN | bert@iphouse.com
Re: News::Gateway recreating Message-Id unnecessarily
#71126
Author: John Schmidt
Date: Fri, 22 Apr 2005 13:56
16 lines
1856 bytes
Bert Hyman wrote:
> js@radix.net (John Schmidt) wrote in
> news:116hmv1omsk8697@corp.supernews.com: 
>>
>>A full domain name doesn't require a period - there are TLDs with A
>>records. 
> 
> 
> Well, it looks like the people who implemented the Message-ID
> verification code in a number of products didn't know that :-)

I can't imagine it ever actually coming in to play - it's a ridiculous 
fringe case. I only thought about it because of a recent discussion with 
a co-worker concerning odd MX and A records I'd seen and/or read about.

JS
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