Re: Unexpected output of "notmuch new --quiet"

2019-04-19 Thread Ralph Seichter
* Daniel Kahn Gillmor:

> as far as maildir goes, i think notmuch probably *shouldn't* be
> looking at stuff in …/tmp/ -- right?

You're right, I don't see why Notmuch would peek into "tmp".

> I'd be sad if those files went away, but perhaps you're right that
> we should only be looking at are things within any cur/ and new/
> subfolders within the message archive.

I don't mean to reduce Notmuch usability to get rid of a few unwanted
messages on stderr. What I suggest is to consider all files outside of
"cur" and "new" to be legitimate non-mail files by default. If Notmuch
chooses to inspect them and detects valid messages, then fine, but the
default assumption should be non-mail.

Think about how the files get there. You manually dumping some *.eml
files in a directory is not exactly typical, IMO. ;-) I expect that in
the majority of cases there is some MTA or fetchmail-like process
storing mail files in a Maildir structure (flat, tree, or mixed like
Dovecot does).

I think that altering Notmuch's expectations about files outside of
well-known subdirectories should be possible without sacrificing its
flexibility.

-Ralph
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Unexpected output of "notmuch new --quiet"

2019-04-19 Thread Ralph Seichter
* David Bremner:

> So the leading '/' isn't there to match for top level files.

That's unexpected, so quite in tune with the thread subject. ;-)

> ignore=/(^|/)dovecot[-.]/;/(maildirfolder|subscriptions)$/;

I'll try that, thanks.

-Ralph
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Unexpected output of "notmuch new --quiet"

2019-04-19 Thread David Bremner
Daniel Kahn Gillmor  writes:

> I've personally done the (maybe bad) thing where i just drop a folder
> full of RFC5322 .eml files anywhere inside my message store and run
> "notmuch new" to ingest them.  I'd be sad if those files went away, but
> perhaps you're right that we should only be looking at are things within
> any cur/ and new/ subfolders within the message archive.
>

notmuch(1) is on your side:

   The mail directory you specify can contain any number of
   sub-directories and should primarily contain only files with
   individual email messages (eg. maildir or mh archives are
   perfect). If there are other, non-email files (such as indexes
   maintained by other email programs) then notmuch will do its best
   to detect those and ignore them.

I guess my initial reaction is that the tradeoff discussed here (less
functionality for better/fewer warnings) doesn't seem great.

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Unexpected output of "notmuch new --quiet"

2019-04-19 Thread Daniel Kahn Gillmor
On Fri 2019-04-19 15:55:27 +0200, Ralph Seichter wrote:
> * Daniel Kahn Gillmor:
>
>> Why is "non-mail file found" in my maildir such a low priority?
>
> Because I do not agree with Notmuch's notion of what a non-mail file
> is. All files the Dovecot server uses for its own metadata are placed
> outside of "cur", "new", and "tmp".
>
> My understanding of the Maildir structure is that only these three
> subfolders in a given directory may contain mail files, so I expect
> Notmuch, as a default behaviour, to ignore whatever is stored outside
> of these subfolders.

Hm, notmuch supports trees of maildirs as well, and nested maildirs,
none of which are part of the maildir spec aiui.

Also, as far as maildir goes, i think notmuch probably *shouldn't* be
looking at stuff in …/tmp/ -- right?  otherwise it's liable to
occasionally access some half-written files.

I've personally done the (maybe bad) thing where i just drop a folder
full of RFC5322 .eml files anywhere inside my message store and run
"notmuch new" to ingest them.  I'd be sad if those files went away, but
perhaps you're right that we should only be looking at are things within
any cur/ and new/ subfolders within the message archive.

That'd be an easy fix if there was no deployed base to worry about.  Any
thoughts about how to make such a transition safe for existing users
like me?

--dkg


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] python: support relative path in default database

2019-04-19 Thread Doan Tran Cong Danh
>From notmuch 0.28, notmuch support relative database path in
notmuch-config(1), but python binding haven't taught this yet.

afew denied to work with a perfectly fine notmuch-config due to this.
---
 bindings/python/notmuch/database.py | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bindings/python/notmuch/database.py 
