Subject: Re: bug#74857: 30.0.92; Gnus nnatom: url protocol

From: Daniel Semyonov <[email-masked]>
Date: Sun, 13 Apr 2025 16:48:46 +0300

>>>>> Eli Zaretskii writes:

    > Ping! Ping!  Daniel, please respond.

Sorry, I wanted to have a better understanding of the issue first, but
James' patch seems to work well AFAICT from testing; I've attached a
simpler patch which basically achieves the same result, which I think
should be applied.

>>>>> James Thomas writes:

   >> Thank you very much for looking into this, I'm assuming this means
   >> that Gnus tries to use the value of 'nnfeed-status-string',
   >> instead of the nnatom equivalent, right? (I honestly also hate
   >> OOP, and I find the flavor implemented in Gnus especially
   >> confusing).  If so, this seems like a good solution, though I
   >> wonder why it works without this fix sometimes (and if it'll still
   >> work in those cases with this applied).
   >
   > I suspect that those may be when -status-message is called rather
   > than -status-string (through nnheader), in which case it's through
   > nnoo.

AFAICT the issue occurs when -status-message is called, actually,
through 'gnus-status-message', see 'gnus-browse-foreign-server':

(defun gnus-browse-foreign-server (server &optional return-buffer)
  "Browse the server SERVER."
  ...
    (cond
     ((not (gnus-check-server method))
      (gnus-message
       1 "Unable to contact server %s: %s" (nth 1 method)
       (gnus-status-message method))
      nil)
     ((not
       (prog2
	   (gnus-message 6 "Reading active file...")
	   (gnus-request-list method)
	 (gnus-message 6 "Reading active file...done")))
      (gnus-message
       1 "Couldn't request list: %s" (gnus-status-message method))
      nil)
  ...

Stepping through with Edebug, it seems the actual function called is
'nnatom-status-message' as expected, only that it returns nil; with the
patch (yours or mine) applied, it returns the expected string.
'nnatom-status-message' is defined through
'nnfeed-define-basic-backend-interface', and its definition should be:

(deffoo nnatom-status-message (&optional server)
  (nnoo-status-message 'nnatom server)))

'nnoo-status-message' uses nnheader to get the status string for the
correct backend, but it returns nil; my patch uses the same method to
get the same string, and set it for the parent backend (nnfeed) as well,
when failing to request a list, which somehow causes
'nnatom-status-message' to return the correct string (even though the
value it should read is not modified by my patch or yours).

In any case, I would appreciate any more insight into this.

Daniel

>From 30401bc19a21e5b8df6d68eaeb204a0e431e6d7d Mon Sep 17 00:00:00 2001
From: Daniel Semyonov <[email-masked]>
Date: Sun, 13 Apr 2025 16:06:39 +0300
Subject: [PATCH] nnfeed: Pass through list request failure reports

* lisp/gnus/nnfeed.el (nnfeed-request-list): Report the same
message reported by the inheriting backend on failure.
---
 lisp/gnus/nnfeed.el | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/lisp/gnus/nnfeed.el b/lisp/gnus/nnfeed.el
index d07a5c0539d..6a65633b7e0 100644
--- a/lisp/gnus/nnfeed.el
+++ b/lisp/gnus/nnfeed.el
@@ -609,15 +609,17 @@ nnfeed-close-group
 (deffoo nnfeed-request-list (&optional server)
   (with-current-buffer nntp-server-buffer
     (erase-buffer)
-    (when-let* ((p (point))
-                (s (nnfeed--parse-feed
-                    (or server (nnfeed--current-server-no-prefix))))
-                ((hash-table-p s)))
-      (maphash (lambda (group g)
-                 (insert (format "\"%s\" %s %s y\n"
-                                 group (aref g 3) (aref g 4))))
-               s)
-      (not (= (point) p)))))
+    (if-let* ((p (point))
+              (s (nnfeed--parse-feed
+                  (or server (nnfeed--current-server-no-prefix))))
+              ((hash-table-p s)))
+        (progn
+          (maphash (lambda (group g)
+                     (insert (format "\"%s\" %s %s y\n"
+                                     group (aref g 3) (aref g 4))))
+                   s)
+          (not (= (point) p)))
+      (nnheader-report 'nnfeed (nnheader-get-report nnfeed-backend)))))
 
 (deffoo nnfeed-request-post (&optional _server)
   (nnheader-report nnfeed-backend "%s is a read only backend" nnfeed-backend))
-- 
2.49.0