[comp.emacs] Gnews loses track of articles less than 1000

gnulists@WHEATIES.AI.MIT.EDU (03/28/89)

   Has anybody run into a problem with Gnews when the
   article numbers go over 1000? It seems to lose track of
   all the articles less than 1000 whether you've read them
   or not. On our system, the number of articles in
   comp.emacs just went over 1000 and here's what I found:

   The corresponding line in my .gnewsrc correctly shows the
   range of emacs articles that I have read:
("comp.emacs" t (1 . 995))

   In the comp.emacs spool directory (we're not using nntp)
   there are articles from 629 to 1013, and the active file (that
   tracks available articles) correctly shows:
comp.emacs 01013 00629 y

   Now when I go into gnews and it proffers up comp.emacs I get:
comp.emacs {14} [ynp] ?

   It should be:
comp.emacs {18} [ynp] ?

   Then when I start reading the articles, the status line shows:
--- Gnews: comp.emacs 1000/1013

   It should be:
--- Gnews: comp.emacs 996/1013

   Gnews seems to think that the lowest available article is
   1000... when I try to force it to show article 999 it says:
article 999 is out of range (1000-1013).

   Incidently, this may have happened when we hit 100 
   and I just didn't notice. And if that theory's true, 
   the bug won't surface again for comp.emacs until we 
   hit 10000...?

   Could it be some problem that exists only for Gnews
   running in spool (non-nntp) mode?

   We're running Gnews 2.0 (with patches) on a Sun with 
   BSD UNIX 4.2 (Sun OS 3.5).


Eric Boutilier               UUCP: uunet!fed!m1edb00
(202) 452-2734           INTERNET: m1edb00@fed.frb.gov

schmidt@cadlab.uucp (Michael Schmidt) (03/31/89)

In article <8903281229.AA26172@wheat-chex.ai.mit.edu>, gnulists@WHEATIES writes:
>
>   Then when I start reading the articles, the status line shows:
>--- Gnews: comp.emacs 1000/1013
>
>   It should be:
>--- Gnews: comp.emacs 996/1013

This is amuzing. My modeline is just at this moment 

--- Gnews: comp.emacs 988/1009 .....

So it appears to work for me (with Gnews 2.0).
-- 
    Michael Schmidt, CADLAB / FB 17, Uni-GH Paderborn, Bahnhofstr. 32,
                     D-4790 Paderborn, West Germany
Mail:   schmidt@cadlab.UUCP         or          schmidt%cadlab@uunet.uu.net
	"AMOK - Im Tiefflug ueber Deutschland"		HRK

cwitty@csli.Stanford.EDU (Carl Witty) (04/01/89)

In article <8903281229.AA26172@wheat-chex.ai.mit.edu>, gnulists@WHEATIES writes:
>
>   Has anybody run into a problem with Gnews when the
>   article numbers go over 1000? It seems to lose track of
>   all the articles less than 1000 whether you've read them
>   or not. On our system, the number of articles in
>   comp.emacs just went over 1000 and here's what I found:
...
>   Incidently, this may have happened when we hit 100 
>   and I just didn't notice. And if that theory's true, 
>   the bug won't surface again for comp.emacs until we 
>   hit 10000...?
That's right.

>   Could it be some problem that exists only for Gnews
>   running in spool (non-nntp) mode?
That's right.

>Eric Boutilier               UUCP: uunet!fed!m1edb00
>(202) 452-2734           INTERNET: m1edb00@fed.frb.gov

I just tracked down this bug, and here's what I found:

The spool code gets the list of articles from "ls", which sorts by
lexicographic order rather than numerically.  At one point in the
code, the variable gnews-spool-group-list holds a list, which might
look like (1000 1001 1002 998 999).  It then calls
(sort gnews-spool-group-list '<), which destructively sorts the list
and returns the sorted list.  However, it does not set
gnews-spool-group-list to this sorted list (given the way lisp works,
it can't.)  Thus gnews-spool-group-list becomes (1000 1001 1002).

To fix this, find gnews-spool-exec-group in Spool.el, and change the
line (sort gnews-spool-group-list '<) to
(setq gnews-spool-group-list (sort gnews-spool-group-list '<)).

I've included the modified version of gnews-spool-exec-group after my
signature.

Carl Witty
cwitty@csli.Stanford.EDU


(defun gnews-spool-exec-group (gp)
  "Fake an NNTP group command."
  (let ((dir (gnews-spool-dir gp)) c f l)
    (if (and (file-readable-p dir)
	     (car (file-attributes dir)))
	(gnews-string-as-buffer "" nil
	  (setq gnews-server-article nil)
	  (setq gnews-server-group gp)
	  (call-process "ls" nil t nil dir)
	  (goto-char 1)
	  (insert "(setq gnews-spool-group-list (gnews-spool-preen '(")
	  (goto-char (point-max))
	  (insert ")))")
	  (eval-current-buffer)
	  (if (null gnews-spool-group-list)
	      (gnews-spool-info "211 0 0 0" gp)	; nothing there
	    (setq gnews-spool-group-list (sort gnews-spool-group-list '<))
	    ;; added setq to line above, 3/31/89, Carl Witty
	    (setq gnews-spool-group-tsil (reverse gnews-spool-group-list))
	    (setq c (length gnews-spool-group-list))
	    (setq f (car gnews-spool-group-list))
	    (setq l (car gnews-spool-group-tsil))
	    (gnews-spool-info "211" c f l gp)
	    t))
      (gnews-spool-info "411 Invalid group name.")
      nil)))
-- 
Carl Witty
cwitty@csli.stanford.edu