b/bindings/python/notmuch/database.py
index 342d665a..88ca836e 100644
--- a/bindings/python/notmuch/database.py
+++ b/bindings/python/notmuch/database.py
@@ -675,7 +675,10 @@ class Database(object):
 if not config.has_option('database', 'path'):
 raise NotmuchError(message="No DB path specified"
" and no user default found")
-return config.get('database', 'path')
+db_path = config.get('database', 'path')
+if not os.path.isabs(db_path):
+db_path = os.path.expanduser(os.path.join("~", db_path))
+return db_path
 
 """notmuch_database_get_config"""
 _get_config = nmlib.notmuch_database_get_config
-- 
2.21.0

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Unexpected output of "notmuch new --quiet"

2019-04-19 Thread David Bremner
Ralph Seichter  writes:

> * Ralph Seichter:
>
>> ignore=//dovecot[[:punct:]]/;/(maildirfolder|subscriptions)$/;
>
> Odd. I am currently adding this entry to some users' config files, and
> the expression //dovecot[[:punct:]]/ does not seem to work in all
> cases. Based on notmuch-search-terms(7) I assumed that Notmuch used
> POSIX.2 regular expressions, does it not?

I think I can duplicate the problem you see, and it's not about POSIX.2,
but rather that the paths are stored in the database (and match)
relative to the top level Maildir. So the leading '/' isn't there to
match for top level files.

This version seems to work for me.

 ignore=/(^|/)dovecot[-.]/;/(maildirfolder|subscriptions)$/;

Maybe regexp experts can suggest the canonical way to do this;
potentially we could add another example to the docs. 
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Unexpected output of "notmuch new --quiet"

2019-04-19 Thread Ralph Seichter
* Daniel Kahn Gillmor:

> Why is "non-mail file found" in my maildir such a low priority?

Because I do not agree with Notmuch's notion of what a non-mail file
is. All files the Dovecot server uses for its own metadata are placed
outside of "cur", "new", and "tmp".

My understanding of the Maildir structure is that only these three
subfolders in a given directory may contain mail files, so I expect
Notmuch, as a default behaviour, to ignore whatever is stored outside
of these subfolders.

-Ralph
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Unexpected output of "notmuch new --quiet"

2019-04-19 Thread Daniel Kahn Gillmor
On Thu 2019-04-18 15:52:19 +0200, Ralph Seichter wrote:
> Personally, I'd go with these decreasing levels of severity:
>
>   Fatal: Execution must stop immediately to prevent damage, error
>   message may or may not be displayed before exiting the process.
>
>   Error: Serious trouble, program may or may not be able to recover,
>   user intervention required.
>
>   Warning: Minor trouble, program will recover without user
>   intervention.
>
>   Notice: Inform the user of a less-than-ideal situation (non-mail file
>   found, deprecated functionality used, etc). Program will ignore the
>   cause and carry on.

Why is "non-mail file found" in my maildir such a low priority?  If
there's a malformed message in my maildir i want to know about it as
soon as possible, that could be an important e-mail that some other part
of my mail ecosystem mangled that i could de-mangle to have access to it
if only i know to look there?

Seems like using new.ignore to ignore the files that you know are
supposed to be there but aren't mail is a cleaner way to go.

   --dkg


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Unexpected output of "notmuch new --quiet"

2019-04-19 Thread Ralph Seichter
* Ralph Seichter:

> ignore=//dovecot[[:punct:]]/;/(maildirfolder|subscriptions)$/;

Odd. I am currently adding this entry to some users' config files, and
the expression //dovecot[[:punct:]]/ does not seem to work in all
cases. Based on notmuch-search-terms(7) I assumed that Notmuch used
POSIX.2 regular expressions, does it not?

-Ralph
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Unexpected output of "notmuch new --quiet"

2019-04-19 Thread Ralph Seichter
* David Bremner:

> Are there warnings that you want to suppress that are not handleable
> with the new.ignore facility?

Sorry, I misunderstood your question, and new.ignore is sufficient for
my current purposes:

  [new]
  ignore=//dovecot[[:punct:]]/;/(maildirfolder|subscriptions)$/;

Thank you for pointing this feature out to me.

-Ralph
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch