On Mon, Feb 4, 2019 at 1:59 PM Mark Moseley <moseleymark@gmail.com> wrote:
This has got to be something weird in my config. And the standard disclaimer of '"happy to post doveconf -n, but wanted to see if this is normal first" :)

Background: Ubuntu Xenial, running 2.2.36. Mailbox type is mdbox and I've got a period separator in my inbox namespace:

namespace {
  hidden = no
  inbox = yes
  list = yes
  location =
  mailbox Spam {
    auto = no
    autoexpunge = 1 weeks
    special_use = \Junk
  }
  mailbox Trash {
    auto = no
    special_use = \Trash
  }
  prefix = INBOX.
  separator = .
  subscriptions = yes
  type = private
}

If I do a import for a regular folder under INBOX, it works just fine:

doveadm import -u testbox2@testing.local -U testbox1@testing.local mdbox:~/mdbox INBOX all mailbox Sent

... returns happily, message count gets incremented

If I try to do the same with a subfolder (and a subfolder that most definitely exists on both source and destination side), I get an error:

doveadm import -u testbox2@testing.local -U testbox1@testing.local mdbox:~/mdbox INBOX all mailbox Sub.Sub1
doveadm(testbox2@testing.local): Error: remote(10.1.17.98:4000): Mailbox Sub.Sub1: Mailbox sync failed: Mailbox doesn't exist: Sub.Sub1

If I use / instead of . in my query, it works:

doveadm import -u testbox2@testing.local -U testbox1@testing.local mdbox:~/mdbox INBOX all mailbox Sub/Sub1

... returns happily and message count gets incremented.

Since we're using '.' as our separator, that was a bit unexpected :)

Ironically, if I'm doing a IMAPc 'import', it works just fine with a query of 'all mailbox Sub.Sub1'. It's only when importing from a local src and local dest (i.e. source_location == mdbox:~/mdbox) that it fails. With source_location set to 'imapc:', it works. I imagine that's due to using straight IMAP on the source side.

Likely a misconfig on my part? Expected behavior?

I can see in the strace that the error is triggered when doveadm is looking at the source mailbox. It looks for mdbox/mailboxes/Sub.Sub1/dbox-Mails first, then falls back to mdbox/mailboxes/Sub/Sub1/dbox-Mails (which it finds). Then a little bit later in the strace, it again looks for mdbox/mailboxes/Sub.Sub1/dbox-Mails (which it doesn't find) but doesn't try mdbox/mailboxes/Sub/Sub1/dbox-Mails this time, and then spits out 'Mailbox Sub.Sub1: Mailbox sync failed: Mailbox doesn't exist: Sub.Sub1'. With a query of 'all mailbox Sub/Sub1', the stat() is for mdbox/mailboxes/Sub/Sub1/dbox-Mails which it finds and uses happily.

Having to substitute the '.'s for '/'s in the 'mailbox' part of the query isn't an awful workaround, but it very much feels like I'm doing something wrong. This is a production setup, so everything else is otherwise working fine. But I've only just begun working with 'doveadm import', so I might be turning up some issues with my config.

Thanks! Sorry I'm so verbose :)

Has anyone else seen similar behavior? It's hardly a tough kludge to regex 's/\./\//g' (even if it makes for an ugly regex), but it seems like something's not quite right.