Gnus development mailing list
 help / color / mirror / Atom feed
* Setting gnus-check-new-newsgroups to nil --> gnus-secondary-select-methods ignored
@ 2010-07-06 20:51 Adam Sjøgren
  2010-07-06 20:58 ` Adam Sjøgren
  0 siblings, 1 reply; 8+ messages in thread
From: Adam Sjøgren @ 2010-07-06 20:51 UTC (permalink / raw)
  To: ding

If you, as I do, set gnus-check-new-newsgroups to nil, then Gnus will
happily ignore any configuration you have added to servers in
gnus-secondary-select-methods.

So putting this in your Gnus:

  (setq gnus-check-new-newsgroups nil)
  (setq gnus-secondary-select-methods
        '(
          (nntp "news.gmane.org"
                (nntp-open-connection-function nntp-open-tls-stream)
                (nntp-port-number 563)
                (nntp-address "snews.gmane.org"))
          ))

will make Gnus connect to news.gmane.org on port 119(!)

If you let gnus-check-new-newsgroups have its default value, then the
configuration in gnus-secondary-select-methods is used, and in the above
case the connection will be encrypted on port 563 to snews.gmane.org.

I am guessing that what happens when gnus-check-new-newsgroups isn't
nil, is that somehow the gnus-server-method-cache is initialized
"correctly", while it otherwise gets initialized "wrong", mistaking
secondary-select-method servers for foreign servers.

Do I make any sense at all?


  Best regards,

    Adam

-- 
 "My internal clock is on Tokyo time."                        Adam Sjøgren
                                                         asjo@koldfront.dk




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Setting gnus-check-new-newsgroups to nil --> gnus-secondary-select-methods ignored
  2010-07-06 20:51 Setting gnus-check-new-newsgroups to nil --> gnus-secondary-select-methods ignored Adam Sjøgren
@ 2010-07-06 20:58 ` Adam Sjøgren
  2010-07-06 23:57   ` [PATCH] Avoid opening secondary select methods as foreign servers Adam Sjøgren
  0 siblings, 1 reply; 8+ messages in thread
From: Adam Sjøgren @ 2010-07-06 20:58 UTC (permalink / raw)
  To: ding

Now that I am digging in this anyway, I am looking at the value of
gnus-opened-servers (formatted):

  Value: (((nnrss "") ok) 
         ((nntp "news.gmane.org") ok)
         ((nntp "news.sslug.dk") ok)
         ((nntp "news.gmane.org"
           (nntp-record-commands t) 
           (nntp-open-connection-function nntp-open-tls-stream)
           (nntp-port-number 563)
           (nntp-address "snews.gmane.org")) ok)
         ((nnml "") ok)
         ((nnml "archive"
           (nnml-directory "~/Mail/archive")
           (nnml-active-file "~/Mail/archive/active")
           (nnml-get-new-mail nil)
           (nnml-inhibit-expiry t)) ok)
         ((nntp "news.koldfront.local" (nntp-address "news.koldfront.dk")) ok))

nnrss, nnml and archive looks ok. news.koldfront.local is my primary
server (gnus-select-method), that looks ok. news.sslug.dk is a foreign
server, that looks ok.

But what is up with news.gmane.org appearing twice? It is there as a
foreign server (the empty one) and as a secondary-select-method (the one
with configuration after it).

The first one surely shouldn't be there?!

(This is with the default value (ask-server) for gnus-check-new-newsgroup)


  Best regards,

    Adam

-- 
 "My internal clock is on Tokyo time."                        Adam Sjøgren
                                                         asjo@koldfront.dk




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] Avoid opening secondary select methods as foreign servers
  2010-07-06 20:58 ` Adam Sjøgren
@ 2010-07-06 23:57   ` Adam Sjøgren
  2010-07-17 20:13     ` Adam Sjøgren
  0 siblings, 1 reply; 8+ messages in thread
From: Adam Sjøgren @ 2010-07-06 23:57 UTC (permalink / raw)
  To: ding

This is probably the wrong way to fix the problem - which is that
Gnus opens servers defined in secondary-select-methods twice, once
with all the configuration given and once as a foreign server with
none of the configuration given.

