🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #60019

Re: Redirect/Saving newsgroup to different newsgroup.

#60019
From: Russ Allbery
Date: Fri, 23 Aug 2002 17:39
96 lines
5842 bytes
Jeffrey M Vinocur <jeff@litech.org> writes:

> Well, there are two subtly different questions, as I see it:

> - Renaming a group.  In this case you probably want everything to
>   be exactly the same except for the group name, including most
>   likely Message-IDs.  This is feasible in tradspool by moving
>   the files, applying some simple Perl, rebuilding
>   history/overview after you're done.

> - Moving articles to a different, existing, group (or merging
>   groups).  In this case, you can't preserve article numbers,
>   certainly.  In order to get the server to assign numbers,
>   you'd need to reinject the articles (either munging the
>   Message-IDs or purging them from history first).
>   Alternatively, you could very carefully assign the article
>   numbers yourself, and then rebuild everything as above.

> Personally, I hope I never have to do either.  But people seem to want
> to do this (more often the first one, I think), and we should at least
> provide the bit of Perl needed to do this with tradspool.

Thanks.  I have now added this to the FAQ:

URL: <http://www.eyrie.org/~eagle/faqs/inn.html#S6.5>

Subject: 6.5. Rename a newsgroup

INN has no native support for renaming a newsgroup, and doing so is
difficult, so the best advice is to not do this.  If there's a way that
you can just create the new newsgroup, encourage people to start using it,
and then remove the old newsgroup, I recommend that.  It's much easier.

However, if it really must be done, it's best if you're using the
tradspool storage method.  The newsgroup of an article is stored in the
Newsgroups header and Xref header of the article as stored on disk (and
possibly in Followup-To), as well as determining where the overview
information is stored, and in the case of tradspool is also encoded in the
article's storage token.  To rename a newsgroup in tradspool, stop the
server, move the directory containing all of the articles to its
appropriate new location in the news spool, edit every article to change
the old name to the new name in Newsgroups, Followup-To, and Xref, and
then rebuild history and overview with makehistory.

The following bit of Perl may help with the renaming (from Jeffrey
Vinocur):

    #!/usr/bin/perl -wi
    my ($src, $dst) = (shift, shift);
    die "Usage: $0 oldgroup newgroup [file1 [file2 ...]]\n"
        unless(defined $dst);
    while(<>) {
        s/$src/$dst/g if 1 .. /^$/ and /^(Newsgroups|Followup-To|Xref):/i;
        print;
    } continue {
        close ARGV if eof;
    }

If any articles were crossposted to other newsgroups, you'll also have to
find and recreate the links in those newsgroups to the new location of the
articles (if the links were hard links and the process of changing the
Xref, Followup-To, Newsgroups headers didn't break those links, you may be
lucky and be able to skip this).

If you're using another storage method, this is harder, although with
timehash you may be able to just change the Newsgroups, Xref, Followup-To
headers of the articles in that newsgroup and then rebuild history and
overview as above.

One other approach that can be used regardless of storage method is to
refeed the articles to the server into a new newsgroup.  This approach
works best if you're also changing news servers at the same time;
otherwise, the message IDs of the articles will already be in history, and
you'll have to change the message IDs of all of the messages or remove
them from the history database (such as by moving the articles away,
changing /remember/ to 0 so that old history entries won't be retained,
and then running expire to purge them out of history).  To do this, get
all of the messages into a directory (by pulling them down via NNTP or
some other method), change the Newsgroups, Xref, and Followup-To headers
to rename the newsgroup, and then create a file containing paths to all of
the articles, one per line.  You can then use that file as input to
innxmit, pointing it at the server to which to feed the articles, and if
the articles aren't listed in history on that server and it carries the
new group, they will be accepted into the new newsgroup.

Note that if you use this method and something goes wrong the first time,
the message IDs will probably have all been added to history on the new
server and the articles now will never be accepted until those entries are
removed from history again (or all the message IDs changed).

-- 
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.
Technical Details
Message-ID: <ylr8gpv5in.fsf@windlord.stanford.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.stanford.edu!not-for-mail
References: <3D1A0033.9010402@acme.nsc.com> <afqfrp$df$3@puck.litech.org> <ylr8ingdqb.fsf@windlord.stanford.edu> <afrib3$dc3$2@puck.litech.org>

Show Full Headers
Complete Article Headers
Message-ID: <ylr8gpv5in.fsf@windlord.stanford.edu>
Subject: Re: Redirect/Saving newsgroup to different newsgroup.
Date: Fri, 23 Aug 2002 10:39:28 -0700
From: Russ Allbery <rra@stanford.edu>
References: <3D1A0033.9010402@acme.nsc.com> <afqfrp$df$3@puck.litech.org> <ylr8ingdqb.fsf@windlord.stanford.edu> <afrib3$dc3$2@puck.litech.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.stanford.edu!not-for-mail
Newsgroups: news.software.nntp
Organization: The Eyrie
Lines: 95
NNTP-Posting-Host: windlord.stanford.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: news.Stanford.EDU 1030124368 13141 171.64.13.23 (23 Aug 2002 17:39:28 GMT)
X-Complaints-To: news@news.stanford.edu
User-Agent: Gnus/5.090008 (Oort Gnus v0.08) XEmacs/21.4 (Honest Recruiter,
 sparc-sun-solaris2.6)
Cancel-Lock: sha1:/kCyc9a0Zo93XiycKnNvRpubMmM=