Re: regression between revisions 5546 and 5554
- To: mutt-dev@xxxxxxxx
- Subject: Re: regression between revisions 5546 and 5554
- From: Jukka Salmi <j+mutt@xxxxxxxxxxxxx>
- Date: Tue, 18 Nov 2008 12:39:31 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=salmi.ch; s=mx1; t=1227008371; i=@xxxxxxxxxxxxx; bh=poaGG/OpgMkl0LcmK9RV++ekFaLRSxqx Pahc1TQxKgs=; h=Date:From:To:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=wEjAmEMcL5P6jVjclBvCgS8yE QR8h2aN7tpRQBmec3ZFqbbrQjaXzCXACBK+sL0looK4vmuYZ4/2wiu10HBDXvZHzjQ8 ZRafE0CJhlBs7DdcONZLj25BSFe4Il2MtHdRYzzjXB3mU9EyZuuKBvZ5D/0IpFC2laL b5oZHwatqmbGqMBZquvE+JV7U+hAL15CwhVTW+Niuhn01lFrSTGtzS/G7uE9XD0SyB7 7RuRRBVH7uaYn0+WHpNh+ZAzROKooCv2qOaS7kSat+fw2iXpP6MNjfTEu6K9u/jVkyk Tixt8hBOOQm3b40frKFqve2xFpNeJB7ytNbJMIW6i7V2S419w==
- Domainkey-signature: a=rsa-sha1; s=mx1; d=salmi.ch; c=simple; q=dns; h=received:date:from:to:subject:message-id: mail-followup-to:references:mime-version:content-type: content-disposition:in-reply-to:x-client-os:user-agent; b=wuBoSq0i6Kwv1MNVV5BBXfnmgwn1KUzl7h+Ny0FQfv/OwftN1FaEnYowwHf4Es2OL 8TfRm5F9OlqErvH4EUs/uGoNNDsUk20qTuMmspJB5ru/5IGX7zCdN26xQFJCbSXWs7q woFeWlX/sMGZV2DJF/0YnKd2GVaLnmbGi6iDcCObyJgqgXaWLX5jthhs+VJ79WnULGx EzVb6ToV66oqrY7/qt25I3TMweJ0OXSXSna6EceLVEgtxVCl+ePfCcmF05XwfyCN+Gk oQbA9mmchJyRl4VZF6YzDfL8UE5olxm58/RC8uZnqGVk1cKfPbrx/POYrZG0Gw0U9GG FxPRszXMw==
- In-reply-to: <20081108130108.GA10129@xxxxxxxxxxxxxx>
- List-post: <mailto:mutt-dev@mutt.org>
- List-unsubscribe: send mail to majordomo@mutt.org, body only "unsubscribe mutt-dev"
- Mail-followup-to: mutt-dev@xxxxxxxx
- References: <20081108130108.GA10129@xxxxxxxxxxxxxx>
- Sender: owner-mutt-dev@xxxxxxxx
- User-agent: Mutt/1.5.18 (2008-11-16)
Jukka Salmi --> mutt-dev (2008-11-08 14:01:08 +0100):
> Hello,
>
> I'm seeing some recently introduced problems with Mutt, mainly regarding
> browsing IMAP folders (on Cyrus 2.1 and 2.2 IMAP servers; I didn't try
> other IMAP servers).
>
> Up to revision 5546 everything worked for me as expected. Starting with
> revision 5547 and up to 5553, browsing IMAP folders was broken (I was
> getting "Mailbox does not exist"); this was fixed with revision 5554.
> However, since 5554 my Mutt behaves strangely. Here's an example session:
>
> [what I type -> what Mutt prints, comments following # signs]
>
> c -> "---Mutt: =INBOX [Msgs:29 Post:1 Inc:5 3.1M]---..."
> "Open mailbox ('?' for list): =INBOX/Lists/NetBSD/current-users"
>
> # The separator printed is / which is wrong here (expecting dot!).
>
> tab -> "---Mutt: =INBOX [Msgs:29 Post:1 Inc:5 3.1M]---..."
> "Open mailbox: =INBOX.Lists.NetBSD.current-users"
>
> # This time the separator is the expected dot.
>
> tab -> "---Mutt: =INBOX [Msgs:29 Post:1 Inc:5 3.1M]---..."
> "Open mailbox: =INBOX.Lists.NetBSD.current-users"
>
> # Hmm, I hit tab again, but without effect. Previously this cause the
> # directory listing shown in the next step to be displayed.
>
> tab -> "-- Mutt: Directory [=INBOX.Lists.NetBSD.], File mask: !^\.[^.]"
> "1 IMAP current-users"
>
> # Everyting fine in this step.
>
> tab -> "-- Mutt: Mailboxes [5]"
>
> # The list of all mailboxes (as defined with the mailboxes command) is
> # shown, but %N is 0 for all of them even for those containing unread
> # and / or new messages.
>
> tab -> "-- Mutt: Directory [=INBOX.Lists.NetBSD.], File mask: !^\.[^.]"
> list of mailboxes beneath INBOX.Lists.NetBSD is shown
>
> # Everything fine here as well.
> # Further tabs loop over the last two lists described above as expected.
>
>
> Hmm, is anybody else seing this as well?
A patch (which is attached) I received off-list from TAKAHASHI Tamotsu
seems to fix the problems described above. Any comments?
BTW, the comment above Mutt's imap_fix_path() seems to indicate that
displaying '/' no matter what the real separator is is done
deliberately. Do I get this right?
Regards, Jukka
--
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~
diff -r c2439fc68cd6 imap/imap_private.h
--- a/imap/imap_private.h Wed Oct 29 20:49:27 2008 -0700
+++ b/imap/imap_private.h Wed Nov 12 22:50:53 2008 +0900
@@ -271,7 +271,7 @@
void imap_error (const char* where, const char* msg);
IMAP_DATA* imap_new_idata (void);
void imap_free_idata (IMAP_DATA** idata);
-char* imap_fix_path (IMAP_DATA* idata, char* mailbox, char* path,
+char* imap_fix_path (IMAP_DATA* idata, const char* mailbox, char* path,
size_t plen);
void imap_cachepath(IMAP_DATA* idata, const char* mailbox, char* dest,
size_t dlen);
diff -r c2439fc68cd6 imap/util.c
--- a/imap/util.c Wed Oct 29 20:49:27 2008 -0700
+++ b/imap/util.c Wed Nov 12 22:50:53 2008 +0900
@@ -267,10 +267,15 @@
/* silly helper for mailbox name string comparisons, because of INBOX */
int imap_mxcmp (const char* mx1, const char* mx2)
{
+ char buf1[LONG_STRING];
+ char buf2[LONG_STRING];
+
if (!ascii_strcasecmp (mx1, "INBOX") && !ascii_strcasecmp (mx2, "INBOX"))
return 0;
- return mutt_strcmp (mx1, mx2);
+ imap_fix_path (NULL, mx1, buf1, sizeof (buf1));
+ imap_fix_path (NULL, mx2, buf2, sizeof (buf2));
+ return mutt_strcmp (buf1, buf2);
}
/* imap_pretty_mailbox: called by mutt_pretty_mailbox to make IMAP paths
@@ -283,14 +288,21 @@
int tlen;
int hlen = 0;
char home_match = 0;
+ char buf[STRING];
if (imap_parse_path (path, &target) < 0)
return;
+ imap_fix_path (NULL, target.mbox, buf, sizeof (buf));
+ FREE (&target.mbox);
+ target.mbox = safe_strdup (buf);
tlen = mutt_strlen (target.mbox);
/* check whether we can do '=' substitution */
if (mx_is_imap(Maildir) && !imap_parse_path (Maildir, &home))
{
+ imap_fix_path (NULL, home.mbox, buf, sizeof (buf));
+ FREE (&home.mbox);
+ home.mbox = safe_strdup (buf);
hlen = mutt_strlen (home.mbox);
if (tlen && mutt_account_match (&home.account, &target.account) &&
!mutt_strncmp (home.mbox, target.mbox, hlen))
@@ -390,7 +402,7 @@
* are not required to do this.
* Moreover, IMAP servers may dislike the path ending with the delimiter.
*/
-char *imap_fix_path (IMAP_DATA *idata, char *mailbox, char *path,
+char *imap_fix_path (IMAP_DATA *idata, const char *mailbox, char *path,
size_t plen)
{
int i = 0;
diff -r c2439fc68cd6 lib.c
--- a/lib.c Wed Oct 29 20:49:27 2008 -0700
+++ b/lib.c Wed Nov 12 22:50:53 2008 +0900
@@ -976,7 +976,8 @@
{
const char *fmt = "%s/%s";
- if (!*fname || (*dir && dir[strlen(dir)-1] == '/'))
+ if (!*fname || (*dir && dir[strlen(dir)-1] == '/')
+ || ((dir[0] == '+' || dir[0] == '=') && !dir[1]))
fmt = "%s%s";
snprintf (d, l, fmt, dir, fname);