Gnus development mailing list
 help / color / mirror / Atom feed
From: Gaute B Strokkenes <biggaute@uwc.net>
Cc: larsi@gnus.org
Subject: Re: Problems with IMAP-over-ssl mail source.
Date: Tue, 26 Aug 2003 20:34:32 +0100	[thread overview]
Message-ID: <87n0dw5i2f.fsf@srcf.ucam.org> (raw)
In-Reply-To: <874r06winx.fsf@srcf.ucam.org>

On 25 aug 2003, biggaute@uwc.net wrote:

> Consider the following snippet from mail-source-fetch-imap:
>
> (let* ((from (format "%s:%s:%s" server user port))
> 	   (found 0)
> 	   (buffer-name " *imap source*")
> 	   (buf (get-buffer-create (generate-new-buffer-name buffer-name)))
> 	   (mail-source-string (format "imap:%s:%s" server mailbox))
> 	   (imap-shell-program (or (list program) imap-shell-program))
> 	   remove)
> (if (and (imap-open server port stream authentication buffer-name)
> 	       (imap-authenticate
> 		user (or (cdr (assoc from mail-source-password-cache))
> 			 password) buf)
> 	       (imap-mailbox-select mailbox nil buf))
>
> The problem appear to be that the " *imap source*" buffer is not
> deleted when I interrupt a fetching session.  Then, the next time
> this code is called, generate-new-buffer-name ensures that `buf' is
> a new buffer called " *imap source*<1>".  However, when imap-open is
> called it is passed buffer-name which is still set to " *imap
> source", causing imap-open to operate on the wrong temporary buffer.

And the obvious fix is:

Index: lisp/mail-source.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/mail-source.el,v
retrieving revision 6.38
diff -u -r6.38 mail-source.el
--- lisp/mail-source.el	14 Jul 2003 08:03:13 -0000	6.38
+++ lisp/mail-source.el	25 Aug 2003 20:51:52 -0000
@@ -968,12 +968,11 @@
   (mail-source-bind (imap source)
     (let* ((from (format "%s:%s:%s" server user port))
 	   (found 0)
-	   (buffer-name " *imap source*")
-	   (buf (get-buffer-create (generate-new-buffer-name buffer-name)))
+	   (buf (generate-new-buffer " *imap source*"))
 	   (mail-source-string (format "imap:%s:%s" server mailbox))
 	   (imap-shell-program (or (list program) imap-shell-program))
 	   remove)
-      (if (and (imap-open server port stream authentication buffer-name)
+      (if (and (imap-open server port stream authentication buf)
 	       (imap-authenticate
 		user (or (cdr (assoc from mail-source-password-cache))
 			 password) buf)

But I'm not sure that this is the best way to fix things.  Is it
correct to leave a " *imap source*" buffer lying about if
mail-source-fetch-imap is interupted?  Would it be better to reuse it
than to create a new one?

Lastly, this bug was introduced by Lars in mid-March:

 revision 6.33
 date: 2003/03/17 14:20:35;  author: larsi;  state: Exp;  lines: +8 -7
 * mail-source.el (mail-source-fetch-imap): Pass buffer-name to
 imap-open.

I've been unable to find discussion of why this change was made on the
ding list, though presumably there is some reason for it.  Lars?

-- 
Gaute Strokkenes                        http://www.srcf.ucam.org/~gs234/
The PINK SOCKS were ORIGINALLY from 1952!!
 But they went to MARS around 1953!!



      reply	other threads:[~2003-08-26 19:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-14  1:49 Gaute B Strokkenes
2003-07-14  7:41 ` Simon Josefsson
2003-07-14  7:54   ` Gaute B Strokkenes
2003-07-14 12:49     ` Simon Josefsson
2003-07-16  1:45       ` Gaute B Strokkenes
2003-07-16 23:53         ` Gaute B Strokkenes
2003-08-25  2:54         ` Gaute B Strokkenes
2003-08-26 19:34           ` Gaute B Strokkenes [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87n0dw5i2f.fsf@srcf.ucam.org \
    --to=biggaute@uwc.net \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).