Hi all,

I use mbsync with great success together with mu/mu4e to read/write
mails.  Mu is a maildir indexer.  It has some option (lazy index
checking) for speeding up re-indexing which causes it to dive only into
directories if their MTIME has changed since the last indexing run.
Apparently, this option doesn't work with mbsync, i.e., it misses new
mails and changes in certain situations.

I've tried to analyze what mbsync does with directory times and those
are my observations:

1. For my Fastmail account, every maildir (e.g.,
   ~/.mail/Fastmail/INBOX/) seems to be touched, i.e., its directory
   MTIME and CTIME are set to the time mbsync runs.

2. For my Gmail account, maildirs (e.g., ~/Gmail/INBOX/) never seem to
   be touched, i.e., both MTIME and CTIME seem to stick at the time the
   maildirs where initially created.

3. In each maildir, the new/, cur/, and tmp/ folders seem to be touched
   on changes only, i.e., their MTIME/CTIME seems to reflect the time of
   the last change of their contents.

4. When an individual message file is updated/renamed, e.g., a
   synchronization makes a formely flagged message unflagged by renaming
   it from 1619509816.8637_1.thinkpad-t440p,U=57:2,FS to
   1619509816.8637_1.thinkpad-t440p,U=57:2,S its CTIME is updated while
   its MTIME stays as it has been before.

5. The MaildirStore Path directories (e.g., ~/.mail/Fastmail/) are never
   touched.

Obviously, point 5 instantly defeats mu's lazy index checking but, of
course, one can just run "mbsync ... && touch ~/.mail/Fastmail/ && ..."
to fix that.

However, given that I see different behaviors for my Fastmail and Gmail
account and that there is no mention of mtime/ctime in the mbsync
manpage, I wonder if the current behavior is just an implementation
detail one should not rely on.

So the question is: could mbsync be improved such that if, and only if,
something has changed in some (possilbly deeply nested maildir), then
the respective mail files and all parent directories up to the
MaildirStore's Path are touched?

Bye,
Tassilo

PS: I've attached my ~/.mbsyncrc just in case some of the observations
I've made are just caused by my configuration.
#
# Fastmail
#

# First section: remote IMAP account
IMAPAccount fastmail
Host imap.fastmail.com
User x...@fastmail.fm
PassCmd +"gpg --decrypt --no-tty --for-your-eyes-only ~/.authinfo.gpg 2> 
/dev/null | grep imap.fastmail.com | sed 's/.*password \\([^ ]\\+\\).*/\\1/'"
SSLType IMAPS

IMAPStore fastmail-remote
Account fastmail

MaildirStore fastmail-local
Path ~/.mail/Fastmail/
Inbox ~/.mail/Fastmail/INBOX
SubFolders Verbatim

# This section a "channel", a connection between remote and local
Channel fastmail
Far :fastmail-remote:
Near :fastmail-local:
Patterns *
Sync All
Create Near
Remove Near
Expunge Both
SyncState *
CopyArrivalDate yes

#
# Gmail
#

IMAPAccount gmail
Host imap.gmail.com
User x...@gmail.com
PassCmd +"gpg --decrypt --no-tty --for-your-eyes-only ~/.authinfo.gpg 2> 
/dev/null | grep imap.gmail.com | sed 's/.*password \\([^ ]\\+\\).*/\\1/'"
SSLType IMAPS

IMAPStore gmail-remote
Account gmail

MaildirStore gmail-local
Path ~/.mail/Gmail/
Inbox ~/.mail/Gmail/INBOX
SubFolders Verbatim

Channel gmail
Far :gmail-remote:
Near :gmail-local:
Create Near
Remove Near
Expunge Both
Sync All
Patterns *
CopyArrivalDate yes

#
# SHD
#

IMAPAccount shd
Host outlook.office365.com
Port 993
User x...@yyy.de
PassCmd +"gpg --decrypt --no-tty --for-your-eyes-only ~/.authinfo.gpg 2> 
/dev/null | grep outlook.office365.com | sed 's/.*password \\([^ 
]\\+\\).*/\\1/'"
SSLType IMAPS
# Otherwise you get errors with exchange servers.
PipelineDepth 1

IMAPStore shd-remote
Account shd

MaildirStore shd-local
Path ~/.mail/SHD/
Inbox ~/.mail/SHD/INBOX
SubFolders Verbatim

Channel shd
Far :shd-remote:
Near :shd-local:
Create Near
Remove Near
Expunge Both
Sync All
Patterns *
CopyArrivalDate yes

##########
# Groups #
##########

Group private
Channel fastmail
Channel gmail

Group work
Channel shd
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to