GNU bug report logs - #21043
[PATCH] nnimap.el: make capability parsing more robust.

Previous Next

Package: gnus;

Reported by: Nikolaus Rath <Nikolaus <at> rath.org>

Date: Mon, 13 Jul 2015 01:53:01 UTC

Severity: normal

Tags: patch

Done: Nikolaus Rath <Nikolaus <at> rath.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 21043 in the body.
You can then email your comments to 21043 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to ding <at> gnus.org, emacs-devel <at> gnu.org, eric <at> ericabrahamsen.net, bugs <at> gnus.org:
bug#21043; Package gnus. (Mon, 13 Jul 2015 01:53:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nikolaus Rath <Nikolaus <at> rath.org>:
New bug report received and forwarded. Copy sent to ding <at> gnus.org, emacs-devel <at> gnu.org, eric <at> ericabrahamsen.net, bugs <at> gnus.org. (Mon, 13 Jul 2015 01:53:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nikolaus Rath <Nikolaus <at> rath.org>
To: submit <at> debbugs.gnu.org
Subject: [PATCH] nnimap.el: make capability parsing more robust.
Date: Sun, 12 Jul 2015 18:52:40 -0700
Package: gnus
Tags: patch

Hello,

Currently Gnus relies on the server supplying the capabilities in its
response to the LOGIN command, e.g. like this:

  * CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE
  SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT
  MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS
  LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES
  WITHIN CONTEXT=SEARCH LIST-STATUS SPECIAL-USE BINARY MOVE SEARCH=FUZZY
  QUOTA\r\n
  1 OK Logged in\r\n

However, this assumption breaks if the server doesn't return the
capabilities automatically, or if he returns them as part of the OK
response, e.g.:

   160 OK [CAPABILITY IMAP4rev1 LITERAL+ ID ENABLE ACL RIGHTS=kxten
   QUOTA MAILBOX-REFERRALS NAMESPACE UIDPLUS NO_ATOMIC_RENAME UNSELECT
   CHILDREN MULTIAPPEND BINARY CATENATE CONDSTORE ESEARCH SEARCH=FUZZY
   SORT SORT=MODSEQ SORT=DISPLAY SORT=UID THREAD=ORDEREDSUBJECT
   THREAD=REFERENCES ANNOTATEMORE ANNOTATE-EXPERIMENT-1 METADATA
   LIST-EXTENDED LIST-STATUS LIST-MYRIGHTS LIST-METADATA WITHIN QRESYNC
   SCAN XLIST XMOVE MOVE SPECIAL-USE CREATE-SPECIAL-USE DIGEST=SHA1
   X-REPLICATION LOGINDISABLED XCONVERSATIONS COMPRESS=DEFLATE
   X-QUOTA=STORAGE X-QUOTA=MESSAGE X-QUOTA=X-ANNOTATION-STORAGE
   X-QUOTA=X-NUM-FOLDERS IDLE] User logged in
   SESSIONID=<sloti32d1t18-237747-1436749914-1-18339819756817078727>\r\n


Currently, in this situation Gnus just keeps re-using the pre-LOGIN
capabilities (and thus does not take advantage of any additional
features).

The attached patch fixes this issue by explicitly asking the server for
its capabilities after login.


Thanks for considering,
-Nikolaus


-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«




Information forwarded to bugs <at> gnus.org:
bug#21043; Package gnus. (Mon, 13 Jul 2015 19:01:02 GMT) Full text and rfc822 format available.

Message #8 received at 21043 <at> debbugs.gnu.org (full text, mbox):

From: Nikolaus Rath <Nikolaus <at> rath.org>
To: Eric Abrahamsen <eric <at> ericabrahamsen.net>
Cc: 21043 <at> debbugs.gnu.org, ding <at> gnus.org, emacs-devel <at> gnu.org
Subject: Re: bug#21043: [PATCH] nnimap.el: make capability parsing more robust.
Date: Mon, 13 Jul 2015 12:00:19 -0700
[Message part 1 (text/plain, inline)]
On Jul 13 2015, Eric Abrahamsen <eric <at> ericabrahamsen.net> wrote:
> Nikolaus Rath <Nikolaus <at> rath.org> writes:
>
>> Package: gnus
>> Tags: patch
>
> There was no patch!

Oops. Here it is.

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«
[0001-nnimap.el-make-capability-parsing-more-robust.patch (text/x-diff, inline)]
From 241812047dedb1ba7d362c4211a06bf506d37237 Mon Sep 17 00:00:00 2001
From: Nikolaus Rath <Nikolaus <at> rath.org>
Date: Sun, 12 Jul 2015 18:42:48 -0700
Subject: [PATCH] nnimap.el: make capability parsing more robust.

* lisp/nnimap.el (nnimap-open-connection-1): explicitly ask server for
capabilities instead of relying on LOGIN response.
---
 lisp/ChangeLog | 5 +++++
 lisp/nnimap.el | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d8ab42e..83ac4c4 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
 2015-07-12 Nikolaus Rath <Nikolaus <at> rath.org>
 
+	* nnimap.el (nnimap-open-connection-1): explicitly ask server for
+	capabilities instead of relying on LOGIN response.
+
+2015-07-12 Nikolaus Rath <Nikolaus <at> rath.org>
+
 	* nnimap.el (nnimap-request-group-scan)
 	(nnimap-request-create-group, nnimap-request-delete-group)
 	(nnimap-request-rename-group, nnimap-request-move-article)
diff --git a/lisp/nnimap.el b/lisp/nnimap.el
index d11b3a2..19632ad 100644
--- a/lisp/nnimap.el
+++ b/lisp/nnimap.el
@@ -520,7 +520,7 @@ If non-nil, articles flagged as deleted (using the IMAP
 			(funcall (nth 2 credentials)))
 		      ;; See if CAPABILITY is set as part of login
 		      ;; response.
-		      (dolist (response (cddr login-result))
+		      (dolist (response (cddr (nnimap-command "CAPABILITY")))
 			(when (string= "CAPABILITY" (upcase (car response)))
 			  (setf (nnimap-capabilities nnimap-object)
 				(mapcar #'upcase (cdr response))))))
-- 
2.1.4


Information forwarded to bugs <at> gnus.org:
bug#21043; Package gnus. (Mon, 13 Jul 2015 19:23:02 GMT) Full text and rfc822 format available.

Message #11 received at 21043 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Eric Abrahamsen <eric <at> ericabrahamsen.net>
Cc: 21043 <at> debbugs.gnu.org, ding <at> gnus.org, emacs-devel <at> gnu.org
Subject: Re: bug#21043: [PATCH] nnimap.el: make capability parsing more robust.
Date: Mon, 13 Jul 2015 21:21:52 +0200
Nikolaus Rath <Nikolaus <at> rath.org> writes:

> -		      (dolist (response (cddr login-result))
> +		      (dolist (response (cddr (nnimap-command "CAPABILITY")))

That'll be an extra round trip when logging in...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bugs <at> gnus.org:
bug#21043; Package gnus. (Mon, 13 Jul 2015 19:25:02 GMT) Full text and rfc822 format available.

Message #14 received at 21043 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Eric Abrahamsen <eric <at> ericabrahamsen.net>
Cc: 21043 <at> debbugs.gnu.org, ding <at> gnus.org, emacs-devel <at> gnu.org
Subject: Re: bug#21043: [PATCH] nnimap.el: make capability parsing more robust.
Date: Mon, 13 Jul 2015 21:24:05 +0200
Nikolaus Rath <Nikolaus <at> rath.org> writes:

> Subject: [PATCH] nnimap.el: make capability parsing more robust.

[...]

> -		      (dolist (response (cddr login-result))
> +		      (dolist (response (cddr (nnimap-command "CAPABILITY")))

And we've already issued the CAPABILITY command in the
`open-protocol-stream' call, so if the results of that isn't in
`login-results', there's a bug in `open-protocol-stream'.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bugs <at> gnus.org:
bug#21043; Package gnus. (Tue, 14 Jul 2015 00:37:02 GMT) Full text and rfc822 format available.

Message #17 received at 21043 <at> debbugs.gnu.org (full text, mbox):

From: Nikolaus Rath <Nikolaus <at> rath.org>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Cc: Eric Abrahamsen <eric <at> ericabrahamsen.net>, 21043 <at> debbugs.gnu.org,
 ding <at> gnus.org, emacs-devel <at> gnu.org
Subject: Re: bug#21043: [PATCH] nnimap.el: make capability parsing more robust.
Date: Mon, 13 Jul 2015 17:36:41 -0700
On Jul 13 2015, Lars Magne Ingebrigtsen <larsi <at> gnus.org> wrote:
> Nikolaus Rath <Nikolaus <at> rath.org> writes:
>
>> Subject: [PATCH] nnimap.el: make capability parsing more robust.
>
> [...]
>
>> -		      (dolist (response (cddr login-result))
>> +		      (dolist (response (cddr (nnimap-command "CAPABILITY")))
>
> And we've already issued the CAPABILITY command in the
> `open-protocol-stream' call, so if the results of that isn't in
> `login-results', there's a bug in `open-protocol-stream'.

No. The results of the CAPABILITY command before login may be different
than after login.

Best,
-Nikolaus

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«




Information forwarded to bugs <at> gnus.org:
bug#21043; Package gnus. (Tue, 14 Jul 2015 00:38:01 GMT) Full text and rfc822 format available.

Message #20 received at 21043 <at> debbugs.gnu.org (full text, mbox):

From: Nikolaus Rath <Nikolaus <at> rath.org>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Cc: Eric Abrahamsen <eric <at> ericabrahamsen.net>, 21043 <at> debbugs.gnu.org,
 ding <at> gnus.org, emacs-devel <at> gnu.org
Subject: Re: bug#21043: [PATCH] nnimap.el: make capability parsing more robust.
Date: Mon, 13 Jul 2015 17:37:27 -0700
On Jul 13 2015, Lars Magne Ingebrigtsen <larsi <at> gnus.org> wrote:
> Nikolaus Rath <Nikolaus <at> rath.org> writes:
>
>> -		      (dolist (response (cddr login-result))
>> +		      (dolist (response (cddr (nnimap-command "CAPABILITY")))
>
> That'll be an extra round trip when logging in...

Yes. But that's not exactly a critical path, is it?


Best,
-Nikolaus

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«




Reply sent to Nikolaus Rath <Nikolaus <at> rath.org>:
You have taken responsibility. (Sun, 01 Jan 2017 19:14:02 GMT) Full text and rfc822 format available.

Notification sent to Nikolaus Rath <Nikolaus <at> rath.org>:
bug acknowledged by developer. (Sun, 01 Jan 2017 19:14:02 GMT) Full text and rfc822 format available.

Message #25 received at 21043-done <at> debbugs.gnu.org (full text, mbox):

From: Nikolaus Rath <Nikolaus <at> rath.org>
To: 21043-done <at> debbugs.gnu.org
Subject: Fixed
Date: Sun, 01 Jan 2017 11:13:10 -0800
Fixed in commit b0aa05907fe9ecd31601fcacb2aad5fd065e2595.

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 30 Jan 2017 12:24:04 GMT) Full text and rfc822 format available.

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

Previous Next


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