The easy way to see the symptom is to go to the *Server* buffer where
servers will be listed twice, or to check the value of the
gnus-opened-servers variable, which holds the same server twice.

This patch changes gnus-secondary-select-method-p to only look at
the first two elements in the list (nntp and "news.server.org"),
because the incoming argument never has the entire list.

gnus-check-server is then changed to call gnus-secondary-select-method-p
and if the server in question is in secondary-select-methods, the
configuration from there is used.
---
 lisp/gnus-int.el |    3 +++
 lisp/gnus.el     |    6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/gnus-int.el b/lisp/gnus-int.el
index a079591..94fb6c7 100644
--- a/lisp/gnus-int.el
+++ b/lisp/gnus-int.el
@@ -169,6 +169,9 @@ If it is down, start it up (again)."
     ;; Transform virtual server names into select methods.
     (when (stringp method)
       (setq method (gnus-server-to-method method)))
+    ;; Get configuration if the server is a secondary-select-method.
+    (when (gnus-secondary-method-p method)
+      (setq method (car (gnus-secondary-method-p method))))
     (if (gnus-server-opened method)
 	;; The stream is already opened.
 	t
diff --git a/lisp/gnus.el b/lisp/gnus.el
index 281b9ab..c3a442a 100644
--- a/lisp/gnus.el
+++ b/lisp/gnus.el
@@ -3830,9 +3830,9 @@ You should probably use `gnus-find-method-for-group' instead."
   (let ((methods gnus-secondary-select-methods)
 	(gmethod (inline (gnus-server-get-method nil method))))
     (while (and methods
-		(not (gnus-method-equal
-		      (inline (gnus-server-get-method nil (car methods)))
-		      gmethod)))
+		(not (and
+                      (equal (caar methods)  (car gmethod))
+                      (equal (cadar methods) (cadr gmethod)))))
       (setq methods (cdr methods)))
     methods))
 
-- 
1.7.1


I am sure there are better solutions.

It is quite confusing to me how sometimes servers are referred to as
"nntp+news.server.org", sometimes as (nttp "news.server.org") and
sometimes as (nntp "news.server.org" (var 1) (var 2) ...).

Finding the correct place to fix the translation/comparison of these is
far from obvious to me.


  Best regards,

    Adam

-- 
 "My internal clock is on Tokyo time."                        Adam Sjøgren
                                                         asjo@koldfront.dk




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Avoid opening secondary select methods as foreign servers
  2010-07-06 23:57   ` [PATCH] Avoid opening secondary select methods as foreign servers Adam Sjøgren
@ 2010-07-17 20:13     ` Adam Sjøgren
  2010-08-03 19:10       ` Ted Zlatanov
  0 siblings, 1 reply; 8+ messages in thread
From: Adam Sjøgren @ 2010-07-17 20:13 UTC (permalink / raw)
  To: ding

On Wed, 07 Jul 2010 01:57:11 +0200, Adam wrote:

> This patch changes gnus-secondary-select-method-p to only look at
> the first two elements in the list (nntp and "news.server.org"),
> because the incoming argument never has the entire list.

> gnus-check-server is then changed to call gnus-secondary-select-method-p
> and if the server in question is in secondary-select-methods, the
> configuration from there is used.

> ---
>  lisp/gnus-int.el |    3 +++
>  lisp/gnus.el     |    6 +++---
>  2 files changed, 6 insertions(+), 3 deletions(-)I

I get the feeling that I've become Warnocked¹ here.

Anyone want to comment on the approach in the patch?

I have been using it since I posted it, to no ill effect.

I did have "nntp:news.gmane.org" for some groups in my .newsrc.eld, and
(nntp "news.gmange.org") for others; changing the former to the latter
stopped Gnus complaining about posting to possible unknown groups.


  Best regards,

    Adam


¹ http://en.wikipedia.org/wiki/Warnocked

-- 
 "It is just what they are gathered here to do, that I        Adam Sjøgren
  find so ineffably, horrificly repugnant."              asjo@koldfront.dk




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Avoid opening secondary select methods as foreign servers
  2010-07-17 20:13     ` Adam Sjøgren
@ 2010-08-03 19:10       ` Ted Zlatanov
  2010-08-08 13:59         ` Adam Sjøgren
  0 siblings, 1 reply; 8+ messages in thread
From: Ted Zlatanov @ 2010-08-03 19:10 UTC (permalink / raw)
  To: ding

On Sat, 17 Jul 2010 22:13:02 +0200 asjo@koldfront.dk (Adam Sjøgren) wrote: 

AS> On Wed, 07 Jul 2010 01:57:11 +0200, Adam wrote:
>> This patch changes gnus-secondary-select-method-p to only look at
>> the first two elements in the list (nntp and "news.server.org"),
>> because the incoming argument never has the entire list.

>> gnus-check-server is then changed to call gnus-secondary-select-method-p
>> and if the server in question is in secondary-select-methods, the
>> configuration from there is used.

>> ---
>> lisp/gnus-int.el |    3 +++
>> lisp/gnus.el     |    6 +++---
>> 2 files changed, 6 insertions(+), 3 deletions(-)I

AS> I get the feeling that I've become Warnocked¹ here.

AS> Anyone want to comment on the approach in the patch?

AS> I have been using it since I posted it, to no ill effect.

AS> I did have "nntp:news.gmane.org" for some groups in my .newsrc.eld, and
AS> (nntp "news.gmange.org") for others; changing the former to the latter
AS> stopped Gnus complaining about posting to possible unknown groups.

It seems OK to me but I haven't seen the problem you are fixing so I
can't verify it works.  Has anyone?  Can you explan how to trigger the bug?

Ted




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Avoid opening secondary select methods as foreign servers
  2010-08-03 19:10       ` Ted Zlatanov
@ 2010-08-08 13:59         ` Adam Sjøgren
  2010-08-08 14:14           ` Adam Sjøgren
  0 siblings, 1 reply; 8+ messages in thread
From: Adam Sjøgren @ 2010-08-08 13:59 UTC (permalink / raw)
  To: ding

On Tue, 03 Aug 2010 14:10:47 -0500, Ted wrote:

> It seems OK to me but I haven't seen the problem you are fixing so I
> can't verify it works. Has anyone? Can you explan how to trigger the
> bug?

This turned out to be harder than I expected. My newsgroups and
configuration have developed over time...

However, here is the best recipe I could come up with:

 a) Start with an empty setup - no .newsrc*, Mail/ News/

 b) Add a .gnus file with this content:

      ; No primary server:
      (setq gnus-select-method '(nnnil))

    and start Gnus.

  c) Use B to browse news.gmane.org and subscribe to three newsgroups.

  d) Quit Gnus and emacs, and change .gnus to this:

      ; No primary server:
      (setq gnus-select-method '(nnnil))

      ; Access news.gmane.org via nntps:
      (setq gnus-secondary-select-methods
              '((nntp "news.gmane.org"
                      (nntp-record-commands t)
                      (nntp-open-connection-function nntp-open-tls-stream)
                      (nntp-port-number 563)
                      (nntp-address "snews.gmane.org"))))

      I.e. decide to go from a foreign server to a secondary one.

  e) Start emacs and Gnus. If you go to the server buffer, you'll see:

       {nnfolder:archive} (closed)
       {nndoc:gnus-help} (opened)
       {nntp:news.gmane.org} (denied)
       {nntp:news.gmane.org} (denied)

      And the gnus-opened-servers variable looks like this:

       Value: (((nndoc "gnus-help" (nndoc-address
       "/home/test/elisp/gnus/etc/gnus-tut.txt") (nndoc-article-type
       mbox)) ok) ((nntp "news.gmane.org") denied) ((nntp
       "news.gmane.org" (nntp-record-commands t)
       (nntp-open-connection-function nntp-open-tls-stream)
       (nntp-port-number 563) (nntp-address "snews.gmane.org")) denied))

      TWO news.gmane.org entries, one with and one without the
      configuration.

