[comp.emacs] Nasty Gnews 1.9 bug

weemba@garnet.berkeley.edu (Matthew P Wiener) (08/09/88)

There have been several reports (four now) of an extremely serious bug
in the new newsgroup adding code: it can wipe out your .gnewsrc data.
No one has been able to duplicate it for me, I can't duplicate it, and
I haven't the foggiest idea of what is going wrong.  Nothing in the code
really looks overtly suspicious.  This new-newsgroup code was present
in 1.8, but I got no complaints then.  (To fool Gnews into thinking some
newsgroup is "new", make sure it isn't in .gnewsrc and .gnewsrc.all.)

Briefly, you're supposed to type M-g to run news-new, ? to name expand
to see the list of new newsgroups, and then loop adding groups using
C-g to get back to normal news reading.  Except sometimes there are
suddenly no groups to read.

So, if you realize you've wiped out your .gnewsrc, then "x" out of Gnews,
and the backup copy .gnewsrc.old will be put back.  Or, if you "q", your
.gnewsrc.old will still be what you want.  You can restart from *.old
with M-- M-x gnews: NOT M-0 M-x gnews AS I PUT IN THE 1st MANUAL DRAFT!

Perhaps you should immediately visit .gnewsrc.old in some buffer and
make an extra copy for peace of mind.

I've rewritten news-add, the part that loops, below.  (This code is
already present in the European copy of 1.9.)  Adding a newsgroup is
simpler and maybe more robust, a condition-case for the C-g is added,
and the immediate write-out to the .gnewsrc.new checkpoint file is
omitted.  I suspect that condition-case-ing is the real fix.

(defun news-add (new msg pred)
  "Add newsgroups from the list NEW; when done, show in the
minibuffer the message MSG.  PRED is a newsgroup name restriction
filter: only names that PRED returns non-nil on are offered."
  (condition-case nil
      (progn
	(while new
	  (let* ((add (group-name-read "Add newsgroup: " new pred))
		 (aft (group-name-read (format "place %s after: " add)
				       group-roster 'news-all))
		 (tail (memq (assoc aft group-roster) group-roster)))
	    (setcdr tail (cons (list add t) (cdr tail)))
	    (setq gnews-rc-dangle t new (delq (assoc add new) new))))
	(message msg)
	(sit-for 1))
    (quit))
  (news-at))

ucbvax!garnet!weemba	Matthew P Wiener/Brahms Gang/Berkeley CA 94720