🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #84207

Re: Mail-to-News

#84207
From: Dennis Davis
Date: Wed, 20 Jul 2011 10:04
129 lines
5731 bytes
In the referenced article, =?UTF-8?B?SnVsaWVuIMOJTElF?= <iulius@nom-de-mon-site.com.invalid> writes:
>Hi Dennis,
>
>> "postnews 0.5.3" script seems to rely on readermode.  Many others
>> rely on a working version of inews.  As does the mailpost perl
>> script that comes with INN-2.5.2.  Are you suggesting that the
>> mailpost perl script be extended to use "ihave" where using inews is
>> not applicable?
>
>I would tend to think that inews itself should use IHAVE (if
>available) when POST cannot be used.  It is the whole point of the
>NNTP protocol as described in RFC 3977 and implemented in current
>versions of innd & nnrpd. inews should comply with RFC 3977, that
>is to say it should use CAPABILITIES and select the right command
>to invoke (IHAVE, POST, eventually MODE READER).
>
>Of course, it would be the same for rnews.

Documentation for inews in INN indicates that it's not suitable
for use on client machines.  So these changes won't affect other
versions of inews out there.  Eg the inews that comes with the
trn Newsreader and the mini-inews that's still out there somewhere.
However I don't see this as a problem.  It's not likely
that a client machine won't have POST permission.

>With news servers like INN 2.4 that predate RFC 3977, the behaviour 
>would remain the same as currently (or maybe try both IHAVE and POST 
>when one of them is not available).

That's a judgement call.  Do you want to maintain a 2.4.x branch
as well as a 2.5.x branch?

>No changes in scripts like mailpost.

Agreed.

...

>> So I first thought to switch the file locking in mailpost to use
>> the shlock program that comes with INN.  However I decided against
>> this as the LockFile-Simple module seems more versatile as well as
>> system-independent.
>
>However, it adds a dependency on an external Perl module that is not 
>necessarily available on the system.
>
>Why isn't shlock versatile enough?
>We already have an example of working implementation in controlchan:
>
>
>shlock($lockfile);
># Do what you want.
>unlink $lockfile;
>
>
>sub shlock {
>     my $lockfile = shift;

...

My defence here is, as stated earlier in this thread:

  The last time I ran INN was in 2004 with INN2.2.  And I can't
  remember any of it :-(

So I'm effectively starting out fresh with INN.  I hadn't spotted
the shlock perl subroutine in controlchan but had been looking at
the LockFile-Simple perl module for other purposes.  The use of
locking in mailpost -- try five time to get a lock, waiting a second
between each attempt -- was easy to set up with LockFile-Simple so I
went with that.

The above shlock perl routine could certainly be made versatile
enough for most puposes by adding extra parameters.  Eg
"lock_attempts" and "delay" for use in mailpost.

>> So I installed the LockFile-Simple perl module and modified the code
>> of mailpost to use this module if it's available.  Now everything is
>> working as expected.  The pullnews and signcontrol perl scripts that
>> come with INN also use flock; I suppose I should also look at these
>> scripts.
>
>No need to touch signcontrol before having decided on the future of
>this script:
>   http://inn.eyrie.org/trac/ticket/14

A compromise would be to include signcontrol and maintain it as
part of the source but not install it by default.  Those that
require it would need to type:

make install signcontrol

Easy enough to explain in the INSTALL documentation.

>pullnews could indeed make use of another function than flock.

Pullnews seems to create a lockfile to ensure two copies aren't
running at once.  Easily implemented using a perl routine based on
shlock.

...

>> !     $lockmgr = LockFile::Simple->make (-format =>  '%f.lock',
>> !         -max =>  5, -delay =>  1);
>> !     $lockmgr->lock ($Database) || mailArtAndDie ("can't lock $Database");
>[…]
>> ! $lockmgr->unlock ($Database) || mailArtAndDie ("can't unlock
>> $Database");
>
>That indeed requires less lines than a call to shlock.

Maybe, but you've still got the overhead of including the perl module.
So the total size of the perl program may still be larger

>Yet, I am still unconvinced compared to a similar use of shlock…

Me too.  I suspect a suitable perl subroutine, based on shlock, and
is the way to go.  The subroutine could be included in each perl
program that required it.  Or, if the need for such routines grows,
form part of an INN perl module.

>Anyway, thanks for the suggestion of change and, above all, your
>bug report and patch proposal.

No problem.  I'm sure I can come up with other semi-useless
suggestions :-)
-- 
Dennis Davis, BUCS, University of Bath, Bath, BA2 7AY, UK
D.H.Davis@bath.ac.uk
Technical Details
Message-ID: <LoMMn0.67I.B.larch@bath.ac.uk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!num2.nntp.dca.giganews.com!num1.nntp.dca.giganews.com!number.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin3!goblin.stu.neva.ru!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!feeds.news.ox.ac.uk!news.ox.ac.uk!sanger.ac.uk!bath.ac.uk!ccsdhd
References: <iuaorh$gbt$1@n102.xanadu-bbs.net> <ivvjd7$c15$1@news.trigofacile.com> <LoJ8po.KpC.B.larch@bath.ac.uk> <j01usk$v8r$1@news.trigofacile.com>

Show Full Headers
Complete Article Headers
Message-ID: <LoMMn0.67I.B.larch@bath.ac.uk>
Subject: Re: Mail-to-News
Date: Wed, 20 Jul 2011 10:04:12 GMT
From: ccsdhd@bath.ac.uk (Dennis Davis)
References: <iuaorh$gbt$1@n102.xanadu-bbs.net> <ivvjd7$c15$1@news.trigofacile.com> <LoJ8po.KpC.B.larch@bath.ac.uk> <j01usk$v8r$1@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!num2.nntp.dca.giganews.com!num1.nntp.dca.giganews.com!number.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin3!goblin.stu.neva.ru!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!feeds.news.ox.ac.uk!news.ox.ac.uk!sanger.ac.uk!bath.ac.uk!ccsdhd
Newsgroups: news.software.nntp
Organization: BUCS, University of Bath, UK
Lines: 128