A couple of weird things: In my usual setup, the news.gmane.org server
without configuration is NOT denied, it just connects unencrypted.

I had to do the foreign server dance to get .newsrc.eld to contain
(nntp "news.gmane.org") instead of "nntp:gmane.org" - the latter is used
if the server is defined as a secondary method when subscribing, the
former if the server is foreign when subscribing.

I may be able to simply solve my problem by doing a search and replace
on (nntp "news.gmane.org") to "nntp:news.gmane.org" in my .newsrc.eld,
and maybe that is the correct solution...

I think I just confused myself.


  Best regards,

    Adam

-- 
 "May the force be...                                         Adam Sjøgren
  ... equal to mass · acceleration"                      asjo@koldfront.dk




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Avoid opening secondary select methods as foreign servers
  2010-08-08 13:59         ` Adam Sjøgren
@ 2010-08-08 14:14           ` Adam Sjøgren
  2010-08-09 14:12             ` Ted Zlatanov
  0 siblings, 1 reply; 8+ messages in thread
From: Adam Sjøgren @ 2010-08-08 14:14 UTC (permalink / raw)
  To: ding

On Sun, 08 Aug 2010 15:59:14 +0200, Adam wrote:

> I may be able to simply solve my problem by doing a search and replace
> on (nntp "news.gmane.org") to "nntp:news.gmane.org" in my .newsrc.eld,
> and maybe that is the correct solution...

> I think I just confused myself.

Yeah, doing so worked.

I guess, now, that in .newsrc.eld (nntp "news.gmane.org") means "the
foreign server defined by this", while "nntp:news.gmane.org" means "the
secondary server named news.gmane.org".

And when I changed my access to news.gmane.org from being as a foreign
server to a secondary method (waaaaay back), I didn't update .newsrc.eld
to reflect that (didn't know any better), thus causing me the problem I
tried to fix without understanding why I had that problem.

Thanks for kicking me in the right direction; I'm pretty sure, now, that
the patch I posted shouldn't be applied. Case closed :-)


  Best regards,

    Adam

-- 
 "May the force be...                                         Adam Sjøgren
  ... equal to mass · acceleration"                      asjo@koldfront.dk




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Avoid opening secondary select methods as foreign servers
  2010-08-08 14:14           ` Adam Sjøgren
