[net.news.b] rn and .newsrc

merworth@ut-ngp.UUCP (Boyd Merworth) (07/24/86)

I have "rn" installed on a VAX 11/780 running 4.2BSD and
bnews 2.10.3 (January 1986 version).  There seems to be a
problem with the way rn updates the .newsrc file.  If this
have been discussed before, please excuse me.  If a fix
has been posted, I would appreciate having someone mail
it to me or repost it to the net.

If I have a group marked in my .newsrc file to which I
do not subscribe, why does rn keep appending article numbers
to that entry if the article has been cross-posted to a group
to which I subscribe?  Eventually, if readnews is invoked on
login, I get an error message, ".newsrc line too long".  The
line is even too long for vi to handle!

Thanks for any pointers.
-- 
Boyd Merworth
The University of Texas at Austin, Computation Center,   Austin, TX 78712
merworth@ngp.cc.utexas.edu 	 {ihnp4,allegra,ut-sally}!ut-ngp!merworth
				 	       {seismo}!ut-sally!merworth

zben@umd5 (Ben Cranston) (07/25/86)

In article <3694@ut-ngp.UUCP> merworth@ut-ngp.UUCP (Boyd Merworth) writes:

> I have "rn" installed on a VAX 11/780 running 4.2BSD and
> bnews 2.10.3 (January 1986 version).  There seems to be a
> problem with the way rn updates the .newsrc file.  ...
> If I have a group marked in my .newsrc file to which I
> do not subscribe, why does rn keep appending article numbers
> to that entry if the article has been cross-posted to a group
> to which I subscribe?  Eventually, if readnews is invoked on
> login, I get an error message, ".newsrc line too long".  The
> line is even too long for vi to handle!

Yes, this happens.  Rn is trying to update .newsrc to reflect the fact
that you read that item.  Items cross posted to many groups get marked as
read in all the groups, the ones posted only to the unsubscribed groups are
represented by the gap.

There is an argument that what it does is the right thing (i.e. that this is
not a bug, it is a feature).  If you resubscribed to the group, rn will now
be able to present you with only the items you really have not read...

My personal opinion is that if I resubscribe it would be OK for rn to show
me ALL the remaining messages in that group, to jog my memory, so it would be
ok by me to not ever mark items read within unsubscribed groups.  Others may
argue with this though.  Larry, are you listening?

Anyway, I periodically run my .newsrc through this cleanup script, which
essentially closes the gaps.  This does NOT do what I asked for above, it
makes everything READ (not UNREAD), but it does keep .newsrc sane:

sed -n \
-e ':again' \
-e 's/[-,][0-9]*[-,]/-/g' \
-e 't again' \
-e 'p'
-- 
                    umd5.UUCP    <= {seismo!umcp-cs,ihnp4!rlgvax}!cvl!umd5!zben
Ben Cranston zben @ umd2.UMD.EDU    Kingdom of Merryland Sperrows 1100/92
                    umd2.BITNET     "via HASP with RSCS"

ken@turtlevax.UUCP (Ken "Turk" Turkowski) (07/28/86)

In article <3694@ut-ngp.UUCP> merworth@ut-ngp.UUCP (Boyd Merworth) writes:
>If I have a group marked in my .newsrc file to which I
>do not subscribe, why does rn keep appending article numbers
>to that entry if the article has been cross-posted to a group
>to which I subscribe?  Eventually, if readnews is invoked on
>login, I get an error message, ".newsrc line too long".  The
>line is even too long for vi to handle!

First, catch up on your news reading, then execute the following
program to fix up your .newsrc.  It will insert a dash between the
first and last numbers, deleting all those in between.  It even
works if you have an options line.
-----------------------------------------------------------------

# This is a shell archive.  Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file".  (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# newsrcfix

echo x - newsrcfix
cat > "newsrcfix" << '//E*O*F newsrcfix//'
#!/bin/sh
NRC=${NEWSRC-$HOME/.newsrc}
sed -e 's/\([0-9][0-9]*\)[-,].*[-,]\([0-9][0-9]*\)/\1-\2/' $NRC > $NRC.new
cp $NRC.new $NRC
rm $NRC.new
//E*O*F newsrcfix//

exit 0
-----------------------------------------------------------------
-- 
Ken Turkowski @ CIMLINC, Menlo Park, CA
UUCP: {amd,decwrl,hplabs,seismo}!turtlevax!ken
ARPA: turtlevax!ken@DECWRL.DEC.COM

lwall@sdcrdcf.UUCP (Larry Wall) (07/29/86)

