Subject: moving a message to an empty group on a different imap server fails

From: Alan Schmitt <[email-masked]>
Date: Wed, 25 Mar 2015 11:26:54 +0100

Hello,

I'm seeing a bug with the current git version of gnus when I move
a message in an empty group on a different imap server. I've discovered
the bug through expiring but I can reproduce it when manually moving the
message (using "B m").

The problem happens in the last line of that snippet

#+begin_src emacs-lisp
(deffoo nnimap-request-group (group &optional server dont-check info)
  (setq group (nnimap-decode-gnus-group group))
  (let ((result (nnimap-change-group
      	   ;; Don't SELECT the group if we're going to select it
      	   ;; later, anyway.
      	   (if (and (not dont-check)
      		    (assoc group nnimap-current-infos))
      	       nil
      	     group)
      	   server))
        articles active marks high low)
    (with-current-buffer nntp-server-buffer
      (when result
        (when (or (not dont-check)
      	    (not (setq active
      		       (nth 2 (assoc group nnimap-current-infos)))))
          (let ((sequences (nnimap-retrieve-group-data-early
      		      server (list info))))
#+end_src

It happens if the function is called with info being nil, then
`nnimap-retrieve-group-data-early' is called with `(nil)' as second
argument (the singleton list containing the empty list).

Since `(nil)' is not nil, the guard of the `when' in the following
snippet does not prevent the code from being run in the following

#+begin_src emacs-lisp
(deffoo nnimap-retrieve-group-data-early (server infos)
  (when (and (nnimap-change-group nil server)
             infos)
#+end_src

and the rest of the code breaks (when a `dolist' is done on the list
`(nil)').

Unfortunately I don't know what should be done in `nnimap-request-group'
if `info' is nil, so I cannot propose a patch.

Best regards,

Alan

Ma Gnus v0.12
GNU Emacs 24.4.90.1 (x86_64-apple-darwin14.1.0, Carbon Version 157 AppKit 1344.72)
 of 2015-03-11 on charm-ecran.irisa.fr
200 news.gmane.org InterNetNews NNRP server INN 2.5.1 ready (posting ok)
100 Legal commands
  ARTICLE [message-ID|number]
  AUTHINFO USER name|PASS password|GENERIC program [argument ...]
  BODY [message-ID|number]
  CAPABILITIES [keyword]
  DATE
  GROUP newsgroup
  HDR header [message-ID|range]
  HEAD [message-ID|number]
  HELP
  IHAVE message-ID
  LAST
  LIST [ACTIVE [wildmat]|ACTIVE.TIMES [wildmat]|DISTRIB.PATS|DISTRIBUTIONS|HEADERS [MSGID|RANGE]|MODERATORS|MOTD|NEWSGROUPS [wildmat]|OVERVIEW.FMT|SUBSCRIPTIONS]
  LISTGROUP [newsgroup [range]]
  MODE READER
  NEWGROUPS [yy]yymmdd hhmmss [GMT]
  NEWNEWS wildmat [yy]yymmdd hhmmss [GMT]
  NEXT
  OVER [range]
  POST
  QUIT
  STARTTLS
  STAT [message-ID|number]
  XGTITLE [wildmat]
  XHDR header [message-ID|range]
  XOVER [range]
  XPAT header message-ID|range pattern [pattern ...]
Report problems to <[email-masked]>.
.
382 Begin TLS negotiation now
100 Legal commands
  ARTICLE [message-ID|number]
  AUTHINFO USER name|PASS password|GENERIC program [argument ...]
  BODY [message-ID|number]
  CAPABILITIES [keyword]
  DATE
  GROUP newsgroup
  HDR header [message-ID|range]
  HEAD [message-ID|number]
  HELP
  IHAVE message-ID
  LAST
  LIST [ACTIVE [wildmat]|ACTIVE.TIMES [wildmat]|DISTRIB.PATS|DISTRIBUTIONS|HEADERS [MSGID|RANGE]|MODERATORS|MOTD|NEWSGROUPS [wildmat]|OVERVIEW.FMT|SUBSCRIPTIONS]
  LISTGROUP [newsgroup [range]]
  MODE READER
  NEWGROUPS [yy]yymmdd hhmmss [GMT]
  NEWNEWS wildmat [yy]yymmdd hhmmss [GMT]
  NEXT
  OVER [range]
  POST
  QUIT
  STARTTLS
  STAT [message-ID|number]
  XGTITLE [wildmat]
  XHDR header [message-ID|range]
  XOVER [range]
  XPAT header message-ID|range pattern [pattern ...]
Report problems to <[email-masked]>.
.

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7