@ 2010-08-09 14:12             ` Ted Zlatanov
  0 siblings, 0 replies; 8+ messages in thread
From: Ted Zlatanov @ 2010-08-09 14:12 UTC (permalink / raw)
  To: ding

On Sun, 08 Aug 2010 16:14:29 +0200 asjo@koldfront.dk (Adam Sjøgren) wrote: 

AS> On Sun, 08 Aug 2010 15:59:14 +0200, Adam wrote:
>> I may be able to simply solve my problem by doing a search and replace
>> on (nntp "news.gmane.org") to "nntp:news.gmane.org" in my .newsrc.eld,
>> and maybe that is the correct solution...

>> I think I just confused myself.

AS> Yeah, doing so worked.

AS> I guess, now, that in .newsrc.eld (nntp "news.gmane.org") means "the
AS> foreign server defined by this", while "nntp:news.gmane.org" means "the
AS> secondary server named news.gmane.org".

AS> And when I changed my access to news.gmane.org from being as a foreign
AS> server to a secondary method (waaaaay back), I didn't update .newsrc.eld
AS> to reflect that (didn't know any better), thus causing me the problem I
AS> tried to fix without understanding why I had that problem.

AS> Thanks for kicking me in the right direction; I'm pretty sure, now, that
AS> the patch I posted shouldn't be applied. Case closed :-)

Thanks for explaining.  I didn't know this implementation detail either,
assuming the two forms were equivalent :)

Ted




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-08-09 14:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-06 20:51 Setting gnus-check-new-newsgroups to nil --> gnus-secondary-select-methods ignored Adam Sjøgren
2010-07-06 20:58 ` Adam Sjøgren
2010-07-06 23:57   ` [PATCH] Avoid opening secondary select methods as foreign servers Adam Sjøgren
2010-07-17 20:13     ` Adam Sjøgren
2010-08-03 19:10       ` Ted Zlatanov
2010-08-08 13:59         ` Adam Sjøgren
2010-08-08 14:14           ` Adam Sjøgren
2010-08-09 14:12             ` Ted Zlatanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).