[PATCH] devel/check-out-of-tree-build.sh: consistent naming, consistent quoting

2017-10-02 Thread Tomi Ollila
Renamed from out-of-tree-build-check.sh to be consistent with
other files in this directory.

Fixed quoting in "$srcdir" usage for additional robustness, other
quoting changes for consistency.
---

Probably the review email message of this I sent got buried in the
pile of other email messages ;)

Tomi

 devel/{out-of-tree-build-check.sh => check-out-of-tree-build.sh} | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)
 rename devel/{out-of-tree-build-check.sh => check-out-of-tree-build.sh} (57%)

diff --git a/devel/out-of-tree-build-check.sh b/devel/check-out-of-tree-build.sh
similarity index 57%
rename from devel/out-of-tree-build-check.sh
rename to devel/check-out-of-tree-build.sh
index 984b4b5f65f5..3e443ea25bf2 100755
--- a/devel/out-of-tree-build-check.sh
+++ b/devel/check-out-of-tree-build.sh
@@ -4,12 +4,12 @@
 
 set -eu
 
-srcdir="$(cd "$(dirname "$0")"/.. && pwd)"
+srcdir=$(cd "$(dirname "$0")"/.. && pwd)
 builddir=$(mktemp -d)
 
-cd $builddir
+cd "$builddir"
 
-$srcdir/configure
+"$srcdir"/configure
 make "$@"
 
-rm -rf $builddir
+rm -rf "$builddir"
-- 
2.13.3

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


Re: search misses some targets

2017-10-02 Thread Jean-Francois Moulin
On 09/29/2017 01:34 PM, David Bremner wrote:
> Jean-Francois Moulin  writes:
>
>> Hi!
>>
>> Sorry for not providing enough info to start with.
>>
>> I have pasted a header below (slightly modified for privacy).
>> I wanted to find all mails coming from the sender of this one.
>> I used "search from:Doe" and search "from:doe" and got only 3/4 of the 
>> expected hits (I
>> checked with Thunderbird). I then tried "search Doe" and "search doe",
>> this message was not found either. Using mutt when I applied a "limit Doe" 
>> or "limit doe",
>> the message was found.
>>
>> Thanks for having a look!
>>
> I made an email message from these headers and was able to find it fine
> with all of the 'notmuch search' variations you mentioned. If you can
> duplicate the problem with a public message that you can send verbatim
> that might help.  The usual cause of such problems is exclude tags, but
> I see from your first message that you don't have any configured.
> Another potential source of difficulties is duplicate message-ids. You
> could test for the latter with
> notmuch search 
> id:OF39AEF41D.39304F6A-ONC12580B2.005407CD-C12580B2.005AB287@LocalDomain

Hi,


sorry for the delay.

notmuch search
id:OF39AEF41D.39304F6A-ONC12580B2.005407CD-C12580B2.005AB287@LocalDomain

returns nothing.

