[comp.emacs] Some system's fatal Gnews bug: a fix + other stuff

weemba@garnet (Matthew P Wiener) (02/20/88)

Gnews was hanging on a friend who tried it on an Alliant FX/8 running
their 4.2 derived OS.  The cause and cure follow.

My internal handling of NNTP goes through two side buffers, *gnews*nntp*
and *gnews*nntp*index*.  The code as written assumes that there are extra
trailing ^M's embedded at the end of every line.  This is now seen to be
a bad assumption--Gnews (and Emacs) will go into an infinite loop waiting
for certain ^M's to show up on machines that politely strip the ^M's off
ahead of time.

Here is a diff for gnewsutils.el that apparently works.  So far it hasn't
caused any problems for my friend or me.

335c335
<   (format "^502 %s NNTP server can't talk to you.  Goodbye.\r?\n\n\
---
>   (format "^502 %s NNTP server can't talk to you.  Goodbye.\r\n\n\
425c426
<       (if (looking-at "^.*\r?\n")
---
>       (if (looking-at "^.*\r\n")
511c512
<     (if (looking-at "^\\(20[01]\\|211\\|423\\).*\r?$")
---
>     (if (looking-at "^\\(20[01]\\|211\\|423\\).*\r")
519c520
< 		(re-search-forward "^221 \\([0-9]*\\).*\r?$" nil t)
---
> 		(re-search-forward "^221 \\([0-9]*\\).*\r" nil t)
523c524
< 		(re-search-forward "^\\.\r?$" nil t)
---
> 		(re-search-forward "^\\.\r" nil t)
530c531
< 				  (concat "^" (car i) ": *\\([^\r]*\\)") q t)
---
> 				  (concat "^" (car i) ": *\\(.*\\)\r") q t)
542c543
< 	    (if (looking-at "^\\([^:]*\\): *\\(.*\\)\r?$")
---
> 	    (if (looking-at "^\\([^:]*\\): *\\(.*\\)\r")

I also ran into some minor little bugs; for now I'll just describe the
fix, since they're very low priority: in article-rot13-restart, change
the group-rot13 call to an article-rot13 call; in group-first change the
(article-get article-first) call to (article-get article-first nil t).

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

PS-I should have mentioned with my announcement that if you expect to
run Gnews, you better have a BSD-like OS: specifically, you need sock-
ets. That's how NNTP is implemented, so I'll just hope that everyone
with SysV just assumed that I was blathering as usual.

PPS-And I should also have mentioned in the README that I prefer bug
fixes to come as entire defuns, not as patches, and I'll usually send
out fixes along the way as whole functions; you can install these in
the gnewsinit.el file I suggested in the README.