Menu

#83 Path cannot be nested under Inbox

1.5.0
cannot-reproduce
nobody
None
unknown
5
2025-03-19
2025-01-26
W_Luis
No

I upgraded isync in debian/trixie and suddenly I'm getting many errors I don't understand:
When I run mbsync <channel> I'm told: Path cannot be nested under Inbox
My .mbsyncrc contained:</channel>

MaildirStore local
Path ~/Maildir/
MapInbox Inbox

I got rid of that message by adding an Inbox line:

MaildirStore local
Path ~/Maildir/
 Inbox ~/Maildir/
 MapInbox Inbox

However, now I have another error:
Maildir warning: ignoring INBOX in /.../Maildir/ Error: channel ...: far side box INBOX cannot be opened.
I made a couple of experiments that didn't work, like removing a slash and writing
Inbox ~/Maildir or writing Inbox ~/Maildir/Inbox orInbox ~/Maildir/INBOX``, but they didn't work (and I have no mailbox named explicitly Inbox nor INBOX). Before todays upgrade mbsync worked without problems and its been 12 years. Recommendations?

Discussion

1 2 > >> (Page 1 of 2)
  • Oswald Buddenhagen

    first you should make sure that you actually understand what Inbox and INBOX are. then you can assess how this relates to your actual setup, and from there determine how to fix or simply suppress the problem. you probably also shouldn't be using MapInbox.

    useful diagnostic steps are running mbsync -ls and later mbsync -l -a, but that might require at least suppressing the issue at first.

    if you need further assistance, attach your config and the output of the first command.

     
  • W_Luis

    W_Luis - 2025-01-26

    Hi,
    Thanks for your answer.
    I configured my mbsync more than a decade ago, so you're right that I
    don't actually understand what Inbox and INBOX are or ought to be. In
    my local machine I have a ~/Maildir/ directory with its usual cur/
    new/ tmp/ subdirectories, and that is my actual inbox, where I receive
    nuew mail. Furthermore, I have many subdirectories, such as mbox,
    mbox2023, mbox2023... where I write emails I have already
    processed. In my configuration I have a couple of channels to either
    synchronice all my email with my remote server or only a few of
    them. I understand that I need MapInbox to be able to include Inbox
    explicitly in that list of boxes to synchronice.

    My configuration is (edited the password and the comments):

    Expunge Both
    Create Both
    
    MaildirStore emlocal
    Path ~/Maildir/
    Inbox ~/Maildir/
    MapInbox Inbox
    # Produces errors: Ignoring INBOX y far side box INBOX cannot be opened
    
    
    #MaildirStore emlocal
    #Path ~/Maildir/
    #MapInbox Inbox
    # Used for 12 years. Unusable since upgrade: Path cannot be nested under Inbox
    
    ImapStore em
    Host em
    User mochan
    Pass mysupersecretpassword
    CertificateFile /etc/ssl/certs/ca-certificates.crt
    TLSVersions +1.2
    MapInbox Inbox
    Timeout 80
    
    Channel em
    Far :em:
    Near :emlocal:
    Pattern Inbox mbox% Sent Spam Firmas
    Pattern anuncios chistes coloquio congresos
    Pattern convocatorias escritos eventos seminarioInterno soloParaIngenieros
    
    Channel emPriority
    Far :em:
    Near :emlocal:
    Pattern Inbox mbox Sent Spam
    
    # The following are for a different server
    MaildirStore icflocal
    Path ~/Mail/icf/
    Inbox ~/Mail/icf/INBOX
    SubFolders Verbatim
    
    ImapStore icf
    Host imap.gmail.com
    AuthMechs login
    User mochan@icf.unam.mx
    PassCmd "pass mb-icf"
    CertificateFile /etc/ssl/certs/ca-certificates.crt
    TLSType IMAPS
    
    
    Channel icf
    Far :icf:
    Near :icflocal:
    Patterns * ![Gmail]* "[Gmail]/Sent Mail" "[Gmail]/Spam"
    Create Near
    Expunge Both
    Sync All
    SyncState *
    

    The output of mbsync -ls em is

    ===== em:
    INBOX
    mbox2016
    coloquio
    mbox2010
    Firmas
    anuncios
    mbox2015
    Archive
    Drafts
    Spam
    rem
    mbox2014
    anomalias
    mboINBOX
    libros
    test
    mbox2008
    mbox2013
    mbox
    seminarioInterno
    mbox2009
    convocatorias
    mbox2011
    consejoConsultivo
    chistes
    cineFis
    conservar
    clubAstronomia
    eventos
    spam
    congresos
    virtual
    mbox2012
    escritos
    Trash
    Sent
    mbox2017
    mbox2006
    soloParaIngenieros
    mbox2007
    mbox2018
    mbox2019
    mbox2000
    mbox2020
    mbox2021
    mbox2022
    mbox2023
    

    If I run mbsync -ls without further arguments I get the error:
    $ mbsync -ls
    Maildir warning: ignoring INBOX in /home/mochan/Maildir/
    Maildir error: found subfolder 'INBOX/mbox2006', but store 'emlocal' does not specify SubFolders style

    and then it seems the program hangs, so I interrupted it
    ^C

    The output of mbsync -l -a is

    Maildir warning: ignoring INBOX in /home/mochan/Maildir/
    em:
    Firmas
    Inbox
    Inbox
    Sent
    Spam
    anuncios
    chistes
    coloquio
    congresos
    convocatorias
    escritos
    eventos
    mbox
    mbox2000
    mbox2006
    mbox2007
    mbox2008
    mbox2009
    mbox2010
    mbox2011
    mbox2012
    mbox2013
    mbox2014
    mbox2015
    mbox2016
    mbox2017
    mbox2018
    mbox2019
    mbox2020
    mbox2021
    mbox2022
    mbox2023
    mbox2024
    seminarioInterno
    soloParaIngenieros
    Maildir warning: ignoring INBOX in /home/mochan/Maildir/
    emPriority:
    Inbox
    Inbox
    Sent
    Spam
    mbox
    icf:
    INBOX
    [Gmail]/Sent Mail
    [Gmail]/Spam
    multi-forward
    

    Currently, mbsync seems to synchronize correctly my mail boxes, except
    for the error messages I receive about INBOX. But I can't get it to
    work without adding the Inbox line to my configuration.

    Thanks and best regards,
    Luis

     

    Last edit: Oswald Buddenhagen 2025-03-11
  • Oswald Buddenhagen

    yeah, that config won't work anymore, because it's incoherent.
    however, you can adjust the config to actually match the physical layout. you only need to make it more similar to the other store: unset Path and MapInbox, set Inbox ~/Maildir, and SubFolders Verbatim. then adjust the Patterns to the resulting new layout. make sure to test with -ls and -l before you run an actual sync, as otherwise you'll get duplicate boxes if something doesn't match.

    the hang is definitely a bug, so keep a copy of your broken config, to be able to repro it at will. for starters, add -D to the hanging command and attach the output.

     
  • W_Luis

    W_Luis - 2025-01-26

    the results of mbsync -ls -D before updating my .mbsyncrc:

    isync 1.5.0 called with: '-ls' '-D'
    Reading configuration file /home/mochan/.mbsyncrc
    merge ops (in Channel 'icf'):
      common: OP_NEW,OP_OLD,OP_UPGRADE,OP_GONE,OP_FLAGS,OP_EXPUNGE
      far: XOP_HAVE_TYPE,XOP_HAVE_EXPUNGE,XOP_HAVE_CREATE
      near: OP_CREATE
      => far: OP_NEW,OP_OLD,OP_UPGRADE,OP_GONE,OP_FLAGS,OP_EXPUNGE,XOP_HAVE_TYPE,XOP_HAVE_EXPUNGE,XOP_HAVE_CREATE
      => near: OP_NEW,OP_OLD,OP_UPGRADE,OP_GONE,OP_FLAGS,OP_EXPUNGE,OP_CREATE
    merge ops (in global config section):
      common: OP_EXPUNGE,OP_CREATE
      far: XOP_HAVE_EXPUNGE,XOP_HAVE_CREATE
      near: 
      => far: OP_EXPUNGE,OP_CREATE,XOP_HAVE_EXPUNGE,XOP_HAVE_CREATE
      => near: OP_EXPUNGE,OP_CREATE
    Opening store emlocal...
    [ 1] Enter connect_store
    [ 1] Callback enter connect_store, sts=0
    [ 2] Enter list_store, flags=5
    Maildir warning: ignoring INBOX in /home/mochan/Maildir/
    Maildir error: found subfolder 'INBOX/mbox2006', but store 'emlocal' does not specify SubFolders style
    Callback enter bad store
    Enter cancel_store
    Leave cancel_store
    Callback leave bad store
    [ 2] Callback enter list_store, sts=4
    [ 2] Callback leave list_store
    [ 2] Leave list_store
    [ 1] Callback leave connect_store
    [ 1] Leave connect_store
    
     

    Last edit: Oswald Buddenhagen 2025-03-11
  • Oswald Buddenhagen

    ok, thanks. looks like i just failed to wire up the error cleanup path callbacks properly.

     
  • W_Luis

    W_Luis - 2025-01-26

    Question: After following your suggestions above for the local store, mbsync -ls shows my local store has boxes such as INBOX, INBOX/mbox, INBOX/..., while in the remote store I get INBOX, mbox, ... (without INBOX/ preceeding the names of the other boxes). If I remove MapInbox from the remote store config the results look similar (i.e., I get INBOX/mbox in the local store but just mbox in the remote store). Thus, what should I put in patterns? Something
    Pattern INBOX INBOX/mbox% ... or Pattern INBOX mbox% ... ? I guess that INBOX should be all in uppercase, right? Should I do other changes before actually attempting to synchronize?

     
  • W_Luis

    W_Luis - 2025-01-26

    By the way, with the new config mbsync -ls doesn't hang.

    mbsync -l -a complains that my local store has no Path

     
  • Oswald Buddenhagen

    you probably need something like

    Channel em
    Far :em:
    Near :emlocal:INBOX.
    Patterns mbox% ...
    
    Channel emInbox
    Far :em:
    Near :emlocal:
    
    Group ems
    Channels em emInbox
    

    hmm, indeed, Path cannot be omitted with SubFolders Verbatim. that's actually kinda a bug. just set it to something useless like ~/tmp.

     
  • W_Luis

    W_Luis - 2025-01-27

    Hi. Before trying your full suggestion I made one of the new channels

    Channel emSin
    Far :em:
    Near :emlocal:INBOX.
    Patterns mbox
    

    using the emlocal store you suggested before but specifying just one Pattern to test

    MaildirStore emlocal
    Inbox ~/Maildir
    SubFolders Verbatim
    Path ~/mbsyncDummyPath/
    

    adding an empty directory as Path, and made a dry run of mbsync with the new configuration for just this channel

    $ mbsync -c mbsyncrc_new -y -V emSin
    Reading configuration file ./mbsyncrc_new
    Channel emSin                                                 
    Opening far side store em...
    Resolving em...
    Opening near side store emlocal...
    Connecting to em (132.248.33.45:143)... 
    Connection is now encrypted                                   
    Logging in...
    Authenticating with SASL mechanism PLAIN...
    Opening far side box mbox...
    Opening near side box INBOX.mbox...
    Creating near side box INBOX.mbox...                          
    Maildir notice: no UIDVALIDITY in /home/mochan/mbsyncDummyPath/INBOX.mbox, creating new.
    Loading far side box...
    Loading near side box...
    near side: 0 messages, 0 recent
    far side: 6282 messages, 0 recent
    Synchronizing...
    C: 0/1  B: 0/1  F: +0/0 *0/0 #0/0 -0/0  N: +75/6282 *0/0 #0/0 -0/0
    

    I interrupted with a ^C.

    The dry run was not dry and the system began copying the first of 6K+ messages under the directory specified in Path. What I would expect is the configuration to have recognized that I already have a mailbox ~/Maildirs/mbox and that it was up to date.

     
  • Oswald Buddenhagen

    but did it actually copy anything? the dry run is intentionally very thorough in pretending that it does something. adding -Dd will show what is actually happening.

     
  • W_Luis

    W_Luis - 2025-01-27

    It did. If I run with -Dd and -y it doesn't, but if run with -y it does:

    $ rm -r mbsyncDummyPath/
    $ mkdir mbsyncDummyPath/
    $ du -s mbsyncDummyPath/
    4       mbsyncDummyPath/
    $ mbsync -c mbsyncrc_new -y -Dd -V ems
     ...
     Processed 2 box(es) in 2 channel(s),
    would pull 6284 new message(s) and 0 flag update(s),
    would expunge 0 message(s) from near side,
    would push 0 new message(s) and 0 flag update(s),
    would expunge 0 message(s) from far side.
    $ du -s mbsyncDummyPath/
    4       mbsyncDummyPath/
    $ mbsync -c mbsyncrc_new -y -V ems
    ...
    Synchronizing...
    C: 0/2  B: 0/2  F: +0/0 *0/0 #0/0 -0/0  N: +16/6282 *0/0 #0/0 -0/0^C
    $ du -s mbsyncDummyPath/
    1644    mbsyncDummyPath/
    

    So, using -y -Dd the program wrote what it would do and the directory mentioned in Path was left alone, but only using -y it started copying until it was interrupted and the directory started growing.

     
  • W_Luis

    W_Luis - 2025-01-27

    The output from mbsync -c mbsyncrc_new -y -Dd -V ems >rem.txt is attached below

     
  • Oswald Buddenhagen

    oh, right, now that you mention it, it's totally obvious: the "drying" is implemented in the proxy driver which implements -Dd. fix upcoming ...

     
  • Oswald Buddenhagen

    i believe the -ls hang and the ineffective --dry-run to be now fixed in git master.

     
  • W_Luis

    W_Luis - 2025-01-28

    Great!
    I still wonder about my configuration. I guess part of the problem is due to using different formats in my mail server (with dots) and in the client (with subdirectories). I haven't attempted a non-dry run with the configuration you suggested, but I don't want to saturate my laptop's disk with copies under 'Path' of emails I already have elsewhere. My current (incoherent) configuration seems to work, except for the error messages about non-existing Inboxes in the client and the server. Any further advice will be very appreciated

     
  • Oswald Buddenhagen

    well, the dots on the server are just directories as far as isync is concerned, provided the server tells it so according to spec.

    just try the new config with -l. if it's still wrong, you need to look at your paths and -ls output again. if you can't make sense of it, attach the outputs and the updated config.

     
  • W_Luis

    W_Luis - 2025-01-29
    $ mbsync -c mbsyncrc_new -l ems
    emSin:
    mbox <=> INBOX.mbox
    emCon:
    INBOX <=> INBOX
    

    I don't know if it is correct. Locally I expected INBOX/mbox (see below)

    $ mbsync -c mbsyncrc_new -ls
    ===== emlocal:
    INBOX/mbox2000
    INBOX/mbox2022
    INBOX/Drafts
    INBOX/convocatorias
    ...
    INBOX/INBOX
    ...
    INBOX/Inbox
    INBOX
    ===== em:
    INBOX
    mbox2016
    coloquio
    mbox2010
    Firmas
    ...
    mboINBOX
    ...
    

    Seems correct, except for the funny INBOX/INBOX, mboINBOX, etc, which must have been created while doing tests but are empty. (I wonder if I can simply remove the corresponding directories).

    However, when I make a dry run:

    $ mbsync -c mbsyncrc_new -y -Dd ems
    ...
    Processed 2 box(es) in 2 channel(s),
    would pull 6283 new message(s) and 1 flag update(s),
    would expunge 0 message(s) from near side,
    would push 1 new message(s) and 0 flag update(s),
    would expunge 0 message(s) from far side.
    

    So it seems the system would try to fetch my whole INBOX, although it is mostly synchronized with my server. The configuration file I'm using is:

    $ cat mbsyncrc_new       
    Expunge Both
    Create Both
    
    MaildirStore emlocal 
    Inbox ~/Maildir
    SubFolders Verbatim
    Path ~/mbsyncDummyPath/
    # Sugerencia de Buddenhagen
    
    ImapStore em
    Host em
    User mochan
    Pass ...
    CertificateFile /etc/ssl/certs/ca-certificates.crt
    TLSVersions +1.2
    # MapInbox Inbox
    Timeout 80
    
    # sugerencias de Oswald Buddenhagen
    
    channel emSin
    Far :em:
    Near :emlocal:INBOX. 
    Patterns mbox
    
    channel emCon
    Far :em:
    Near :emlocal:
    
    Group ems
    

    If I use a slash instead of a dot after INBOX in the channel emSin then mbsync -c... -l responds mbox <=> INBOX/mbos but the rest is the same, and it would still want to fetch my complete inbox.

     
  • Oswald Buddenhagen

    whoops, yeah, it obviously should be Near :emlocal:INBOX/.

    yes, you can (and should) delete the bogus folders. as you're not using SyncState *, you should also clean out corresponding state files from the sync state directory.

    ah, the SyncState thing is also why it wants to fetch the inbox from scratch - the logical folder names changed, so the state file names don't match anymore. you can simply rename them to match (considering that / is translated to !), but i would recommend that you actually switch to SyncState * and move the files into their respective local folders as .mbsyncstate .

     
  • W_Luis

    W_Luis - 2025-01-29

    I guess I will make a couple of dummy accounts before testing that. However, I found I made an erroneous interpretation: The 6K+ messages that mbsync would fetch are from mbox, not from INBOX. The outputs of mbsync -l are

    $ mbsync -c mbsyncrc_new -l emCon
    INBOX <=> INBOX
    $ mbsync -c mbsyncrc_new -l emSin
    mbox <=> INBOX/mbox
    $ mbsync -c mbsyncrc_new -l ems
    emSin:
    mbox <=> INBOX/mbox
    emCon:
    INBOX <=> INBOX
    

    I also tried to change Path to a link to Maildir, but it didn't work so I reverted my new configuration to the previous one. I don't know what else I could have done, but now mbsync with the new configuration tells me it would pull 6K+ messages but also that it would push 6K+ messages. I recall previously it wanted to pull them, but not to push them.

     
  • Oswald Buddenhagen

    the mapping looks just fine, no?

    that it wants to both push and pull is a classic indication that no sync state is present (or has been found, in your case).

    testing this with dummy accounts seems rather pointless, as that will just sync from scratch anyway. then you can just throw away your maildirs and sync state, and start afresh.

    so just move the sync state files in place and try with -y (preferably after you install git master). cp -al the local store somewhere, just in case.

     
  • Oswald Buddenhagen

    • status: reported --> cannot-reproduce
     
  • Oswald Buddenhagen

    as there were no further followups, i'm assuming that the configuration issue was resolved.

    i had a quick look at the code checking that Path is configured, and found that it should be triggered only if Path is actually referenced somehow, f.ex. via a Pattern. so i'm assuming that this issue was part of the bigger misconfiguration. please post a minimal reproducer if that is incorrect.

     
  • W_Luis

    W_Luis - 2025-03-11

    I'm sorry; kind of short of time, so I returned to the configuration I showed above on 2025-01-26. The system has continued working but for the warnings

     Maildir warning: ignoring INBOX in /home/mochan/Maildir/      
      Error: channel emPriority: far side box INBOX cannot be opened.
    

    I haven't understood yet the situation, but my inboxes in the remote and local machine and my other mailboxes are being correctly synchronized.

     

    Last edit: W_Luis 2025-03-11
  • Oswald Buddenhagen

    you should cut it down to what is actually needed. if some weirdness persists at this point, we can investigate.

     
  • W_Luis

    W_Luis - 2025-03-18

    This is my current mbsyncrc:

    Expunge Both
    Create Both
    
    MaildirStore emlocal
    Path ~/Maildir/
    Inbox ~/Maildir/
    MapInbox Inbox
    
    ImapStore em
    Host em
    User ...
    Pass ...
    CertificateFile /etc/ssl/certs/ca-certificates.crt
    TLSVersions +1.2
    MapInbox Inbox
    Timeout 80
    
    Channel emPriority
    Far :em:
    Near :emlocal:
    Pattern Inbox mbox Sent
    

    When I use it I get the message:

    $ mbsync emPriority
    Maildir warning: ignoring INBOX in /home/mochan/Maildir/      
    Error: channel emPriority: far side box INBOX cannot be opened anymore.
    Channels: 1    Boxes: 4    Far: +0 *0 #0 -0    Near: +0 *0 #0 -0
    

    with different sets of numbers, but my inbox and the other two mailboxes are correctly synchronized.

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.

MongoDB Logo MongoDB