Looking for examples I could share, I searched for Spam Quarantaine
notifications **using notmuch-mutt**
    (The binding I use for the search in mutt is the following (copied
from https://notmuchmail.org/notmuch-mutt/)
macro index L "unset wait_keyread -p
'notmuch query: ' x; echo \$x >~/.cache/mutt_terms~i
\"\`notmuch search --output=messages \$(cat ~/.cache/mutt_terms) | head
-n 600 | perl -le '@a=<>;chomp@a;s/\^id://
for@a;$,=\"|\";print@a'\`\"" "show only messages matching a
notmuch pattern")


The notmuch search did not find any message!

This same macro executed with "Spam" as argument finds a few messages
containing the word spam but none having it in the from field

Repeating the searches with plain notmuch from the command line found
all of the messages!
So it is probable that my mutt configuration somehow has a problem. Once
this is fixed I'll search again for thoses cases where some messages are
found but not all of them.

Any tip appreciated of course but I guess this is probably no longer the
right place to ask!

JF



-- 

Dr. Jean-François Moulin
German Engineering Materials Science Centre (GEMS)
at Heinz Maier-Leibnitz Zentrum (MLZ)
Helmholtz-Zentrum Geesthacht GmbH
Lichtenbergstr. 1, 85747 Garching bei München, Germany
phone: +49-89-289-10762; email: jean-francois.mou...@hzg.de




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


Re: notmuch-emacs: Fcc to top-level directory given by database.path

2017-10-02 Thread Jani Nikula
On Sat, 30 Sep 2017, Jani Nikula  wrote:
> On Sat, 23 Sep 2017, David Bremner  wrote:
>> Do you happen to know if it calls with an empty string as the folder
>> name? It would be consistent with searching for that to insert at the
>> top level.
>
> notmuch insert --folder= or --folder="" does not work:
>
> String argument for option "folder" must be non-empty.
> Unrecognized option: --folder=
>
> It seems that our argument parser doesn't accept empty strings at all,
> which is a bit of a limitation. It would be logical for the empty string
> to work here, and AFAICT the notmuch insert code would handle this if
> the argument was let through the parsing.

Turns out this is trivial to address on top of the arg parsing series:
id:20171002162552.4827-1-j...@nikula.org.

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


[PATCH] cli: allow empty strings for notmuch insert --folder argument

2017-10-02 Thread Jani Nikula
Now that it's easy to add argument specific modifiers in opt
descriptions, add a new .allow_empty field to allow empty strings for
individual string arguments while retaining strict checks
elsewhere. Use this for notmuch insert --folder, where the empty
string means top level folder.

---

This patch addresses id:87y3owr22c@nikula.org

Depends on most of the series, but specifically not on the more
controversial patches 13-15.
---
 command-line-arguments.c| 2 +-
 command-line-arguments.h| 3 +++
 doc/man1/notmuch-insert.rst | 3 ++-
 notmuch-insert.c| 2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/command-line-arguments.c b/command-line-arguments.c
index 3fa8d9044966..b84bfe8168b5 100644
--- a/command-line-arguments.c
+++ b/command-line-arguments.c
@@ -81,7 +81,7 @@ _process_string_arg (const notmuch_opt_desc_t *arg_desc, char 
next, const char *
fprintf (stderr, "Option \"%s\" needs a string argument.\n", 
arg_desc->name);
return FALSE;
 }
-if (arg_str[0] == '\0') {
+if (arg_str[0] == '\0' && ! arg_desc->allow_empty) {
fprintf (stderr, "String argument for option \"%s\" must be 
non-empty.\n", arg_desc->name);
return FALSE;
 }
diff --git a/command-line-arguments.h b/command-line-arguments.h
index dfc808bdab78..04b04b939cba 100644
--- a/command-line-arguments.h
+++ b/command-line-arguments.h
@@ -30,6 +30,9 @@ typedef struct notmuch_opt_desc {
 /* Optional, if non-NULL, set to TRUE if the option is present. */
 notmuch_bool_t *present;
 
+/* Optional, allow empty strings for opt_string. */
+notmuch_bool_t allow_empty;
+
 /* Must be set for opt_keyword and opt_flags. */
 const struct notmuch_keyword *keywords;
 } notmuch_opt_desc_t;
diff --git a/doc/man1/notmuch-insert.rst b/doc/man1/notmuch-insert.rst
index f79600d6571f..2f2466a6588b 100644
--- a/doc/man1/notmuch-insert.rst
+++ b/doc/man1/notmuch-insert.rst
@@ -34,7 +34,8 @@ Supported options for **insert** include
 ``--folder=<``\ folder\ **>**
 Deliver the message to the specified folder, relative to the
 top-level directory given by the value of **database.path**. The
-default is to deliver to the top-level directory.
+default is the empty string, which means delivering to the
+top-level directory.
 
 ``--create-folder``
 Try to create the folder named by the ``--folder`` option, if it
diff --git a/notmuch-insert.c b/notmuch-insert.c
index bbbc29ea103d..2758723ab2fb 100644
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -463,7 +463,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, 
char *argv[])
 unsigned int i;
 
 notmuch_opt_desc_t options[] = {
-   { .opt_string = , .name = "folder" },
+   { .opt_string = , .name = "folder", .allow_empty = TRUE },
{ .opt_bool = _folder, .name = "create-folder" },
{ .opt_bool = , .name = "keep" },
{ .opt_bool =  _hooks, .name = "no-hooks" },
-- 
2.11.0

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


Re: notmuch-emacs: Fcc to top-level directory given by database.path

2017-10-02 Thread Jani Nikula
On Mon, 02 Oct 2017, Arun Isaac  wrote:
> Mark Walters  writes:
>
>> Incidentally, I think "/" is an alternative for the fcc line which
>> already works, which is "\"/\" in notmuch-fcc-dirs.
>
> Perhaps, notmuch should be made to tolerate a "/" at the beginning of the
> Fcc folder argument. That is, notmuch should not complain about absolute
> paths, and it should interpret these as relative to the root. To
> maintain backward compatibility, we could add a "/" at the beginning if
> it is not already there.
>
> So,
>
> "/" => database.path
> "/sent" => database.path/sent
> "sent" => database.path/sent
>
> etc.
>
> Is this a better idea?

At the cli notmuch insert level, I'd actually rather do the opposite and
be even stricter about folder being relative. I just had to look at the
code for other reasons, and it seems to accept all sorts of weird combos
with "/" and "." that I think should be rejected. Or at the very least
sanitized. Otherwise we end up with filenames with "//" or "/./" in
them, probably confusing notmuch later on.

I'd argue notmuch insert --folder="" should Fcc to the mail store root,
but alas that doesn't work at the cli level. It doesn't appear to work
at the emacs level either, but perhaps notmuch-emacs could translate ""
to dropping the --folder argument? Could even add that as a choice
option in notmuch-fcc-dirs customization. Mark?

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


Re: [PATCH v2 13/15] cli: add support for --no- prefixed boolean and keyword flag arguments

2017-10-02 Thread Jani Nikula
On Sun, 01 Oct 2017, William Casarin  wrote:
> Jani Nikula  writes:
>
>> @@ -171,11 +186,22 @@ parse_option (int argc, char **argv, const 
>> notmuch_opt_desc_t *options, int opt_
>>  if (! try->name)
>>  continue;
>>  
>> -if (strncmp (arg, try->name, strlen (try->name)) != 0)
>> +char next;
>> +const char *value;
>> +notmuch_bool_t negate = FALSE;
>> +
>> +if (strncmp (arg, try->name, strlen (try->name)) == 0) {
>> +next = arg[strlen (try->name)];
>> +value = arg + strlen (try->name) + 1;
>> +} else if (negative_arg && (try->opt_bool || try->opt_flags) &&
>> +   strncmp (negative_arg, try->name, strlen (try->name)) == 0) {
>> +next = negative_arg[strlen (try->name)];
>> +value = negative_arg + strlen (try->name) + 1;
>> +/* The argument part of --no-argument matches, negate the result. */
>> +negate = TRUE;
>> +} else {
>>  continue;
>> -
>> -char next = arg[strlen (try->name)];
>> -const char *value = arg + strlen(try->name) + 1;
>> +}
>
> nit: I see strlen (try->name) computed 6 times here, any reason not to pull
> this out into a variable?

I pretty much thought the change was so controversial that I wouldn't
bother with that kind of fixes until we'd agreed we want this. Other
than that, agreed.

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


Re: [PATCH v2 1/2] python: open messages in binary mode

2017-10-02 Thread Florian Klink

merged series to master. Thanks for the fix. BTW, I noticed the bug only
happens with python3.


Thanks for merging :-)
Yes, most distributions still symlink /usr/bin/python to python2 - maybe that's
the reason why a lot of code still runs on python 2…
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2] devel: add script to test out-of-tree builds

2017-10-02 Thread David Bremner
Jani Nikula  writes:

> Something I used for 'git bisect run', but we should really add this
> as part of our process.

pushed.

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


Re: [PATCH 3/6] cli/new: check for special directories earlier in pass 1

2017-10-02 Thread David Bremner
Jani Nikula  writes:

> Avoid passing . and .. to ignore check. We don't need to check their
> dirent type either.

pushed 3 and 4

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


Re: [PATCH v2 1/2] python: open messages in binary mode

2017-10-02 Thread David Bremner
Florian Klink  writes:

> currently, notmuch's get_message_parts() opens the file in text mode and 
> passes
> the file object to email.message_from_file(fp). In case the email contains
> UTF-8 characters, reading might fail inside email.parser with the following 
> exception:
>

merged series to master. Thanks for the fix. BTW, I noticed the bug only
happens with python3.

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


Re: [PATCH 6/6] test: test regexp based new.ignore

2017-10-02 Thread David Bremner
David Bremner  writes:

> Jani Nikula  writes:
>
>> Just some basics.
>> ---
>>  test/T050-new.sh | 22 ++
>>  1 file changed, 22 insertions(+)
>
> Tests fail after applying this patch (output attached).
>
> It sortof looks like the regexp ignore is not working?

Oh, never mind, I out clevered myself managing patches and skipped the
one that actually enabled the regexp ignore handling.

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


Re: notmuch-emacs: Fcc to top-level directory given by database.path

2017-10-02 Thread Mark Walters

Hi

On Sun, 01 Oct 2017, Arun Isaac  wrote:
> Mark Walters  writes:
>
>> Incidentally, I think "/" is an alternative for the fcc line which
>> already works, which is "\"/\" in notmuch-fcc-dirs.
>
> Perhaps, notmuch should be made to tolerate a "/" at the beginning of the
> Fcc folder argument. That is, notmuch should not complain about absolute
> paths, and it should interpret these as relative to the root. To
> maintain backward compatibility, we could add a "/" at the beginning if
> it is not already there.
>
> So,
>
> "/" => database.path
> "/sent" => database.path/sent
> "sent" => database.path/sent
>
> etc.
>
> Is this a better idea?

The reason for the warning is that this behaviour is completely
different from what you would get with normal file fcc. Given that, I am
a little reluctant to drop the warning.

Best wishes

Mark

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