GNU bug report logs - #19583
nntp-open-server: wrong buffer for nnoo-change-server; breaks url-news

Previous Next

Packages: emacs, gnus;

Reported by: Ivan Shmakov <ivan <at> siamics.net>

Date: Tue, 13 Jan 2015 16:13:01 UTC

Severity: normal

Tags: patch

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ivan Shmakov <ivan <at> siamics.net>
To: 19583 <at> debbugs.gnu.org
Subject: bug#19583: nntp-open-server: wrong buffer for nnoo-change-server; breaks url-news 
Date: Tue, 13 Jan 2015 16:12:25 +0000
[Message part 1 (text/plain, inline)]
Package: emacs
Tags: patch

	As of 88bc8332eb14 (2015-01-07 13:51:41 +0000), nntp-open-server
	appears to call nnoo-change-server without switching to
	nntp-server-buffer first, thus installing the local variables in
	the whatever buffer current at the time it’s called.  One of
	these variables is nntp-port-number, which means that when
	open-protocol-stream is called in the proper buffer later, it
	gets 0 for the port number to connect, and thus fails.

	This affects url-retrieve-synchronously; consider, e. g.:

(let ((url-news-server "news.gmane.org"))
  (url-retrieve-synchronously "news:87y4p9y2cq.fsf <at> violet.siamics.net"))

	Please thus consider the patch MIMEd.

	* lisp/gnus/nntp.el (nntp-open-server): Switch to
	nntp-server-buffer temporarily while calling nnoo-change-server.

	To note is that to get url-retrieve-synchronously working in
	this case, I had to comment out the :starttls-function argument
	to open-protocol-stream in nntp-open-connection (an issue I
	haven’t investigated much as of yet, but which may be related to
	the use of a self-signed certificate), /and/ define the default
	port for the ‘news’ URI scheme, like the (untested) patch MIMEd.

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A
[Message part 2 (text/diff, inline)]
--- a/lisp/gnus/nntp.el	2015-01-01 22:26:41 +0000
+++ b/lisp/gnus/nntp.el
@@ -1066,7 +1066,8 @@ deffoo nntp-open-server (server &optional defs connectionless)
       (setq defs (cons (list 'nntp-port-number (car defs)) (cdr defs))))
     (unless (assq 'nntp-address defs)
       (setq defs (append defs (list (list 'nntp-address server)))))
-    (nnoo-change-server 'nntp server defs)
+    (with-current-buffer nntp-server-buffer
+      (nnoo-change-server 'nntp server defs))
     (if connectionless
 	t
       (or (nntp-find-connection nntp-server-buffer)
[Message part 3 (text/diff, inline)]
--- a/lisp/gnus/nntp.el
+++ b/lisp/gnus/nntp.el	2015-01-13 15:48:37 +0000
@@ -1282,11 +1283,12 @@ defun nntp-open-connection (buffer)
 		     :end-of-command "^\\([2345]\\|[.]\\).*\n"
 		     :capability-command "HELP\r\n"
 		     :success "^3"
-		     :starttls-function
-		     (lambda (capabilities)
-		       (if (not (string-match "STARTTLS" capabilities))
-			   nil
-			 "STARTTLS\r\n")))
+		     ; :starttls-function
+		     ; (lambda (capabilities)
+		     ;   (if (not (string-match "STARTTLS" capabilities))
+		     ; 	   nil
+		     ; 	 "STARTTLS\r\n"))
+		     )
 		  (funcall nntp-open-connection-function pbuffer)))
 	    (error
 	     (nnheader-report 'nntp ">>> %s" err))
[Message part 4 (text/diff, inline)]
--- a/lisp/url/url-news.el	2015-01-01 22:26:41 +0000
+++ b/lisp/url/url-news.el	2015-01-13 16:05:25 +0000
@@ -28,6 +28,9 @@
 (autoload 'url-warn "url")
 (autoload 'gnus-group-read-ephemeral-group "gnus-group")
 
+(defconst url-news-default-port 119 "Default NNTP port.")
+(defconst url-snews-default-port 563 "Default NNTPS port.")
+
 ;; Unused.
 ;;; (defgroup url-news nil
 ;;;   "News related options."

This bug report was last modified 8 years and 116 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.