Re: [Dovecot] Delimiter of mailbox changes in response to STATUS command...
Hi Chris -
Thank you for the reply.
I can't reproduce this in our setup in either 1.0-stable or 1.0-test66. What's your namespace definition and MAIL= environment? What does
1 LIST "Misc/" "*"
give you?
The LIST command returns what I expect to see (for readability):
2 list "Misc/" "*"
- LIST (\HasNoChildren) "/" "Misc/Spam"
Can you 1 SELECT "Misc/Spam" OK?
I can select that mailbox as well as others without a problem.
Here's what NAMESPACE returns:
3 NAMESPACE
- NAMESPACE (("" "/")) NIL NIL
My namespace definition in dovecot.conf is as follows:
namespace private { separator = / # prefix = # location = inbox = yes # hidden = yes }
I didn't have default_mail_env set to anything, but I just tried the following without a change in the STATUS command's behavior:
default_mail_env = maildir:/home/%u/Maildir
Is there any other information that might help?
Thanks, Lawrence
Lawrence Katz wrote:
Hi Chris -
Thank you for the reply.
I can't reproduce this in our setup in either 1.0-stable or 1.0-test66. What's your namespace definition and MAIL= environment? What does
1 LIST "Misc/" "*"
give you?
The LIST command returns what I expect to see (for readability):
2 list "Misc/" "*"
- LIST (\HasNoChildren) "/" "Misc/Spam"
Can you 1 SELECT "Misc/Spam" OK?
I can select that mailbox as well as others without a problem. Here's what NAMESPACE returns:
3 NAMESPACE
- NAMESPACE (("" "/")) NIL NIL
My namespace definition in dovecot.conf is as follows:
namespace private { separator = / # prefix = # location = inbox = yes # hidden = yes }
I didn't have default_mail_env set to anything, but I just tried the following without a change in the STATUS command's behavior:
default_mail_env = maildir:/home/%u/Maildir
Is there any other information that might help?
Thanks, Lawrence
Sorry, I didn't get my mail settings right (return address given by UNIX pine) for my last post. Fortunately you CC'd it to the list!
Anyway here's a session in 1.0-stable where #maildir is my (test) Maildir namespace (I'm using mbox mostly, so that's what I tried before)
. CREATE "#maildir/test7/test7-2" . OK Create completed. . LIST "#maildir/test7" "*"
- LIST (\Unmarked) "/" "INBOX"
- LIST (\HasNoChildren) "/" "#maildir/test7/test7-2" . OK List completed. . STATUS "#maildir/test7/test7-2" (UNSEEN)
- STATUS "test7.test7-2" (UNSEEN 0) . OK Status completed.
So it seems there's a bug in the Maildir code somewhere. The new folder SELECTs OK, though:
. SELECT "#maildir/test7/test7-2"
- FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
- OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted.
- 0 EXISTS
- 0 RECENT
- OK [UIDVALIDITY 1112827546] UIDs valid
- OK [UIDNEXT 1] Predicted next UID . OK [READ-WRITE] Select completed. . LOGOUT
- BYE Logging out . OK Logout completed.
I'll have a look and see if I can fix it, unless Timo or someone else beats me to it :)
Best Wishes, Chris
-- --+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+- Christopher Wakelin, c.d.wakelin@reading.ac.uk IT Services Centre, The University of Reading, Tel: +44 (0)118 378 8439 Whiteknights, Reading, RG6 2AF, UK Fax: +44 (0)118 975 3094
On Wed, 06 Apr 2005 23:56:13 +0100 Chris Wakelin
Anyway here's a session in 1.0-stable where #maildir is my (test) Maildir namespace (I'm using mbox mostly, so that's what I tried before)
. CREATE "#maildir/test7/test7-2" . OK Create completed. . LIST "#maildir/test7" "*" * LIST (\Unmarked) "/" "INBOX" * LIST (\HasNoChildren) "/" "#maildir/test7/test7-2" . OK List completed. . STATUS "#maildir/test7/test7-2" (UNSEEN) * STATUS "test7.test7-2" (UNSEEN 0) . OK Status completed.
So it seems there's a bug in the Maildir code somewhere.
...
I'll have a look and see if I can fix it, unless Timo or someone else beats me to it :)
OK, here's a patch for 1.0-stable, but it's not very elegant (essentially it has to find the namespace for the mailbox a second time). It's based on the code in cmd-list.c (reading RFC2060 it seems to me that the STATUS command should return the mailbox name in the same format as the LIST command). I think it should work in 1.0-test66 as well (with slight offsets/fuzz in the patch process). Best Wishes, Chris --- dovecot-1.0-stable/src/imap/cmd-status.c.orig Tue Mar 15 22:00:46 2005 +++ dovecot-1.0-stable/src/imap/cmd-status.c Thu Apr 7 12:19:19 2005 @@ -5,6 +5,7 @@ #include "imap-quote.h" #include "commands.h" #include "imap-sync.h" +#include "namespace.h" /* Returns status items, or -1 if error */ static enum mailbox_status_items @@ -84,6 +85,9 @@ struct mail_storage *storage; const char *mailbox; string_t *str; + struct namespace *ns; + const char *mailbox_copy; + string_t *name_str; /* <mailbox> <status items> */ if (!client_read_args(client, 2, 0, &args)) @@ -94,6 +98,7 @@ client_send_command_error(client, "Status items must be list."); return TRUE; } + mailbox_copy = t_strdup(mailbox); /* get the items client wants */ items = get_status_items(client, IMAP_ARG_LIST(&args[1])->args); @@ -114,7 +119,22 @@ str = t_str_new(128); str_append(str, "* STATUS "); - imap_quote_append_string(str, mailbox, FALSE); + + ns = namespace_find(client->namespaces, &mailbox_copy); + name_str = t_str_new(128); + str_truncate(name_str, 0); + str_append(name_str, ns->prefix); + str_append(name_str, mailbox_copy); + if (ns->sep != ns->real_sep) { + char *p = str_c_modifyable(name_str); + for (; *p != '\0'; p++) { + if (*p == ns->real_sep) + *p = ns->sep; + } + } + mailbox_copy = str_c(name_str); + + imap_quote_append_string(str, mailbox_copy, FALSE); str_append(str, " ("); if (items & STATUS_MESSAGES) --+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-- Christopher Wakelin, c.d.wakelin@reading.ac.uk IT Services Centre, The University of Reading, Tel: +44 (0)118 378 8439 Whiteknights, Reading, RG6 2AF, UK Fax: +44 (0)118 975 3094
Hi Chris -
OK, here's a patch for 1.0-stable, but it's not very elegant (essentially it has to find the namespace for the mailbox a second time).
Thank you for the quick turn around. I'm not too familiar with using "patch" and adjusting for different offsets, so I manually applied your changes to my test66's cmd-status.c. I recompiled Dovecot, then removed my changes from Hastymail and everything looks good.
BTW, I noticed the following during a manual test via telnet:
2 status misc/spam (UNSEEN) 2 NO Mailbox doesn't exist: misc.spam
I may be offbase here, but it looks like Dovecot always uses a "." as the mailbox separator/delimiter when it passes mailboxes around to the various cmd functions. Is this correct? Is there some common code in which this could be changed? I don't know how necessary it is, since everything except for the default STATUS code seems to be working for me.
Thanks again, Lawrence
On Thu, 7 Apr 2005 09:03:18 -0400 Lawrence Katz lists@larryka.tzo.com wrote:
Hi Chris -
OK, here's a patch for 1.0-stable, but it's not very elegant (essentially it has to find the namespace for the mailbox a second time).
Thank you for the quick turn around. I'm not too familiar with using "patch" and adjusting for different offsets, so I manually applied your changes to my test66's cmd-status.c. I recompiled Dovecot, then removed my changes from Hastymail and everything looks good.
GNU patch seemed to do it automatically for me (on Solaris, "gpatch -p0 < cmd-status.patch") but I think copying/pasting it into my mail client may have converted tabs to spaces. I'll try and be more careful in future!
BTW, I noticed the following during a manual test via telnet:
2 status misc/spam (UNSEEN) 2 NO Mailbox doesn't exist: misc.spam
You're right! I only fixed the "OK" response. I'll try and do the other for completeness.
I may be offbase here, but it looks like Dovecot always uses a "." as the mailbox separator/delimiter when it passes mailboxes around to the various cmd functions. Is this correct? Is there some common code in which this could be changed? I don't know how necessary it is, since everything except for the default STATUS code seems to be working for me.
Dovecot seems to store two separators for each namespace, a "real" one, and another. For mboxes (at least with "/"), I think they're the same, but for for maildirs, the "real" one seems always to be ".".
When Dovecot finds the namespace for the given mailbox, it strips the namespace prefix and replaces the other separator with the "real" one (if they're different).
In the LIST code, it prepends the prefix then replaces the "real" separator with the other (if different) before displaying it to the mail client, so I tried to do the same for STATUS.
Timo will tell us if I'm wrong about any of this, I hope!
Best Wishes, Chris
--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-- Christopher Wakelin, c.d.wakelin@reading.ac.uk IT Services Centre, The University of Reading, Tel: +44 (0)118 378 8439 Whiteknights, Reading, RG6 2AF, UK Fax: +44 (0)118 975 3094
On Thu, 2005-04-07 at 16:50 +0100, Chris Wakelin wrote:
BTW, I noticed the following during a manual test via telnet:
2 status misc/spam (UNSEEN) 2 NO Mailbox doesn't exist: misc.spam
You're right! I only fixed the "OK" response. I'll try and do the other for completeness.
Probably too much trouble, if it's even possible to fix all of them..
I'm going to move the namespace handling to lib-storage code and separate mailbox formats from the mailbox listing completely. Maybe the separator code gets somewhat cleaner then..
In the LIST code, it prepends the prefix then replaces the "real" separator with the other (if different) before displaying it to the mail client, so I tried to do the same for STATUS.
There's a bit easier way to do it too, just send client back the mailbox exactly as it sent it to Dovecot :) I did it like that to CVS.
On Fri, 08 Apr 2005 02:18:57 +0300 Timo Sirainen tss@iki.fi wrote:
On Thu, 2005-04-07 at 16:50 +0100, Chris Wakelin wrote:
BTW, I noticed the following during a manual test via telnet:
2 status misc/spam (UNSEEN) 2 NO Mailbox doesn't exist: misc.spam
You're right! I only fixed the "OK" response. I'll try and do the other for completeness.
Probably too much trouble, if it's even possible to fix all of them..
I had a look, and concluded it wasn't worth it :)
There's a bit easier way to do it too, just send client back the mailbox exactly as it sent it to Dovecot :) I did it like that to CVS.
I wondered about that, but I was a bit concerned that it might want a parsed version of the mailbox name in the response. It's certainly much simpler your way!
Best Wishes, Chris
--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-- Christopher Wakelin, c.d.wakelin@reading.ac.uk IT Services Centre, The University of Reading, Tel: +44 (0)118 378 8439 Whiteknights, Reading, RG6 2AF, UK Fax: +44 (0)118 975 3094
participants (3)
-
Chris Wakelin
-
Lawrence Katz
-
Timo Sirainen