In article <3694@ut-ngp.UUCP> merworth@ut-ngp.UUCP (Boyd Merworth) writes:
> If I have a group marked in my .newsrc file to which I
> do not subscribe, why does rn keep appending article numbers
> to that entry if the article has been cross-posted to a group
> to which I subscribe?  Eventually, if readnews is invoked on
> login, I get an error message, ".newsrc line too long".  The
> line is even too long for vi to handle!

Rn is just trying to be polite, and stay one step ahead of the user.
Just because a newsgroup is not subscribed to currently does not mean that
it will not be subscribed to in the future.  So rn marks the Xreffed
articles in the unsubscribed group so that, if the newsgroup is resubscribed
to, the articles will not need to be viewed.

Now, as it happens, under certain circumstances, this can cause the line
in the .newsrc to grow longer than 1024 bytes, which causes certain other
programs grief.  Rn doesn't care how long the lines are--you got the memory,
rn will swallow the line.  If you never look at the .newsrc with anything but
rn, you'll never have the problem.  Most people who use rn don't invoke
readnews any more.  (If you want to check for news in your login script,
some variant of "rn -c" is apt to be somewhat faster.)

Rn does, in general, try to keep the .newsrc in a state that readnews can
handle.  This includes some amount of effort to coalesce long lines in
the .newsrc.  During a given rn session, the first time a newsgroups is
Xreffed into, a check is made of the minimum article number in the newsgroup,
and any unread articles less than that are assumed expired and marked read.
(This happens even in newsgroups you don't visit, such as unsubscribed ones.)
On any Xref marking, range coalescing is done if possible.  There are a couple
of things that can defeat this, however:

1) Using an old version of rn (pre 4.3).

2) Letting stranded articles hang around forever.

By a stranded article, I mean one that isn't in the history file, so expire
can't zap it, but is still on the disk, so the minimum article number in the
active file never increases.  (If you are running an older version of the
news system (pre 2.10.2), there is no mininum article number in the active
file--in this case rn gets the minimum article number directly out of the
spool directory.  You can still have a stranded article problem.)

There are a couple of things to do about this.  If you are an SA, fix your
news system so you don't have stranded articles.  This involves properly
interlocking expire and rnews so articles don't come in while expire is
recreating the history file.  This has been mentioned on the net before.

If you aren't an SA, you have several options open to you.

* Write your own version of readnews and vi to handle long lines.  :-)

* Bug your SA to fix expire.

* Don't use anything but rn.  Let's hear it for product loyalty, heh, heh...

* Visit the newsgroup (with rn) when the line gets too long and read the
  stranded articles.  This will almost always shorten the line to less than
  1024, whereupon you can use readnews or vi.  Yeah, I know, hard to do with
  unsubscribed groups.  You could always define a macro...

* Delete the .newsrc lines of newsgroups that you really and truly never want
  to see again.  Rn will not put them back in.  Unfortunately, some versions
  of readnews will, but at least the line will start out short again.

* Write some kind of filter to fix your .newsrc periodically.

* Don't use rn any more. (*sob*)

If your expire is working right, you should almost never have this problem.
The two longest lines in my .newsrc stay at about 800 bytes long.  I haven't
read either of the newsgroups in many months.

I hope you find this explication satisfactory.

Larry Wall
sdcrdcf!lwall

lwall@sdcrdcf.UUCP (Larry Wall) (07/29/86)

In article <1150@umd5> zben@umd5.umd.edu.UUCP (Ben Cranston) writes:
> My personal opinion is that if I resubscribe it would be OK for rn to show
> me ALL the remaining messages in that group, to jog my memory, so it would be
> ok by me to not ever mark items read within unsubscribed groups.  Others may
> argue with this though.  Larry, are you listening?

Yes, by some strange happenstance.  The problem with this approach is that
it does nothing about newsgroups that are subscribed to but rarely read.
There are a lot of people who read news like I do.  I am one of these
terribly unfortunate people who can persuade themselves to be interested in
almost anything.  (This is to be construed as a bug, not an feature.)
In particular, my .newsrc subscribes to many more newsgroups than
I ever get a chance to read.  I just periodically promote or demote various
newsgroups, and read as far as I can through my .newsrc before my ordinary
work comes crashing in on me.  My two newsgroups with the longest .newsrc
lines are net.politics and net.women, about 800 bytes each.  I am interested
in both politics and women.  I have not unsubscribed to either group.
I also haven't read either group in months.  (Some would say I haven't read
my mail in months, which isn't true.  I just haven't answered most of it yet.)

Anyway, back to the subject.  What you're really asking for is two levels of
unsubscription: permanent and temporary.  You can get this semantics by
deleting the lines of permanently unsubscribed newsgroups from your .newsrc.
Rn will not add them back.  (Readnews may, but that's another story.)

Larry Wall
sdcrdcf!lwall