🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #56591

[slrn] Bug: sorting methods 4 and 6 are broken

#56591
From: Thomas Schultz
Date: Sun, 09 Jan 2000 00:00
73 lines
2722 bytes
Hi,

I am surprised that this has not been noticed earlier, but when
playing with different sorting methods, I noticed that methods 4 and 6
("sort by score" and "sort by score, then subject") produce wrong
results (at least with 0.9.6.2, I did not check when this bug was
introduced).

This is due to the fact that header_score_cmp() in art.c compares the
"thread_score" members of the articles. However, these are only set
properly when sort_threads() is called, not in non-threaded mode. This
can be fixed by adding an appropriate line in sort_by_server_number().
When looking at the code, I also noticed that (unless I'm mistaken)
slrn will do unneccessary work when sorting "by score, then subject".
I also changed this to what I think is a faster alternative. Here is
the patch:

#v+

diff -cr slrn-0.9.6.2.orig/src/art.c slrn-0.9.6.2/src/art.c
*** slrn-0.9.6.2.orig/src/art.c	Mon Jan  3 14:40:41 2000
--- slrn-0.9.6.2/src/art.c	Sun Jan  9 17:26:33 2000
***************
*** 3879,3884 ****
--- 3879,3887 ----
  	h->num_children = 0;
  	h->flags &= ~(HEADER_HIDDEN | ALL_THREAD_FLAGS);
  	h->sister = h->parent = h->child = NULL;
+ #if SLRN_HAS_SORT_BY_SCORE
+ 	h->thread_score = h->score;
+ #endif
  	h = next;
       }
     
***************
*** 3929,3943 ****
     else
       sort_by_threads ();
     
     if (Slrn_Sorting_Mode & SORT_BY_DATE)
       sort_by_date ();
     else if (Slrn_Sorting_Mode & SORT_BY_SUBJECT)
       sort_by_subject ();
- 
- #if SLRN_HAS_SORT_BY_SCORE
-    if (Slrn_Sorting_Mode & SORT_BY_SCORE)
-      sort_by_score ();
- #endif
  }
  
  /*}}}*/
--- 3932,3946 ----
     else
       sort_by_threads ();
     
+ #if SLRN_HAS_SORT_BY_SCORE
+    if (Slrn_Sorting_Mode & SORT_BY_SCORE)
+      sort_by_score ();
+    else
+ #endif   
     if (Slrn_Sorting_Mode & SORT_BY_DATE)
       sort_by_date ();
     else if (Slrn_Sorting_Mode & SORT_BY_SUBJECT)
       sort_by_subject ();
  }
  
  /*}}}*/

#v-
-- 
Thomas Schultz <tststs@gmx.de>

Technical Details
Message-ID: <slrn87hekd.lp.tststs@starflower.tststs.ddns.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <slrn87hekd.lp.tststs@starflower.tststs.ddns.org>
Subject: [slrn] Bug: sorting methods 4 and 6 are broken
Date: Sun, 09 Jan 2000 00:00:00 +0000
From: tststs@gmx.de (Thomas Schultz)
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
X-Deja-AN: 570406013
X-Server-Date: 9 Jan 2000 17:19:36 GMT
X-Complaints-To: abuse@cityweb.de
Organization: Cityweb News Service
User-Agent: slrn/0.9.6.2+ (Linux)
NNTP-Posting-Date: 9 Jan 2000 17:21:12 GMT
Newsgroups: news.software.readers