Discussion:
rethinking subfolder naming; Flatten option
Oswald Buddenhagen
2015-04-19 09:24:46 UTC
Permalink
one of the most common complaints about mbsync is the somewhat
questionalbe subfolder naming, so i'm thinking about alternatives.

the next question is whether anyone uses the Flatten option with
anything but the dot as separator? i suspect no, so i'd take away that
configurability.

suppose a mailbox named top/sub/subsub, and a new Hierarchy option:

Verbatim - verbatim folder names: top/sub/subsub
Legacy - subfolder names are prefixed with dots: top/.sub/.subsub
(default for backwards compatibility reasons)
Maildir++ - subfolder names are joined with dots and the
result is prefixed with another dot: top/.sub.subsub
(this is what the Legacy format should have been to start with)
Flatten - folder names are joined with dots: top.sub.subsub

i think it might even be a good idea to emit a warning about using the
legacy format when a subfolder is being created and the option is not
explicitly specified.

previously, i proposed allowing arbitrary name transforms based on
regular expressions, but that doesn't seem terribly useful, so i don't
think i'll ever pursue this.

objections? better ideas?
Varac
2015-04-19 19:07:41 UTC
Permalink
Great !
I'm looking forward to the Verbatim setup, becasue it would work best
with notmuch and afew Folder Name Filter [0].

i also think that these 4 options should make everyone happy.

cheers, varac

[0] https://afew.readthedocs.org/en/latest/filters.html#foldernamefilter
Post by Oswald Buddenhagen
one of the most common complaints about mbsync is the somewhat
questionalbe subfolder naming, so i'm thinking about alternatives.
the next question is whether anyone uses the Flatten option with
anything but the dot as separator? i suspect no, so i'd take away that
configurability.
Verbatim - verbatim folder names: top/sub/subsub
Legacy - subfolder names are prefixed with dots: top/.sub/.subsub
(default for backwards compatibility reasons)
Maildir++ - subfolder names are joined with dots and the
result is prefixed with another dot: top/.sub.subsub
(this is what the Legacy format should have been to start with)
Flatten - folder names are joined with dots: top.sub.subsub
i think it might even be a good idea to emit a warning about using the
legacy format when a subfolder is being created and the option is not
explicitly specified.
previously, i proposed allowing arbitrary name transforms based on
regular expressions, but that doesn't seem terribly useful, so i don't
think i'll ever pursue this.
objections? better ideas?
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
isync-devel mailing list
https://lists.sourceforge.net/lists/listinfo/isync-devel
Ciprian Dorin Craciun
2015-04-26 12:53:59 UTC
Permalink
On Sun, Apr 19, 2015 at 12:24 PM, Oswald Buddenhagen
Post by Oswald Buddenhagen
the next question is whether anyone uses the Flatten option with
anything but the dot as separator? i suspect no, so i'd take away that
configurability.
Sorry for the late reply. Yes, I do use `Flatten` with `#` as the
separator instead of `.`. (In fact before there was this option I had
applied a patch to allow hierarchical IMAP folders and flatten them
with such a pattern.)
Post by Oswald Buddenhagen
Verbatim - verbatim folder names: top/sub/subsub
Legacy - subfolder names are prefixed with dots: top/.sub/.subsub
(default for backwards compatibility reasons)
Maildir++ - subfolder names are joined with dots and the
result is prefixed with another dot: top/.sub.subsub
(this is what the Legacy format should have been to start with)
Flatten - folder names are joined with dots: top.sub.subsub
A minor comment: except `Flatten`, all the others seem to introduce
some naming ambiguity, because a maildir already has `cur`, `new` and
`tmp` folders, plus a few other `.*` files used by `mbsync` and
perhaps other external tools. Therefore adding new `.*` folders for
the IMAP sub-folders would introduce some naming ambiguity especially
when one uses other tools that create `.*` folders or files. (That is
why I use `Flatten` option.)

For example I have `.md5` folders, with timestamped `md5sum` outputs,
under each maildir to checksum my email files, and I use Git in the
"top" directory to snapshot everything.


If I would to implement it from scratch, and having hierarchical
maildirs would be the requirement, I would go with the following
rules:

* given a target folder for `mbsync` to store emails into, all its
children must obey the following rules;

* all names starting with `_` are reserved to `mbsync`;
* all names starting with `.` are ignored by `mbsync`, and any tool
(including `mbsync`) is free to create files or folders starting with
`.`;

* all other children must folders and have names starting with either
a letter, a number, or a set of limited special characters like `[`
and a few others; these folders must obey the same rules as the
target folder; (i.e. apply rules recursively, thus yielding a
hierarchical structure;)

* a special folder named `_maildir` is to be used as a maildir to
store the emails for the current folder; (i.e. it contains only
`cur`, `new`, and `tmp`;)
* inside the `_maildir` folder all files or folders starting with `.`
are ignored by `mbsync`;


Based on your example such a hierarchy would look like:
* top
* _maildir
* cur, new, tmp
* .something
* sub
* _maildir
* cur
* .something
* subsub
* _maildir
* new
* .something


Thus with such a structure all ambiguity is gone, and finding, for
example, all email files is as simple as:

find /target/ \
-type f \
\( -path '*/_maildir/cur/*' -o -path '*/_maildir/new/*' \) \
-not -path '*/.*/*' \
-print
Post by Oswald Buddenhagen
objections? better ideas?
Please allow `Flatten` to specify the separator.

Thanks,
Ciprian.
Oswald Buddenhagen
2015-04-26 13:12:10 UTC
Permalink
Post by Ciprian Dorin Craciun
Post by Oswald Buddenhagen
the next question is whether anyone uses the Flatten option with
anything but the dot as separator? i suspect no, so i'd take away that
configurability.
Sorry for the late reply. Yes, I do use `Flatten` with `#` as the
separator instead of `.`. (In fact before there was this option I had
applied a patch to allow hierarchical IMAP folders and flatten them
with such a pattern.)
ok.
meanwhile i also noticed that i implemented Flatten outside the maildir
driver, so it can apply to imap mailboxes as well.
so it's going to stay as-is, orthogonal to the new option (that's a bit
confusing from the user perspective, as Hierarchy obviously makes no
sense when Flatten is used, but whatever).
Post by Ciprian Dorin Craciun
A minor comment: except `Flatten`, all the others seem to introduce
some naming ambiguity, because a maildir already has `cur`, `new` and
`tmp` folders, plus a few other `.*` files used by `mbsync` and
perhaps other external tools.
correct. it's the status quo of Maildir, and i don't see how to change
anything in it without breaking lots of stuff.
Post by Ciprian Dorin Craciun
If I would to implement it from scratch, [...]
if you did that, you'd be well advised not to use the Maildir concept to
start with, as it's a terribly inefficient format. ;)
on the bright side, it's also a very easy to handle format ...

Loading...