🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
2 messages
2 total messages Started by Stefan Scholl Fri, 30 Oct 1998 00:00
[SLRN] Is this the ranges-bug?
#44134
Author: Stefan Scholl
Date: Fri, 30 Oct 1998 00:00
142 lines
4656 bytes
I've found a bug in slrn, which nobody cares for. According to
News/My_Posts this bug is 1 year old. slrn sometimes rereads a
complete newsgroup and marks all articles as unread.


After getting no answer from de.comm.software.newsreader and
news.software.readers I've made a small kludge to get rid of this
problem: a perl script call fixnewsrc4slrn, which fixes the holes
in .jnewsrc after each expire run.


After installing the newest versions of slang and slrn I've
deactivated the kludge. But the bug is still there.


OK, for the source ...


In group.c there's a function called
group_sync_group_with_server().

At the end you can see:


   r = &g->range;
   if (r->next != NULL)
     {
        if (r->next->min <= r->min)
          r->next->min = 1;

        n = r->max;
        while (r->next != NULL)
          {
             r = r->next;
             n -= r->max - r->min + 1;
          }
        if (n < 0) n = 0;
        if (n > max_available) n = max_available;
        g->unread = n;
     }

   return 0;
}

"r->next->min = 1;" sets the lower mark of the first range of
read articles (the first node of Slrn_Range_Type in a
Slrn_Group_Type is the range of articles the server has) to 1. If
you take a look at your .jnewsrc, this is correct so far
("news.software.readers: 1-9301").

But after that it wants to compute the number of unread articles
in the group. Becaus the first min is 1, the computation "n -=
r->max - r->min + 1;" leads to a negative number.

  ==> if (n < 0) n = 0;

And the number of unread articles gets 0.

In slrn_group_select_group() (the function which calls
group_sync_group_with_server()) n now gets max_available (which
is Slrn_Group_Current_Group->range.max -
Slrn_Group_Current_Group->range.min + 1). Because of the
following:


   n = Slrn_Group_Current_Group->unread;
[...]
   if ((prefix & 1) || (n == 0))
     n = max_available;

(I enter the group with no prefix.)

A bit later n could became 0, but unfortunatly
Slrn_Group_Current_Group->unread is 0


   else if ((0 == (prefix & 1)) && (Slrn_Group_Current_Group->unread != 0))
     n = 0;

   ret = slrn_select_article_mode (Slrn_Group_Current_Group, n,
                                   ((prefix & 2) == 0));


So, n remains max_available and slrn_select_article_mode gets
called with an value for all, which is > 0:

[art.c]


/* If all > 0, get last 'all' headers from server independent of whether
 *             they have been read or not.
 * If all < 0, and this is not the first time this group has been accessed,
 *             either during this session or during previous sessions, get
 *             that last 'all' UNREAD articles.
 * Otherwise,  fetch ALL UNREAD headers from the server.
 */
int slrn_select_article_mode (Slrn_Group_Type *g, int all, int score) /*{{{*/
{
[...]


We want to get all the UNREAD headers from the server. But do to
the small unread-computation-bug in
group_sync_group_with_server() we get _all_ headers.



I don't know why these articles are marked es unread. Perhaps I
should mention that in get_headers() the following line


                  slrn_message_now ("Headers Received and Scored: %3d/%-3d, Killed: %u, High: %u, Low: %u",
                                    num, total,
                                    Number_Killed, Number_High_Scored, Number_Low_Scored);


has wrong numbers in num and total. num gets higher than total
while reading the headers.





I hope everything is correct. I try to fix the bug in group.c:


--- group.c.orig	Fri Oct 30 15:12:50 1998
+++ group.c	Fri Oct 30 15:14:10 1998
@@ -347,8 +347,9 @@
 	if (n > max_available) n = max_available;
 	g->unread = n;
 
-	if (g->range.next->min <= g->range.min)
-	  g->range.next->min = 1;
+	r = &g->range;
+	if (r->next->min <= r->min)
+	  r->next->min = 1;
      }
    
    return 0;

Re: [SLRN] Is this the ranges-bug?
#44214
Author: Stefan Scholl
Date: Sun, 01 Nov 1998 00:00
3 lines
679 bytes
No, it isn't.

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