Re: question: how to change file extension generated by (notmuch-show-view-part)

2020-11-23 Thread Tomi Ollila
On Mon, Nov 23 2020, Wenlong Dai wrote:

> I've been trying to use links2 to view html part of messages.
> The problem I'm encountering is that, the part would be saved as
> /tmp/xxx/xxx.shtml and
> passed on to links2, and it seems links2 doesn't recognise the .shtml
> extension.
>
> netsurf works well with .shtml though.
>
> But being stubborn as I am, I would like to know if I can make notmuch
> output .html file instead?
> I did a bit of research on shtml, seems it's completely unnecessary in this
> case? why would notmuch choose this extension anyway?

I could not find any reference to .shtml in notmuch emacs mua sources
... nor could I find such in the "message" sources
(zgrep ... in /usr/share/emacs/{version}/lisp/gnus/*.gz)
notmuch emacs mua is using doing many of the things.

How did you configure emacs to use links2/netsurf to view html parts ?

(/usr/share/emacs/{version}/lisp/gnus/mm-view.elc.gz defines these
to be known and how those are executed:

--8<8<8<8<8<8<8<8<8<8<--
(defvar mm-text-html-renderer-alist
  '((shr . mm-shr)
(w3m . mm-inline-text-html-render-with-w3m)
(w3m-standalone . mm-inline-text-html-render-with-w3m-standalone)
(gnus-w3m . gnus-article-html)
(links mm-inline-render-with-file
   mm-links-remove-leading-blank
   "links" "-dump" file)
(lynx mm-inline-render-with-stdin nil
  "lynx" "-dump" "-force_html" "-stdin" "-nolist")
(html2text mm-inline-render-with-function html2text))
  "The attributes of renderer types for text/html.")
-->8>8>8>8>8>8>8>8>8>8--

Tomi
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Problems with unicode characters under emacs and Xorg

2020-11-03 Thread Tomi Ollila


Emacs versions involved ?

Tomi
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Clashes between "version" files and C++ keyword

2020-10-28 Thread Tomi Ollila
On Wed, Oct 28 2020, Ralph Seichter wrote:

> Building Notmuch on macOS is known to cause problems because the Notmuch
> distribution archive contains two files named "version". These clash
> with the  keyword as defined in C++20 [1] and will likely
> become obvious on other platforms as well once Compilers adopt the new
> standard.
>
> The two affected files in the Notmuch Git tree are
>
>   /bindings/python-cffi/version
>   /version
>
> I suggest to rename them both to version.txt. The attached patch can
> then be applied to make the necessary build file changes.

good stuff!

Could you send git am -able patch to the mailing list ?

Tomi

>
> -Ralph
>
> [1] https://en.cppreference.com/w/cpp/20#New_headers
>
> diff --git Makefile.global Makefile.global
> index cd489ef2..8477468d 100644
> --- Makefile.global
> +++ Makefile.global
> @@ -17,7 +17,7 @@ else
>  DATE:=$(shell date +%F)
>  endif
>  
> -VERSION:=$(shell cat ${srcdir}/version)
> +VERSION:=$(shell cat ${srcdir}/version.txt)
>  ELPA_VERSION:=$(subst ~,_,$(VERSION))
>  ifeq ($(filter release release-message pre-release 
> update-versions,$(MAKECMDGOALS)),)
>  ifeq ($(IS_GIT),yes)
> diff --git Makefile.local Makefile.local
> index c65cee7c..dde7981b 100644
> --- Makefile.local
> +++ Makefile.local
> @@ -19,7 +19,7 @@ endif
>  
>  # Depend (also) on the file 'version'. In case of ifeq ($(IS_GIT),yes)
>  # this file may already have been updated.
> -version.stamp: $(srcdir)/version
> +version.stamp: $(srcdir)/version.txt
>   echo $(VERSION) > $@
>  
>  $(TAR_FILE):
> diff --git bindings/python-cffi/setup.py bindings/python-cffi/setup.py
> index b0060835..cda52338 100644
> --- bindings/python-cffi/setup.py
> +++ bindings/python-cffi/setup.py
> @@ -1,6 +1,6 @@
>  import setuptools
>  
> -with open('version') as fp:
> +with open('version.txt') as fp:
>  VERSION = fp.read().strip()
>  
>  setuptools.setup(
> diff --git doc/conf.py doc/conf.py
> index 94e266af..11bed51d 100644
> --- doc/conf.py
> +++ doc/conf.py
> @@ -19,7 +19,7 @@ copyright = u'2009-2020, Carl Worth and many others'
>  location = os.path.dirname(__file__)
>  
>  for pathdir in ['.', '..']:
> -version_file = os.path.join(location,pathdir,'version')
> +version_file = os.path.join(location,pathdir,'version.txt')
>  if os.path.exists(version_file):
>  with open(version_file,'r') as infile:
>  version=infile.read().replace('\n','')
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Dependencies should include "realpath"

2020-10-20 Thread Tomi Ollila
On Tue, Oct 20 2020, Ralph Seichter wrote:

> * Tomi Ollila:
>
>>> rsti_dir = os.path.abspath('emacs')
>>
>> Good suggestion, anyway, the simplest change would be just:
>>
>> -  printf "rsti_dir = '%s'\n" $(realpath emacs)
>> +  printf "rsti_dir = '%s'\n" $(cd emacs && pwd -P)
>
> Looks like "pwd -P" is part of the Open Group base spec for pwd, so it
> should be available on supported platforms.

oh, you're right, I remembered configure was bash(1) script, but, it
has #!/bin/sh -- (although "traditional" bourne shell would not do it)

Thanks for checking!

(dropped our conversation about use of os.path... :D)

>
> -Ralph

Tomi
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] configure: replace $(realpath emacs) with $(cd emacs && pwd -P)

2020-10-20 Thread Tomi Ollila
For portability; the realpath command (e.g. from GNU coreutils)
is not so common outside Linux systems.

The "$(cd emacs && pwd -P)" replaces that realpath(1) execution
suitably in this context (using just bash(1) builtins).
---

Quotes ("") added for it to be better example for someone(tm) who
may look it while writing some other shell script elsewhere;
here, as $IFS characters are not (currently!) allowed in $PWD
those makes no difference...

 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 40e8b255..cfa9c09b 100755
--- a/configure
+++ b/configure
@@ -1536,7 +1536,7 @@ EOF
 if [ $WITH_PYTHON_DOCS = "1" ]; then
 echo "tags.add('WITH_PYTHON')"
 fi
-printf "rsti_dir = '%s'\n" $(realpath emacs)
+printf "rsti_dir = '%s'\n" "$(cd emacs && pwd -P)"
 } > sphinx.config
 
 # Finally, after everything configured, inform the user how to continue.
-- 
2.25.1
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Dependencies should include "realpath"

2020-10-19 Thread Tomi Ollila
On Sat, Oct 17 2020, Ralph Seichter wrote:

> * David Bremner:
>
>> Do you have a suggested replacement? I guess some inline perl with "use
>> Cwd 'realpath'" would probably work, although I haven't tested it.
>
> At a quick glance, that particular section of "configure" is run by
> doc/conf.py to generate three lines of Python code and store the result
> as sphinx.config, correct? If so, my preferred choice would be to use
> Python to figure out the absolute path, e.g. like so:
>
>   rsti_dir = os.path.abspath('emacs')

Good suggestion, anyway, the simplest change would be just:

-printf "rsti_dir = '%s'\n" $(realpath emacs)
+printf "rsti_dir = '%s'\n" $(cd emacs && pwd -P)

> This shows the generated result, and I assume that emacs is a directory
> in the source tree? I also wonder if an absolute directory path is really
> required for the doc-build to work.

Absolute path is safer when doing out-of-tree builds

> The segment of conf.py which uses the generated config file does not
> look convincing to me anyway. Apparently the original author did not
> like it either, which is why the segment is labelled as "hacky". It
> should probably be overhauled, and not only because it uses the
> statement open(rsti_dir+'/'+file) which will potentially fail, depending
> on the build platform.

Sure, the doc/conf.py is somewhat hacky, but has done the work for couple
of years already :D (not that anyone who would like to make is better would
not be welcome to do so). Then, just for the record, I think 
open(rsti_dir+'/'+file) is fine, and I don't see it failing on any
imaginable system notmuch work (now?;) -- I am even personally changing
some os.path.join(...) commands to use that concatenation instead, just
to reduce complexity and line count elsewhere...

Tomi

>
> -Ralph
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] emacs docs: rstdoc.el: consistent single quote conversions

2020-10-13 Thread Tomi Ollila
On Fri, Oct 09 2020, David Bremner wrote:

> Tomi Ollila  writes:
>
>> With text-quoting-style 'grave keeps "'" and "`" quotes unaltered
>> for further processing done by this code (regardless of locale...).
>> The tools that read the reStructuredText markup generated can do
>> their styling instead.
>
> Not a direct comment on your patch, but should we be setting some fixed
> locale when running emacs at build time?

If we did that, probably "C" would be the only choice (next could be
en_US.UTF-8, but at least I don't like the defaults that sets).

What would be better that we can ensure build reproducibility whatever
the locale settings are (I want to have my hilarious fi_FI.UTF-8 messages ;).

>
> d

Tomi
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] emacs docs: rstdoc.el: consistent single quote conversions

2020-10-09 Thread Tomi Ollila
With text-quoting-style 'grave keeps "'" and "`" quotes unaltered
for further processing done by this code (regardless of locale...).
The tools that read the reStructuredText markup generated can do
their styling instead.

Added temporary conversions of ' and ` to \001 and \002 so that
's and `s outside of `...' and `...` are converted separately
('s restored back to ' and `s converted to \`).

Both `...' and `...` are finally "converted" to `...` (not ``...``).
https://docutils.sourceforge.io/docs/user/rst/quickref.html documents
that as `interpreted text`:

 "The rendering and meaning of interpreted text is domain- or
  application-dependent. It can be used for things like index
  entries or explicit descriptive markup (like program identifiers)."

Which looks pretty much right.

---

Overhauled version of id:20200413104108.10837-1-tomi.oll...@iki.fi

When the default 'curve text quoting style was effective in UTF-8
locale, I experienced inconsistent conversions from `' to ‘’;
sometimes conversions weren't done (one more reason to use 'grave :)
---
 emacs/rstdoc.el | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/emacs/rstdoc.el b/emacs/rstdoc.el
index 63fa2794..4221f142 100644
--- a/emacs/rstdoc.el
+++ b/emacs/rstdoc.el
@@ -40,6 +40,7 @@ (defun rstdoc-extract (in-file out-file)
   "Write docstrings from IN-FILE to OUT-FILE."
   (load-file in-file)
   (let* ((definitions (cdr (assoc (expand-file-name in-file) load-history)))
+(text-quoting-style 'grave)
 (doc-hash (make-hash-table :test 'eq)))
 (mapc
  (lambda (elt)
@@ -65,11 +66,14 @@ (defun rstdoc--insert-docstring (symbol docstring)
   (insert "\n"))
 
 (defvar rst--escape-alist
-  '(("='" . "'")
-("\\([^\\]\\)'" . "\\1`")
-("^[[:space:]\t]*$" . "|br|")
-("^[[:space:]\t]" . "|indent| "))
-  "List of (regex . replacement) pairs.")
+  '( ("='" . "\001")
+ ("`\\([^\n`']*\\)[`']" . "\002\\1\002") ;; good enough for now...
+ ("`" . "`")
+ ("\001" . "'")
+ ("\002" . "`")
+ ("^[[:space:]]*$" . "|br|")
+ ("^[[:space:]]" . "|indent| "))
+"list of (regex . replacement) pairs")
 
 (defun rstdoc--rst-quote-string (str)
   (with-temp-buffer
-- 
2.25.1
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


ANNOUNCE: nottoomuch-addresses.sh 2.5

2020-10-03 Thread Tomi Ollila
ANNOUNCE: nottoomuch-addresses.sh 2.5

What is New in Version 2.5 (Sat 2020-10-03):

  Added reading of user-controlled file 'addresses.top'
  -- addresses to be matched first when searches done.

Get it from

https://github.com/domo141/nottoomuch/blob/master/nottoomuch-addresses.rst
https://github.com/domo141/nottoomuch/blob/master/nottoomuch-addresses.sh


Nottoomuch-addresses is an external address completion solution for notmuch.


Notmuch has good internal address completion solution, which is
automatically up to date all the time.
If you're happy with it, there is no need to look elsewhere.

(nottoomuch-addresses.sh --update has to be done to update address cache)

But for some of us that is not suitable enough.

The two reasons that come up to my mind are 1) it is slow, and 2) the
matches found are not suitably ordered.

Notmuch emacs mua "harvests" more addresses to its internal cache which 
mitigates the slowness aspect to some users (and bloats memory use; disk
cache ftw!?) -- for me that does not help as I tend to use lot of short
time "ephemeral" emacs processes and the caches would get lost all the
time.

For comparison (1), nottoomuch-address.sh does the address search using the
following command line (line 4 of nottoomuch-address.sh copied verbatim):

grep -aiF "$*" "${XDG_CONFIG_HOME:-$HOME/.config}/nottoomuch/addresses.active"

so that is as fast as the disk IO in user's computer (when cached, cpu (and
its caching) could be the bottleneck).


For (2) ordering (and content) of the addresses.active cache file, the perl5
program following the 'grep' line in nottoomuch-address.sh does:

First, opens and reads the actual email files in order of newest first
(up to latest sync), gathering both sender and receiver addresses -- so
newest and most complete list of addresses are made available first in
the addresses.active file.

Then, there are 2 user-controllable files that affect what gets written in
the addresses.active file:

1) addresses.ignore: addresses not to be included in addresses.active file,
   and thus will not be presented in search matches. See --help for more
   information

2) addresses.top (new in 2.5 -- this release): lines of addresses that are
   just added to the top of the addresses.active file. These addresses are
   first to be matched with the 'fgrep' command line when searches are done.


The "downside" (ymmv?) is that one has to have their own address cache for
the completions. In case of nottoomuch-addresses.sh maintaining that cache
has been made easy (run nottoomuch-addresses.sh --update). I usually don't
bother that much; if I try completions and don't seem to get right results,
then I run that --update and try again. That usually works. There is slight
change -- however -- that I get matches that I don't notice obsolete, which
--update could fix. The chance for that happen to me is somewhat smaller
than for someone(tm) who is more computer illiterate that I am.

Initially, nottoomuch-addresses.sh --rebuild 
(IIRC nottoomuch-addresses.sh --update does that by default if there is 
no 'addresses' file) takes some time (depending the number of one's email
files (but there is always nighttime one can leave computer to do things)).

7. Enjoy!

./nottoomuch-addresses.sh --help  provides more detailed usage information.

Tomi

PS: my latest nottoomuch-addresses --update executions -- my frequency of
updating the addresses cache files, for reference

20140916-211708.2130: sh -x ./nottoomuch-addresses.sh --since=2014-06-20 
--rebuild --exclude-path-re=foo::bar --update
20140917-185331.7091: ./nottoomuch-addresses.sh --update
20150505-162640.31139: nottoomuch-addresses.sh --update
20150511-220640.24045: nottoomuch-addresses.sh --update
20150826-203142.16496: nottoomuch-addresses.sh --update
20160513-fr-085215.964: nottoomuch-addresses.sh --update
20161110-th-214824.4256: nottoomuch-addresses.sh --update
20170106-fr-133011.601: nottoomuch-addresses.sh --update
20170430-su-151115.18628: nottoomuch-addresses.sh --update
20170502-tu-223519.8590: nottoomuch-addresses.sh --update
20180503-th-102438.16030: nottoomuch-addresses.sh --update
20180709-mo-105240.29097: nottoomuch-addresses.sh --update
20200423-th-205157.30151: nottoomuch-addresses.sh --update
20201003-sa-115101.1635: gh 3230 -H nottoomuch-addresses.*--update > 
20201003-sa-115101.1635: emacs 





___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] emacs: Remove notmuch-mua-message-send-hook

2020-09-13 Thread Tomi Ollila
On Sat, Sep 12 2020, Tim Quelch wrote:

> Currently `message-send-hook` functions are being called twice: In
> notmuch send common when `notmuch-mua-send-hook` functions are
> run (which by default includes `notmuch-mua-message-send-hook`) and in
> `message-send` itself.
>
> Because `message-send-hook` functions are run in `message-send` itself,
> we don't need also need to run them before we delegate to `message-send`
>
> Calling `notmuch-mua-message-send-hook` resulted in functions in
> `message-send-hook` to be called twice. This causes bugs in
> non-idempotent hook functions.

Looks good to me. everyone who rewrote notmuch-mua-message-send-hook
(i hope none) have to find better solution (or just...)

Hmm, this is defcustom. If that (old default) is stored in 
custom-set-variables have to remove it -- at least my  
custom-set-variables does not reference to this hook variable, so
most probably the effect (if any) is small...

Tomi

> ---
>  emacs/notmuch-mua.el | 7 +--
>  1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index dcddca76..03c7cc97 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -40,7 +40,7 @@
>  
>  ;;
>  
> -(defcustom notmuch-mua-send-hook '(notmuch-mua-message-send-hook)
> +(defcustom notmuch-mua-send-hook nil
>"Hook run before sending messages."
>:type 'hook
>:group 'notmuch-send
> @@ -601,11 +601,6 @@ unencrypted.  Really send? "
>(interactive)
>(message-kill-buffer))
>  
> -(defun notmuch-mua-message-send-hook ()
> -  "The default function used for `notmuch-mua-send-hook', this
> -simply runs the corresponding `message-mode' hook functions."
> -  (run-hooks 'message-send-hook))
> -
>  ;;
>  
>  (define-mail-user-agent 'notmuch-user-agent
> -- 
> 2.28.0
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] test: fix syntax errors in erroring calls to notmuch insert

2020-09-03 Thread Tomi Ollila
On Thu, Sep 03 2020, David Bremner wrote:

> notmuch insert does not currently support passing a filename for the
> input, so all of these tests have an extra error in addition to the
> one being tested for.
>
> Currently this does not make a difference because the error being
> tested for is caught before the error of an extra command line
> argument. In the future it might make a difference, and in any case it
> is confusing.

LGTM.

Tomi

> ---
>  test/T070-insert.sh | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/test/T070-insert.sh b/test/T070-insert.sh
> index c8161e1e..1c7ca846 100755
> --- a/test/T070-insert.sh
> +++ b/test/T070-insert.sh
> @@ -222,24 +222,24 @@ test_expect_equal "$output" "2"
>  
>  test_begin_subtest "Insert message, create invalid subfolder"
>  gen_insert_msg
> -test_expect_code 1 "notmuch insert --folder=../G --create-folder 
> $gen_msg_filename"
> +test_expect_code 1 "notmuch insert --folder=../G --create-folder < 
> $gen_msg_filename"
>  
>  OLDCONFIG=$(notmuch config get new.tags)
>  
>  test_begin_subtest "Empty tags in new.tags are forbidden"
>  notmuch config set new.tags "foo;;bar"
>  gen_insert_msg
> -output=$(notmuch insert $gen_msg_filename 2>&1)
> +output=$(notmuch insert < $gen_msg_filename 2>&1)
>  test_expect_equal "$output" "Error: tag '' in new.tags: empty tag forbidden"
>  
>  test_begin_subtest "Tags starting with '-' in new.tags are forbidden"
>  notmuch config set new.tags "-foo;bar"
>  gen_insert_msg
> -output=$(notmuch insert $gen_msg_filename 2>&1)
> +output=$(notmuch insert < $gen_msg_filename 2>&1)
>  test_expect_equal "$output" "Error: tag '-foo' in new.tags: tag starting 
> with '-' forbidden"
>  
>  test_begin_subtest "Invalid tags set exit code"
> -test_expect_code 1 "notmuch insert $gen_msg_filename 2>&1"
> +test_expect_code 1 "notmuch insert < $gen_msg_filename 2>&1"
>  
>  notmuch config set new.tags $OLDCONFIG
>  
> -- 
> 2.28.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v2] emacs: Use pop-to-buffer-same-window rather than switch-to-buffer

2020-08-22 Thread Tomi Ollila
On Tue, Aug 11 2020, Sean Whitton wrote:

> This means that notmuch commands obey display-buffer-alist so the user
> can customize how buffers show up.
>
> It also permits the use of C-x 4 4, C-x 5 5 and C-x t t, available in
> Emacs 28.  For example, one can use C-x 4 4 M-x notmuch-jump-search RET
> to open a saved search in another window rather than the current window.
> Or in notmuch-search mode, C-x 5 5 RET to view the message at point in
> a new frame.
>
> notmuch-tree has custom buffer display logic, so bind
> display-buffer-overriding-action to make pop-to-buffer-same-window
> behave exactly as switch-to-buffer while that function is running.
> ---
> Changes since v1: rebased onto latest master.

I've been having this in my emacs setup (one-notmuch.elc =D) couple
of days, and haven't seen anything strange.

Just now I tested a bit more, tried show and tree modes, with 
M-x debug-on-entry pop-to-buffer-same-window active and see some
call paths (interestingly (or not so), starting this mail composition
pop-to-buffer-same-window was not in call path -- but probably 
switch-to-buffer would be neither and there is no change in status quo)

So LGTM.

Tomi

>
>  emacs/notmuch-draft.el |  3 ++-
>  emacs/notmuch-hello.el |  2 +-
>  emacs/notmuch-show.el  |  8 
>  emacs/notmuch-tree.el  | 13 +
>  emacs/notmuch.el   |  4 ++--
>  5 files changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/emacs/notmuch-draft.el b/emacs/notmuch-draft.el
> index 759e6c9e..283830ad 100644
> --- a/emacs/notmuch-draft.el
> +++ b/emacs/notmuch-draft.el
> @@ -232,7 +232,8 @@ applied to newly inserted messages)."
>(draft (equal tags (notmuch-update-tags tags notmuch-draft-tags
>  (when (or draft
> (yes-or-no-p "Message does not appear to be a draft: edit as new? 
> "))
> -  (switch-to-buffer (get-buffer-create (concat "*notmuch-draft-" id 
> "*")))
> +  (pop-to-buffer-same-window
> +   (get-buffer-create (concat "*notmuch-draft-" id "*")))
>(setq buffer-read-only nil)
>(erase-buffer)
>(let ((coding-system-for-read 'no-conversion))
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index c127bba9..bb60a890 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -973,7 +973,7 @@ following:
>(let ((notmuch-hello-auto-refresh nil))
>  (if no-display
>   (set-buffer "*notmuch-hello*")
> -  (switch-to-buffer "*notmuch-hello*")))
> +  (pop-to-buffer-same-window "*notmuch-hello*")))
>;; Install auto-refresh hook
>(when notmuch-hello-auto-refresh
>  (add-hook 'window-configuration-change-hook
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index b0f2d28b..98d9c935 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1241,7 +1241,7 @@ matched."
>   (eval (car (get 'mm-inline-override-types 
> 'standard-value
>(cons "application/*" mm-inline-override-types)
>  mm-inline-override-types)))
> -(switch-to-buffer (get-buffer-create buffer-name))
> +(pop-to-buffer-same-window (get-buffer-create buffer-name))
>  ;; No need to track undo information for this buffer.
>  (setq buffer-undo-list t)
>  (notmuch-show-mode)
> @@ -1998,7 +1998,7 @@ to show, nil otherwise."
>(let* ((id (notmuch-show-get-message-id))
>(buf (get-buffer-create (concat "*notmuch-raw-" id "*")))
>(inhibit-read-only t))
> -(switch-to-buffer buf)
> +(pop-to-buffer-same-window buf)
>  (erase-buffer)
>  (let ((coding-system-for-read 'no-conversion))
>(call-process notmuch-command nil t nil "show" "--format=raw" id))
> @@ -2057,7 +2057,7 @@ message."
> (set-buffer-modified-p nil)
> (setq buffer-read-only t)
> (unless (zerop exit-code)
> - (switch-to-buffer-other-window buf)
> + (pop-to-buffer buf)
>   (message (format "Command '%s' exited abnormally with code %d"
>shell-command exit-code
>  
> @@ -2465,7 +2465,7 @@ If the part is displayed in an external application 
> then close
>  the new buffer."
>(let ((buf (get-buffer-create (generate-new-buffer-name
>(concat " *notmuch-internal-part*")
> -(switch-to-buffer buf)
> +(pop-to-buffer-same-window buf)
>  (if (eq (mm-display-part handle) 'external)
>   (kill-buffer buf)
>(goto-char (point-min))
> diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
> index fbba4bb3..f36a6e72 100644
> --- a/emacs/notmuch-tree.el
> +++ b/emacs/notmuch-tree.el
> @@ -543,9 +543,14 @@ NOT change the database."
>(setq notmuch-tree-message-window
>   (split-window-vertically (/ (window-height) 4)))
>(with-selected-window notmuch-tree-message-window
> - ;; Since we are only displaying one message do not indent.
> - (let ((notmuch-show-indent-messages-width 0)
> -   

[PATCH] NEWS: notmuch-mutt: system(shell pipeline) replaced internally

2020-08-17 Thread Tomi Ollila
---
 NEWS | 8 
 1 file changed, 8 insertions(+)

diff --git a/NEWS b/NEWS
index 4160e39c9c30..b25bfaa38254 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,14 @@ Emacs
 
 The minimum supported major version of GNU Emacs is now 25.1.
 
+Notmuch-Mutt
+
+
+The shell pipeline executed by notmuch-mutt, which symlinked matched
+files to a maildir for mutt to access is replaced with internal perl
+processing. This search operation is now more portable, and somewhat
+faster.
+
 Notmuch 0.30 (2020-07-10)
 =
 
-- 
2.13.3
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 1/2] Emacs: Add a new function for balancing bidi control chars

2020-08-16 Thread Tomi Ollila
On Sat, Aug 15 2020, Teemu Likonen wrote:

> The following Unicode's bidirectional control chars are modal so that
> they push a new bidirectional rendering mode to a stack:
>
> U+202A LEFT-TO-RIGHT EMBEDDING
> U+202B RIGHT-TO-LEFT EMBEDDING
> U+202D LEFT-TO-RIGHT OVERRIDE
> U+202E RIGHT-TO-LEFT OVERRIDE

Good stuff -- implementation looks like port of the php code in 

   https://www.iamcal.com/understanding-bidirectional-text

to emacs lisp... anyway nice implementation took be a bit of
time for me to understand it...

thoughts

- is it slow to execute it always, pure lisp implementation;
  (string-match "[\u202a-\u202e]") could be done before that.
  (if it were executed often could loop with `looking-at`
   (and then moving point based on match-end) be faster...

- *but* adding U+202C's in `notmuch-sanitize` is doing it too early, as
  some functions truncate the strings afterwards if those are too long
  (e.g. `notmuch-search-insert-authors`) so those get lost.. 

- what about https://en.wikipedia.org/wiki/Bidirectional_text#Isolates
  (was documented more in some page, cannot find it anymore...)

(what I noticed when looking `notmuch-search-insert-authors` that it uses
 `length` to check the length of a string -- but that also counts these bidi
 mode changing "characters" (as one char). `string-width` would be better
 there -- and probably in many other places.)

(I tried quite a few things, something that could "reset" the stack with
 e.g. one invisible tab, but no go (or that was filtered as I added it
 to `notmuch-sanitize` ;), As a final step I did

  (defun notmuch-sanitize (str)
  ...
  -  (replace-regexp-in-string "[[:cntrl:]\x7f\u2028\u2029]+" " " str))
  +  (replace-regexp-in-string
  +   "[\u202A-\u202E\u2066-\u2069]" ""
  +   (replace-regexp-in-string "[[:cntrl:]\x7f\u2028\u2029]+" " " str)))

just to test-drop those chars. probably not good enough ;/)


Tomi

>
> Every mode must be terminated with with character U+202C POP
> DIRECTIONAL FORMATTING which pops the mode from the stack. The stack
> is per paragraph. A new text paragraph resets the rendering mode
> changed by these control characters.
>
> This change adds a new function "notmuch-balance-bidi-ctrl-chars"
> which reads its STRING argument and ensures that all push
> characters (U+202A, U+202B, U+202D, U+202E) have a pop character
> pair (U+202C). The function may add more U+202C characters at the end
> of the returned string, or it may remove some U+202C characters. The
> returned string is safe in the sense that it won't change the
> surrounding bidirectional rendering mode. This function should be used
> when sanitizing arbitrary input.
> ---
>  emacs/notmuch-lib.el | 54 
>  1 file changed, 54 insertions(+)
>
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 118faf1e..e6252c6c 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -469,6 +469,60 @@ be displayed."
>   "[No Subject]"
>subject)))
>  
> +
> +(defun notmuch-balance-bidi-ctrl-chars (string)
> +  "Balance bidirectional control chars in STRING.
> +
> +The following Unicode's bidirectional control chars are modal so
> +that they push a new bidirectional rendering mode to a stack:
> +U+202A LEFT-TO-RIGHT EMBEDDING, U+202B RIGHT-TO-LEFT EMBEDDING,
> +U+202D LEFT-TO-RIGHT OVERRIDE and U+202E RIGHT-TO-LEFT OVERRIDE.
> +Every mode must be terminated with with character U+202C POP
> +DIRECTIONAL FORMATTING which pops the mode from the stack. The
> +stack is per paragraph. A new text paragraph resets the rendering
> +mode changed by these control characters.
> +
> +This function reads the STRING argument and ensures that all push
> +characters (U+202A, U+202B, U+202D, U+202E) have a pop character
> +pair (U+202C). The function may add more U+202C characters at the
> +end of the returned string, or it may remove some U+202C
> +characters. The returned string is safe in the sense that it
> +won't change the surrounding bidirectional rendering mode. This
> +function should be used when sanitizing arbitrary input."
> +
> +  (let ((new-string nil)
> + (stack-count 0))
> +
> +(cl-flet ((push-char-p (c)
> + ;; U+202A LEFT-TO-RIGHT EMBEDDING
> + ;; U+202B RIGHT-TO-LEFT EMBEDDING
> + ;; U+202D LEFT-TO-RIGHT OVERRIDE
> + ;; U+202E RIGHT-TO-LEFT OVERRIDE
> + (cl-find c '(?\u202a ?\u202b ?\u202d ?\u202e)))
> +   (pop-char-p (c)
> + ;; U+202C POP DIRECTIONAL FORMATTING
> + (eql c ?\u202c)))
> +
> +  (cl-loop for char across string
> +do (cond ((push-char-p char)
> +  (cl-incf stack-count)
> +  (push char new-string))
> + ((and (pop-char-p char)
> +   (cl-plusp stack-count))
> +  (cl-decf stack-count)
> +  (push char new-string))
> +   

Re: [PATCH] devel/release-checks.sh: use grep to find copyright year.

2020-08-16 Thread Tomi Ollila
On Sun, Aug 16 2020, David Bremner wrote:

> This is quite fragile, but it works for now, unlike the python
> version.
>
> In general it seems conf.py is not intended to be evaluated outside of
> sphinx, as it assumes certain global names (in particular "tags") are
> defined.
> ---
>
>  I am going to apply this to unblock the release process, but I
>  welcome better solutions.

for this case solution is good enough...

>  
>  devel/release-checks.sh | 5 +
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/devel/release-checks.sh b/devel/release-checks.sh
> index 7ba94822..cfa208d5 100755
> --- a/devel/release-checks.sh
> +++ b/devel/release-checks.sh
> @@ -178,10 +178,7 @@ esac
>  year=`exec date +%Y`
>  echo -n "Checking that copyright in documentation contains 2009-$year... "
>  # Read the value of variable `copyright' defined in 'doc/conf.py'.
> -# As __file__ is not defined when python command is given from command line,
> -# it is defined before contents of 'doc/conf.py' (which dereferences 
> __file__)
> -# is executed.
> -copyrightline=`exec python -c "with open('doc/conf.py') as cf: __file__ = 
> ''; exec(cf.read()); print(copyright)"`
> +copyrightline=$(grep ^copyright doc/conf.py)

For consistency and to save one fork(2) $(exec grep ...), but I could
live with this, too ;D

So LGTM.

Tomi

(2) bash forks for subshell and then for grep, even in this trivial case.
Other shells fork only once.

>  case $copyrightline in
>   *2009-$year*)
>   echo Yes. ;;
> -- 
> 2.28.0
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: New release for Emacs 27.1?

2020-08-11 Thread Tomi Ollila
On Wed, Aug 12 2020, Damien Cassou wrote:

> Hi,
>
> Emacs 27.1 being officially out, is it the right moment to release
> Notmuch? People will face problems otherwise because Notmuch got some
> fixes for Emacs 27.1 recently.

Release cycle for 0.31 could be shorter, just for that reason. 

There are 2 patch (series) (re)sent yesterday, which could be considered
for inclusion, provided we get those reviewed and tested =D

See https://nmbug.notmuchmail.org/status/#Review

(Not to forget older good (also emacs-related) changes that are in
 review queue, but those need more to get into -- and/or don't apply
 anymore due to merge conflict...)

Tomi

>
> Best,
>
> -- 
> Damien Cassou
>
> "Success is the ability to go from one failure to another without
> losing enthusiasm." --Winston Churchill
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] configure: Check if emacs >= 25 (instead of >= 24) is available

2020-08-11 Thread Tomi Ollila
"The minimum supported major version of GNU Emacs is now 25.1."

25.1 is the first "released" version of Emacs 25.
---
 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index a357eb91..40e8b255 100755
--- a/configure
+++ b/configure
@@ -829,8 +829,8 @@ if [ -z "${EMACSETCDIR-}" ]; then
 fi
 
 if [ $WITH_EMACS = "1" ]; then
-printf "Checking if emacs (>= 24) is available... "
-if emacs --quick --batch --eval '(if (< emacs-major-version 24) 
(kill-emacs 1))' > /dev/null 2>&1; then
+printf "Checking if emacs (>= 25) is available... "
+if emacs --quick --batch --eval '(if (< emacs-major-version 25) 
(kill-emacs 1))' > /dev/null 2>&1; then
 printf "Yes.\n"
 else
 printf "No (disabling emacs related parts of build)\n"
-- 
2.26.2
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v3 00/34] A great number of cosmetic changes

2020-08-09 Thread Tomi Ollila
On Sun, Aug 09 2020, David Bremner wrote:

> Jonas Bernoulli  writes:
>>
>> Jonas Bernoulli (34):
>>   emacs: Shorten long lines
>>   emacs: Remove excess empty lines
>
>
> These patches (and Đoàn Trần Công Danh's that I just applied by hand)
> both seem to have problem with base64 encoded patches documented at.
>
>  https://lore.kernel.org/git/20191218194144.gl17...@pobox.com/
>
> It seems that the patches have CRLF line endings inside the base64
> encoding, and git fails to strip the CRs.
>
> I'm not sure why this happens for some patches and not for others;
> I hope there is not re-encoding happening on the mailing list. If there
> is we should fix that.
>
> The practical upshot is that I can't really apply such a long series by
> hand. Ideas welcome. A short term fix would be to fetch a ref from
> somewhere. OTOH, I hope this isn't going to be a recurring problem.

--ignore-whitespace could help...

for the --no-keep-cr (the default) not to work, in thread containing this

   https://lkml.org/lkml/2019/12/1/69

may give some hint why the situation is as unclear as it is now...

Tomi

> d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v3 00/34] A great number of cosmetic changes

2020-08-09 Thread Tomi Ollila
On Sat, Aug 08 2020, Jonas Bernoulli wrote:

> David Bremner  writes:
>
>> Tomi Ollila  writes:
>
>>> So we have 3 options:
>>>
>>> 1) apply this patch and now drop support for emacs 24
>>>
>>> 2) apply this patch and somehow infor emacs 24 users to install cl-lib from
>>> ELPA
>>
>> I'm fine with either of these options. I'd hope we can specify what
>> versions we need in emacs/notmuch-pkg.el.templ
>
> I went with option 1: drop support for emacs 24.  Instead of just
> adding a NEWS entry and bump a number, I also removed some old cruft
> that was only necessary for emacs 24 (and in some cases emacs 23!).

I made a quick check of release dates of emacs 25.1, gmime 3 and xapian 1.4
-- gmime 3 released early 2017, xapian 1.4 middle of 2016 and emacs 25.1
sept 2016 -- so requiring emacs 25.1 is pretty much aligned to those
releases and therefore dropping emacs 24 support looks good to me.

> That resulted in a few new commits of course, marked with * below.
> And since I had to add some commit anyway, I also added three other
> minor commits, marked with ^ below.

I checked the new commits, looks good to me. I also was preparing dropping
emacs 23 support code and the changes aligned what I tried. Interestinglyy
this change in notmuch-mua.el:
  ;; There is a bug in emacs 23's message.el that results in a newline
  ;; not being inserted after the References header, so the next header
  ;; is concatenated to the end of it. 
Is still effective in emacs 26.3 -- I wonder whether there is something
wrong notmuch-emacs handles the case `notmuch-mua-insert-references` is
needed.

I trust the earlier changes are the same as in v2 and v1

Tomi


>
>  Cheers,
>  Jonas
>
> Jonas Bernoulli (34):
>   emacs: Shorten long lines
>   emacs: Remove excess empty lines
>   emacs: Fix indentation
>   emacs: Closing parenthesis go on the same line
>   emacs: Only set one variable per setq form
>   emacs: Use 'and' instead of 'when' when the return value matters
>   emacs: Use 'unless' instead of 'when' and 'not'
>   emacs: Use 'when' instead of 'if' when there is no ELSE part
>   emacs: Use one or three lines for 'if' forms
>   emacs: Extend face to window edge again
>   emacs: Fix some function declarations
>   emacs: No longer define notmuch-hello-mode-map as a function
>   emacs: notmuch-poll: Let the user know we are polling
>   emacs: Use makefile-gmake-mode in Makefile*s
>   emacs: Improve doc-strings
>   emacs: Autoload notmuch-jump-search only once
>   emacs: Autoload notmuch-jump using an autoload cookie
>   emacs: Various cosmetic changes
>   emacs: Increase consistency of library headers
>   Fix typos
>   .dir-locals.el: Set variables for correct "shell" mode
>   test: Fix indentation
> ^ .gitignore: Sort using sort-lines
> ^ emacs: Provide 'rstdoc' feature at end of file
> ^ emacs: Add end-of-file line to libraries that lack it
> * NEWS: Add stub for 0.31
> * NEWS: At least Emacs 25.1 is required now
> * emacs: Use cl-incf where appropriate
> * emacs: Remove notmuch-setq-local
> * emacs: Remove notmuch-read-char-choice
> * emacs: Drop old advices that were only need for Emacs 23
> * emacs: Do not abuse advice to monkey patch while testing
> * emacs: Use new advice mechanism do advice mm-shr
> * try-emacs-mua: Trim `require' advice for Emacs 25
>
>  .dir-locals.el |   2 +-
>  .gitignore |  28 +-
>  Makefile.global|   1 +
>  Makefile.local |   2 +-
>  NEWS   |  10 +-
>  bindings/Makefile.local|   2 +-
>  bindings/python-cffi/notmuch2/__init__.py  |   2 +-
>  bindings/python-cffi/notmuch2/_base.py |   6 +-
>  bindings/python-cffi/notmuch2/_database.py |   8 +-
>  bindings/python-cffi/notmuch2/_message.py  |   4 +-
>  bindings/python-cffi/notmuch2/_tags.py |   8 +-
>  bindings/python-cffi/tests/conftest.py |   2 +-
>  bindings/python/notmuch/database.py|  12 +-
>  bindings/python/notmuch/query.py   |   2 +-
>  compat/Makefile.local  |   2 +-
>  completion/Makefile.local  |   2 +-
>  devel/try-emacs-mua|  26 +-
>  doc/Makefile.local |   2 +-
>  emacs/Makefile.local   |   2 +-
>  emacs/coolj.el |  24 +-
>  emacs/make-deps.el |   7 +-
>  emacs/notmuch-address.el   | 188 -
>  emacs/notmuch-company.el   |  56 +--
>  emacs/notmuch-compat.el|  88 +
>  emacs/notmuch-crypto.el|  4

Re: [PATCH v2] configure: check for pytest with python -m pytest

2020-08-07 Thread Tomi Ollila
On Mon, Aug 03 2020, Đoàn Trần Công Danh wrote:

> On different distro, pytest is suffixed with different patterns.
>
> On the other hand, `python3-pytest' could be invoked correctly,
> via `python3 -m pytest', the latter is used by our tests, now.
>
> Switch to `$python -m pytest` to fix address all incompatible naming.
>
> Signed-off-by: Đoàn Trần Công Danh 

THis series looks good to me on my terminal, but does not apply 
to my tree (HEAD commit: 0e4695ab (origin/master) test: regression tests for 
n_indexopts_{get,set}_decrypt_policy)

Tomi

> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index db3538b3..f7c1c095 100755
> --- a/configure
> +++ b/configure
> @@ -814,7 +814,7 @@ if [ $have_python3 -eq 1 ]; then
>  printf "Checking for python3 pytest (>= 3.0)... "
>  conf=$(mktemp)
>  printf "[pytest]\nminversion=3.0\n" > $conf
> -if pytest-3 -c $conf --version >/dev/null 2>&1; then
> +if "$python" -m pytest -c $conf --version >/dev/null 2>&1; then
>  printf "Yes.\n"
>  have_python3_pytest=1
>  else
> -- 
> 2.28.0.163.g6104cc2f0b
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v2 06/23] emacs: Use cl-incf where appropriate

2020-08-07 Thread Tomi Ollila
On Thu, Aug 06 2020, Jonas Bernoulli wrote:

> David Bremner  writes:
>> "cl-incf is a Lisp macro in ‘aquamacs-tools.el’."
>>
>> What the actual heck?
>
> Indeed.  Did you follow the link to the definition to figure out what's
> going on?
>
> Ah... I found this: https://github.com/dholm/tabbar/commit/6d5a6935879.
> IMO it's wrong to do that, but that is of no concern here.
>
>> Anyway, that aside, what version of emacs is this available from?
>
> Emacs 24.3.  A forward compatibility implementation for older versions
> is available at https://elpa.gnu.org/packages/cl-lib.html.
>
> I didn't find any information about what minimal Emacs version Notmuch
> expects but https://notmuchmail.org/emacstips/#index1h2 implies that it
> is 24.1.
>
> IMO it would be reasonable to expect at least 24.3, 24.5 or even 25.1.
> See https://www.gnu.org/software/emacs/history.html for release dates.

NEWS for notmuch 0.29 says that:

"
The minimum supported major version of Emacs is now 24.

Support for GNU Emacs older than 25.1 is deprecated with this release,
and may be removed in a future release.
"

So we have 3 options:

1) apply this patch and now drop support for emacs 24

2) apply this patch and somehow infor emacs 24 users to install cl-lib from
ELPA

3) hold this particular patch until notmuch 0.31 is released and drop
support for emacs 24 then (would that mean quite a few following patches
not to apply anymore ;/


Anyway, the patch series V2 looked good to me (on terminal)

Tomi


>
> Or you might want to just drop this commit.  Or we could update the FAQ
> to mention that one has to install cl-lib from GNU ELPA if one uses such
> an ancient Emacs release.
>
>  Jonas
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 1/2] test: drop NOTMUCH_DEFAULT_XAPIAN_BACKEND from T360-symbol-test

2020-07-31 Thread Tomi Ollila
On Wed, Jul 29 2020, David Bremner wrote:

> Inspired by the suggestion of
>
>  id:20200727154108.16269-3-congdan...@gmail.com
>
> to drop the configuration test for the default backend. This version
> is hopefully robust against backend changes.
> ---
>  test/T360-symbol-hiding.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh
> index 43921cb4..4f1eb605 100755
> --- a/test/T360-symbol-hiding.sh
> +++ b/test/T360-symbol-hiding.sh
> @@ -14,11 +14,11 @@ test_description='exception symbol hiding'
>  test_begin_subtest 'running test' run_test
>  mkdir -p ${PWD}/fakedb/.notmuch
>  $TEST_DIRECTORY/symbol-test ${PWD}/fakedb ${PWD}/nonexistent 2>&1 \
> - | notmuch_dir_sanitize | sed -e "s,\`,\',g" -e 
> "s,${NOTMUCH_DEFAULT_XAPIAN_BACKEND},backend,g" > OUTPUT
> +| notmuch_dir_sanitize | sed -e "s,\`,\',g" -e "s,No [^ \t]* 
> database,No XX database,g" > OUTPUT

Restore lost tab in the beginning of line, use [^[:space:]] for portability

Tomi

>  
>  cat < EXPECTED
>  A Xapian exception occurred opening database: Couldn't stat 
> 'CWD/fakedb/.notmuch/xapian'
> -caught No backend database found at path 'CWD/nonexistent'
> +caught No XX database found at path 'CWD/nonexistent'
>  EOF
>  test_expect_equal_file EXPECTED OUTPUT
>  
> -- 
> 2.27.0
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 00/23] A create number of cosmetic changes

2020-07-30 Thread Tomi Ollila
On Sun, Jul 26 2020, Jonas Bernoulli wrote:

> Hello,
>
> Please forgive me for this wall of unsolicited cleanup; I blame it
> on a mild form of ocd.  I made most of these changes a few months
> ago when I was splitting the libraries into `outline-minor-mode'
> compatible sections.  To do so I had to have some understanding of the
> code I was splitting up and that closer look led to me discovering
> issues and once I had ran into a bunch of issue of the same kind it
> made sense to systematically look for that kind across all elisp
> files.
>
> Well, one thing led to another and here we are with 23 cleanup
> commits, some of which are fairly big on their own.  I just looked
> at very change again; everything looks to be in order.
>
> I am intentionally leaving out that one commit that actually does
> what I originally set out to do.  In some cases I will need to gain
> a deeper understanding before I can finish splitting libraries into
> sections.

Series looks good to me (as far as I can tell). That one comment
indentation in id:20200726165818.400-4-jo...@bernoul.li is what popped up
in my review (I did review only diff patch, and don't know how that
actually look -- like in those spaces after do in my previous reply, those
look good to me now)

One thing that come into my minw while browsing through patches -- does
changing if's to when's accumulate any bloat -- or does byte compiler
optimize that "extra" 'progn out in  (list 'if cond (cons 'progn body))).


>
>  Cheers,
>  Jonas

Tomi


>
> Jonas Bernoulli (23):
>   emacs: Shorten long lines
>   emacs: Remove excess empty lines
>   emacs: Fix indentation
>   emacs: Closing parenthesis go on the same line
>   emacs: Only set one variable per setq form
>   emacs: Use cl-incf where appropriate
>   emacs: Use 'and' instead of 'when' when the return value matters
>   emacs: Use 'unless' instead of 'when' and 'not'
>   emacs: Use 'when' instead of 'if' when there is no ELSE part
>   emacs: Use one or three lines for 'if' forms
>   emacs: Extend face to window edge again
>   emacs: Fix some function declarations
>   emacs: No longer define notmuch-hello-mode-map as a function
>   emacs: notmuch-poll: Let the user know we are polling
>   emacs: Use makefile-gmake-mode in Makefile*s
>   emacs: Improve doc-strings
>   emacs: Autoload notmuch-jump-search only once
>   emacs: Autoload notmuch-jump using an autoload cookie
>   emacs: Various cosmetic changes
>   emacs: Increase consistency of library headers
>   Fix typos
>   .dir-locals.el: Set variables for correct "shell" mode
>   test: Fix indentation
>
>  .dir-locals.el |   2 +-
>  Makefile.global|   1 +
>  Makefile.local |   2 +-
>  NEWS   |   2 +-
>  bindings/Makefile.local|   2 +-
>  bindings/python-cffi/notmuch2/__init__.py  |   2 +-
>  bindings/python-cffi/notmuch2/_base.py |   6 +-
>  bindings/python-cffi/notmuch2/_database.py |   8 +-
>  bindings/python-cffi/notmuch2/_message.py  |   4 +-
>  bindings/python-cffi/notmuch2/_tags.py |   8 +-
>  bindings/python-cffi/tests/conftest.py |   2 +-
>  bindings/python/notmuch/database.py|  12 +-
>  bindings/python/notmuch/query.py   |   2 +-
>  compat/Makefile.local  |   2 +-
>  completion/Makefile.local  |   2 +-
>  doc/Makefile.local |   2 +-
>  emacs/Makefile.local   |   2 +-
>  emacs/coolj.el |  24 +-
>  emacs/make-deps.el |   5 +-
>  emacs/notmuch-address.el   | 186 -
>  emacs/notmuch-company.el   |  53 ++-
>  emacs/notmuch-compat.el|  99 +++--
>  emacs/notmuch-crypto.el|  49 ++-
>  emacs/notmuch-draft.el |  24 +-
>  emacs/notmuch-hello.el | 102 +++--
>  emacs/notmuch-jump.el  |  61 ++-
>  emacs/notmuch-lib.el   | 204 +-
>  emacs/notmuch-maildir-fcc.el   | 122 +++---
>  emacs/notmuch-message.el   |   3 +-
>  emacs/notmuch-mua.el   | 181 -
>  emacs/notmuch-parser.el|  16 +-
>  emacs/notmuch-print.el |   2 +-
>  emacs/notmuch-query.el |  29 +-
>  emacs/notmuch-show.el  | 439 ++---
>  emacs/notmuch-tag.el   |  38 +-
>  emacs/notmuch-tree.el  | 189 -
>  emacs/notmuch-wash.el  | 109 +++--
>  emacs/notmuch.el   | 276 ++---
>  emacs/rstdoc.el|  18 +-
>  lib/Makefile.local |   2 +-
>  lib/notmuch.h  |   4 +-
>  parse-time-string/Makefile.local   |   2 +
>  

Re: [PATCH 03/23] emacs: Fix indentation

2020-07-30 Thread Tomi Ollila
On Sun, Jul 26 2020, Jonas Bernoulli wrote:

> ---
>  emacs/coolj.el |  16 ++---
>  emacs/notmuch-address.el   |  18 +++---
>  emacs/notmuch-compat.el|  86 -
>  emacs/notmuch-draft.el |  18 +++---
>  emacs/notmuch-hello.el |  24 +++
>  emacs/notmuch-lib.el   |  56 -
>  emacs/notmuch-maildir-fcc.el   |  58 -
>  emacs/notmuch-mua.el   |  34 +-
>  emacs/notmuch-query.el |   6 +-
>  emacs/notmuch-show.el  | 111 +
>  emacs/notmuch-tag.el   |   4 +-
>  emacs/notmuch-tree.el  | 102 +++---
>  emacs/notmuch-wash.el  |   2 +-
>  emacs/notmuch.el   |  76 +++---
>  test/emacs-address-cleaning.el |   2 +-
>  15 files changed, 307 insertions(+), 306 deletions(-)
>
> diff --git a/emacs/coolj.el b/emacs/coolj.el
> index 5d311170..961db606 100644
> --- a/emacs/coolj.el
> +++ b/emacs/coolj.el
> @@ -108,11 +108,11 @@ (defun coolj-set-breakpoint (prefix)
>  line."
>(move-to-column fill-column)
>(if (and (re-search-forward "[^ ]" (line-end-position) 1)
> -   (> (current-column) fill-column))
> +(> (current-column) fill-column))
>;; This line is too long.  Can we break it?
>(or (coolj-find-break-backward prefix)
> -  (progn (move-to-column fill-column)
> - (coolj-find-break-forward)
> +   (progn (move-to-column fill-column)
> +  (coolj-find-break-forward)
>  
>  (defun coolj-find-break-backward (prefix)
>"Move point backward to the first available breakpoint and return t.
> @@ -135,12 +135,12 @@ (defun coolj-find-break-forward ()
>  If no break point is found, return nil."
>(and (search-forward " " (line-end-position) 1)
> (progn (skip-chars-forward " " (line-end-position))
> -  (null (eolp)))
> +   (null (eolp)))
> (if (and fill-nobreak-predicate
> -(run-hook-with-args-until-success
> - 'fill-nobreak-predicate))
> -   (coolj-find-break-forward)
> - t)))
> + (run-hook-with-args-until-success
> +  'fill-nobreak-predicate))
> +(coolj-find-break-forward)
> +  t)))
>  
>  (provide 'coolj)
>  
> diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
> index ca4da3f3..09dda247 100644
> --- a/emacs/notmuch-address.el
> +++ b/emacs/notmuch-address.el
> @@ -153,14 +153,14 @@ (defcustom notmuch-address-use-company t
>  
>  (defun notmuch-address-setup ()
>(let* ((setup-company (and notmuch-address-use-company
> -(require 'company nil t)))
> +  (require 'company nil t)))
>(pair (cons notmuch-address-completion-headers-regexp
> -#'notmuch-address-expand-name)))
> -  (when setup-company
> - (notmuch-company-setup))
> -  (unless (member pair message-completion-alist)
> - (setq message-completion-alist
> -   (push pair message-completion-alist)
> +  #'notmuch-address-expand-name)))
> +(when setup-company
> +  (notmuch-company-setup))
> +(unless (member pair message-completion-alist)
> +  (setq message-completion-alist
> + (push pair message-completion-alist)
>  
>  (defun notmuch-address-toggle-internal-completion ()
>"Toggle use of internal completion for current buffer.
> @@ -323,7 +323,7 @@ (defun notmuch-address-harvest ( addr-prefix 
> synchronous callback)
>,query)))
>  (if synchronous
>   (mapc #'notmuch-address-harvest-addr
> -(apply 'notmuch-call-notmuch-sexp args))
> +   (apply 'notmuch-call-notmuch-sexp args))
>;; Asynchronous
>(let* ((current-proc (if addr-prefix
>  (car notmuch-address-harvest-procs)
> @@ -390,7 +390,7 @@ (defun notmuch-address--load-address-hash ()
>  (defun notmuch-address--save-address-hash ()
>(when notmuch-address-save-filename
>  (if (or (not (file-exists-p notmuch-address-save-filename))
> -   ;; The file exists, check it is a file we saved
> + ;; The file exists, check it is a file we saved
>   (notmuch-address--get-address-hash))
>   (with-temp-file notmuch-address-save-filename
> (let ((save-plist
> diff --git a/emacs/notmuch-compat.el b/emacs/notmuch-compat.el
> index 2cedd39d..388ef70f 100644
> --- a/emacs/notmuch-compat.el
> +++ b/emacs/notmuch-compat.el
> @@ -35,7 +35,7 @@ (if (fboundp 'setq-local)
>  (if (fboundp 'read-char-choice)
>  (defalias 'notmuch-read-char-choice 'read-char-choice)
>(defun notmuch-read-char-choice (prompt chars  
> inhibit-keyboard-quit)
> -  "Read and return one of CHARS, prompting for PROMPT.
> +"Read and return one of CHARS, prompting for PROMPT.
>  Any input that is not one of CHARS is 

[PATCH] notmuch-mutt: replace shell pipeline with internal pipe processing

2020-07-27 Thread Tomi Ollila
The shell pipeline used to symlink files based in search results
to "cache" directory for mutt(1) to use was prone to portability
problems (due to /bin/sh differences).

The replacement executes `notmuch search` without intermediate shell
(so shell_quote was removed in this case), reads the filenames from
piped output and symlinks files internally.
---

Now also tested a bit by me (remoteusage provides stale symlinks ;)

 contrib/notmuch-mutt/notmuch-mutt | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/contrib/notmuch-mutt/notmuch-mutt 
b/contrib/notmuch-mutt/notmuch-mutt
index d33223bd..d1e2c084 100755
--- a/contrib/notmuch-mutt/notmuch-mutt
+++ b/contrib/notmuch-mutt/notmuch-mutt
@@ -12,6 +12,7 @@ use strict;
 use warnings;
 
 use File::Path;
+use File::Basename;
 use Getopt::Long qw(:config no_getopt_compat);
 use Mail::Header;
 use Mail::Box::Maildir;
@@ -41,16 +42,17 @@ sub search($$$) {
 my ($maildir, $remove_dups, $query) = @_;
 my $dup_option = "";
 
-$query = shell_quote($query);
-
-if ($remove_dups) {
-  $dup_option = "--duplicate=1";
-}
+my @args = qw/notmuch search --output=files/;
+push @args, "--duplicate=1" if $remove_dups;
+push @args, $query;
 
 empty_maildir($maildir);
-system("notmuch search --output=files $dup_option $query"
-  . " | sed -e 's: : :g'"
-  . " | while IFS= read -r searchoutput; do ln -s \$searchoutput 
$maildir/cur/; done");
+open my $pipe, '-|', @args or die "Running @args failed: $!\n";
+while (<$pipe>) {
+   chomp;
+   my $ln = "$maildir/cur/" . basename $_;
+   symlink $_, "$ln" or warn "Failed to symlink '$_', '$ln': $!\n";
+}
 }
 
 sub prompt($$) {
-- 
2.25.1
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 1/3] gitignore: Ignore generated sphinx.config

2020-07-27 Thread Tomi Ollila
On Sun, Jul 26 2020, Jonas Bernoulli wrote:

> ---
>  .gitignore | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/.gitignore b/.gitignore
> index 1c8705ec..8f3ebec0 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -17,3 +17,4 @@ tags
>  /.stamps
>  *.stamp
>  /bindings/python-cffi/build/
> +/sphinx.config

This could have been listed after sh.config...

Tomi

> -- 
> 2.26.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 02/23] emacs: Remove excess empty lines

2020-07-27 Thread Tomi Ollila
On Sun, Jul 26 2020, Jonas Bernoulli wrote:

> Most people who write lots of lisp tend to only sparsely use empty
> "separator" lines within forms.  In lisp they feel unnecessary and
> since most files stick to this convention we get a bit confused
> when there are extra empty lines.  It feels like the s-expressions
> are falling into pieces.
>
> All of this is especially true between a function's doc-string and
> body because the doc-string is colored differently, which visually
> already separates it quite sufficiently from the code that follows.
> ---
>  emacs/make-deps.el   |  2 -
>  emacs/notmuch-address.el |  2 -
>  emacs/notmuch-crypto.el  |  4 --
>  emacs/notmuch-hello.el   | 18 -
>  emacs/notmuch-jump.el|  5 ---
>  emacs/notmuch-lib.el | 10 -
>  emacs/notmuch-maildir-fcc.el |  7 
>  emacs/notmuch-mua.el | 26 -
>  emacs/notmuch-parser.el  |  5 ---
>  emacs/notmuch-show.el| 75 ++--
>  emacs/notmuch-tag.el |  3 --
>  emacs/notmuch-tree.el|  9 -
>  emacs/notmuch-wash.el| 18 +
>  emacs/notmuch.el |  7 
>  14 files changed, 5 insertions(+), 186 deletions(-)
>
> diff --git a/emacs/make-deps.el b/emacs/make-deps.el
> index 5b6db698..dcac319c 100644
> --- a/emacs/make-deps.el
> +++ b/emacs/make-deps.el
> @@ -23,7 +23,6 @@
>  
>  (defun batch-make-deps ()
>"Invoke `make-deps' for each file on the command line."
> -
>(setq debug-on-error t)
>(dolist (file command-line-args-left)
>  (let ((default-directory command-line-default-directory))
> @@ -37,7 +36,6 @@ (defun make-deps ( dir)
>  This prints make dependencies to `standard-output' based on the
>  top-level `require' expressions in the current buffer.  Paths in
>  rules will be given relative to DIR, or `default-directory'."
> -
>(setq dir (or dir default-directory))
>(save-excursion
>  (goto-char (point-min))
> diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
> index 2a9c411a..ca4da3f3 100644
> --- a/emacs/notmuch-address.el
> +++ b/emacs/notmuch-address.el
> @@ -302,7 +302,6 @@ (defun notmuch-address-harvest ( addr-prefix 
> synchronous callback)
>  Address harvesting may take some time so the address collection runs
>  asynchronously unless SYNCHRONOUS is t. In case of asynchronous
>  execution, CALLBACK is called when harvesting finishes."
> -
>(let* ((sent (eq (car notmuch-address-internal-completion) 'sent))
>(config-query (cadr notmuch-address-internal-completion))
>(prefix-query (when addr-prefix
> @@ -335,7 +334,6 @@ (defun notmuch-address-harvest ( addr-prefix 
> synchronous callback)
>   ;; Kill any existing process
>   (when current-proc
> (kill-buffer (process-buffer current-proc))) ; this also kills the 
> process
> -
>   (setq current-proc
> (apply 'notmuch-start-notmuch proc-name proc-buf
>callback   ; process sentinel
> diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
> index 2327ff1f..58947a20 100644
> --- a/emacs/notmuch-crypto.el
> +++ b/emacs/notmuch-crypto.el
> @@ -123,17 +123,14 @@ (defun notmuch-crypto-insert-sigstatus-button 
> (sigstatus from)
>   face 'notmuch-crypto-signature-good-key))
>   (setq button-action 'notmuch-crypto-sigstatus-good-callback
> help-msg (concat "Click to list key ID 0x" fingerprint "."
> -
>   ((string= status "error")
>(setq label (concat "Unknown key ID " keyid " or unsupported 
> algorithm")
>   button-action 'notmuch-crypto-sigstatus-error-callback
>   help-msg (concat "Click to retrieve key ID " keyid
>" from keyserver.")))
> -
>   ((string= status "bad")
>(setq label (concat "Bad signature (claimed key ID " keyid ")")
>   face 'notmuch-crypto-signature-bad))
> -
>   (status
>(setq label (concat "Unknown signature status: " status)))
>   (t
> @@ -232,7 +229,6 @@ (defun notmuch-crypto-sigstatus-error-callback (button)
>   (process-put p :notmuch-show-buffer (current-buffer))
>   (process-put p :notmuch-show-point (point))
>   (message "Getting the GPG key %s asynchronously..." keyid)))
> -
>(let ((window (display-buffer buffer)))
>   (with-selected-window window
> (with-current-buffer buffer
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index 11c625ea..e71e55f3 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -150,7 +150,6 @@ (defcustom notmuch-saved-searches
>  ;; The saved-search format is also used by the all-tags notmuch-hello
>  ;; section. This section generates its own saved-search list in one of
>  ;; the latter two forms.
> -
>:get 'notmuch-hello--saved-searches-to-plist
>:type '(repeat notmuch-saved-search-plist)
>:tag "List of Saved Searches"
> @@ 

Re: [PATCH 01/23] emacs: Shorten long lines

2020-07-27 Thread Tomi Ollila
On Sun, Jul 26 2020, Jonas Bernoulli wrote:

> ---
>  emacs/coolj.el   |   2 +-
>  emacs/notmuch-address.el |  38 +++--
>  emacs/notmuch-company.el |  17 --
>  emacs/notmuch-crypto.el  |  16 +++---
>  emacs/notmuch-draft.el   |  12 ++--
>  emacs/notmuch-hello.el   |  43 ++-
>  emacs/notmuch-jump.el|   7 ++-
>  emacs/notmuch-lib.el |  62 +
>  emacs/notmuch-maildir-fcc.el |  14 ++---
>  emacs/notmuch-message.el |   3 +-
>  emacs/notmuch-mua.el |  78 +++---
>  emacs/notmuch-show.el| 103 +++
>  emacs/notmuch-tag.el |  14 +++--
>  emacs/notmuch-tree.el|  55 +--
>  emacs/notmuch-wash.el|  19 +--
>  emacs/notmuch.el |  27 ++---
>  emacs/rstdoc.el  |   3 +-
>  17 files changed, 326 insertions(+), 187 deletions(-)
>
> diff --git a/emacs/coolj.el b/emacs/coolj.el
> index 350d537f..5d311170 100644
> --- a/emacs/coolj.el
> +++ b/emacs/coolj.el
> @@ -1,6 +1,6 @@
>  ;;; coolj.el --- automatically wrap long lines  -*- coding:utf-8 -*-
>  
> -;; Copyright (C) 2000, 2001, 2004, 2005, 2006, 2007, 2008, 2009 Free 
> Software Foundation, Inc.
> +;; Copyright (C) 2000, 2001, 2004-2009 Free Software Foundation, Inc.
>  
>  ;; Authors:Kai Grossjohann 
>  ;; Alex Schroeder 
> diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
> index 0d56fba7..2a9c411a 100644
> --- a/emacs/notmuch-address.el
> +++ b/emacs/notmuch-address.el
> @@ -195,10 +195,11 @@ (defun notmuch-address-options (original)
> ((eq notmuch-address-command 'internal)
>  (unless (notmuch-address--harvest-ready)
>;; First, run quick synchronous harvest based on what the user
> -  ;; entered so far
> +  ;; entered so far.
>(notmuch-address-harvest original t))
>  (prog1 (notmuch-address-matching original)
> -  ;; Then start the (potentially long-running) full asynchronous harvest 
> if necessary
> +  ;; Then start the (potentially long-running) full asynchronous
> +  ;; harvest if necessary.
>(notmuch-address-harvest-trigger)))
> (t
>  (process-lines notmuch-address-command original
> @@ -241,7 +242,8 @@ (defun notmuch-address-expand-name ()
>   (push chosen notmuch-address-history)
>   (delete-region beg end)
>   (insert chosen)
> - (run-hook-with-args 'notmuch-address-post-completion-functions 
> chosen))
> + (run-hook-with-args 'notmuch-address-post-completion-functions
> + chosen))
>   (message "No matches.")
>   (ding
> (t nil)))
> @@ -393,10 +395,11 @@ (defun notmuch-address--save-address-hash ()
> ;; The file exists, check it is a file we saved
>   (notmuch-address--get-address-hash))
>   (with-temp-file notmuch-address-save-filename
> -   (let ((save-plist (list :version notmuch-address--save-hash-version
> -   :completion-settings 
> notmuch-address-internal-completion
> -   :last-harvest notmuch-address-last-harvest
> -   :completions notmuch-address-completions)))
> +   (let ((save-plist
> +  (list :version notmuch-address--save-hash-version
> +:completion-settings notmuch-address-internal-completion
> +:last-harvest notmuch-address-last-harvest
> +:completions notmuch-address-completions)))
>   (print "notmuch-address-hash" (current-buffer))
>   (print save-plist (current-buffer
>(message "\
> @@ -408,16 +411,17 @@ (defun notmuch-address-harvest-trigger ()
>(let ((now (float-time)))
>  (when (> (- now notmuch-address-last-harvest) 86400)
>(setq notmuch-address-last-harvest now)
> -  (notmuch-address-harvest nil nil
> -(lambda (proc event)
> -  ;; If harvest fails, we want to try
> -  ;; again when the trigger is next
> -  ;; called
> -  (if (string= event "finished\n")
> -  (progn
> -(notmuch-address--save-address-hash)
> -(setq 
> notmuch-address-full-harvest-finished t))
> -(setq notmuch-address-last-harvest 0)))
> +  (notmuch-address-harvest
> +   nil nil
> +   (lambda (proc event)
> +  ;; If harvest fails, we want to try
> +  ;; again when the trigger is next
> +  ;; called
> +  (if (string= event "finished\n")
> +  (progn
> +(notmuch-address--save-address-hash)
> +(setq notmuch-address-full-harvest-finished t))
> +(setq notmuch-address-last-harvest 0)))
>  
>  ;;
>  

Re: [PATCH] T355: specify hash algorithm explicitly

2020-07-27 Thread Tomi Ollila
On Mon, Jul 27 2020, Đoàn Trần Công Danh wrote:

> On some systems (notably, the one shipped with LibreSSL),
> default fingerprint digest algorithm is SHA256.
>
> On other systems, users can change default digest algorithm by changing
> default_md in /etc/ssl/default_md.
>
> Let's ask openssl to provide us specific algorithm to make the test
> more deterministic.
>
> Signed-off-by: Đoàn Trần Công Danh 
> ---
>  test/T355-smime.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/test/T355-smime.sh b/test/T355-smime.sh
> index f8cec62c..8b2b52be 100755
> --- a/test/T355-smime.sh
> +++ b/test/T355-smime.sh
> @@ -6,7 +6,7 @@ test_description='S/MIME signature verification and 
> decryption'
>  test_require_external_prereq openssl
>  test_require_external_prereq gpgsm
>  
> -FINGERPRINT=$(openssl x509 -fingerprint -in 
> "$NOTMUCH_SRCDIR/test/smime/key+cert.pem" -noout | sed -e 's/^.*=//' -e 
> s/://g)
> +FINGERPRINT=$(openssl x509 -sha1 -fingerprint -in 
> "$NOTMUCH_SRCDIR/test/smime/key+cert.pem" -noout | sed -e 's/^.*=//' -e 
> s/://g)

Looks good to me -- provided that this `-sha1` option is known by all
openssl(1) commmands we expect to be supported...

Tomi


>  
>  add_gpgsm_home
>  
> -- 
> 2.28.0.rc2.21.g5c06d60fc5
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] configure: account for various name of pytest-3

2020-07-27 Thread Tomi Ollila
On Mon, Jul 27 2020, Đoàn Trần Công Danh wrote:

> On different distro, pytest is suffixed with different patterns.
> Try to account for them, now.
>
> Signed-off-by: Đoàn Trần Công Danh 
> ---
>  configure | 13 +
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/configure b/configure
> index db3538b3..90bc9182 100755
> --- a/configure
> +++ b/configure
> @@ -814,10 +814,15 @@ if [ $have_python3 -eq 1 ]; then
>  printf "Checking for python3 pytest (>= 3.0)... "
>  conf=$(mktemp)
>  printf "[pytest]\nminversion=3.0\n" > $conf
> -if pytest-3 -c $conf --version >/dev/null 2>&1; then
> -printf "Yes.\n"
> -have_python3_pytest=1
> -else
> +for _pytest_cmd in pytest-3 pytest3; do

We use `${NOTMUCH_PYTHON} -m pytest` in tests to run the python
tests. IMO it would be better to change this check to do the
same with already resolved python3 command.

Tomi

> +if command -v $_pytest_cmd >/dev/null 2>&1 &&
> +$_pytest_cmd -c $conf --version >/dev/null 2>&1; then
> +printf "Yes.\n"
> +have_python3_pytest=1
> +break
> +fi
> +done
> +if [ "have_python3_pytest" = "0" ]; then
>  printf "No (will not test CFFI-based python bindings).\n"
>  fi
>  rm -f $conf
> -- 
> 2.28.0.rc2.21.g5c06d60fc5
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] configure: detect version by compiler for build

2020-07-27 Thread Tomi Ollila
On Mon, Jul 27 2020, Đoàn Trần Công Danh wrote:

> We'll need to run the compiled binary to report our current version.
>
> With the same code base, we should have the same version information
> regardless of compiler and architecture.
>
> Let's use the compiler for building architecture to build the reporting
> binary. Which is usually reported under variable CC_FOR_BUILD,
> a convention established by GNU Autotools, and fall back to CC if it's
> not defined.

We'd probably need to change quite a few other compiled and run binaries
in configure... otherwise this would be incomplete change (and thus just
adds confusion ?)

>
> Signed-off-by: Đoàn Trần Công Danh 
> ---
>  configure | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 98f5f1ea..db3538b3 100755
> --- a/configure
> +++ b/configure
> @@ -85,8 +85,10 @@ fi
>  BASHCMD=${BASHCMD:-bash}
>  PERL=${PERL:-perl}
>  CC=${CC:-cc}
> +CC_FOR_BUILD=${CC_FOR_BUILD:-$CC}
>  CXX=${CXX:-c++}
>  CFLAGS=${CFLAGS:--g -O2}
> +CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-$CFLAGS}
>  CPPFLAGS=${CPPFLAGS:-}
>  CXXFLAGS_for_sh=${CXXFLAGS:-${CFLAGS}}
>  CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
> @@ -410,7 +412,7 @@ int main(void) {
>  return 0;
>  }
>  EOF
> -if ${CC} ${CFLAGS} -I"$srcdir" _libversion.c -o _libversion > /dev/null 2>&1 
> \
> +if ${CC_FOR_BUILD} ${CFLAGS_FOR_BUILD} -I"$srcdir" _libversion.c -o 
> _libversion > /dev/null 2>&1 \
> && ./_libversion > _libversion.sh && . ./_libversion.sh
>  then
>  printf "OK.\n"
> -- 
> 2.28.0.rc2.21.g5c06d60fc5
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: simplify handling of writable database modes

2020-07-27 Thread Tomi Ollila
On Sun, Jul 26 2020, David Bremner wrote:

> As the last commit message mentions, it is a bit hard to be sure one
> is using static_cast correctly, so this series eliminates
> the use of static_cast for Xapian database objects.
>
> As a bonus, it deletes more code than it adds.
>
> Based on a suggestion from Olly Betts.


Series LGTM.

Tomi
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [Kevin McCarthy] Bug#966100: notmuch-mutt: symlinking now fails for indexed mailboxes with a space in the name

2020-07-23 Thread Tomi Ollila
On Thu, Jul 23 2020, David Bremner wrote:

> From: Kevin McCarthy 
> Subject: Bug#966100: notmuch-mutt: symlinking now fails for indexed mailboxes 
> with a space in the name
> To: Debian Bug Tracking System 
> Date: Wed, 22 Jul 2020 19:06:27 -0700
>
> Package: notmuch-mutt
> Version: 0.30-1
> Severity: important
> Tags: upstream
>
> Dear Maintainer,

Hi Kevin, others.

>
> After recently updating from stable to testing, notmuch-mutt search
> and thread commands stopped including results from my "Sent Items"
> maildir folder.  There are broken links in the results folder, and
> symlink error messages in the terminal window after exiting mutt.
>
> I tracked this down to upstream commit
> 
> but unfortunately my shell-fu is not good enough to understand exactly
> why the new version isn't working.
>
> If I manually swap revert the diff then my Sent Items results start
> working again.  So somehow the backslash-escaping works for xargs but
> not for the shell while/read loop.
>
> Here's the part of the commit above causing the breakage.
>
> - - - - - - - - -
> diff --git a/contrib/notmuch-mutt/notmuch-mutt 
> b/contrib/notmuch-mutt/notmuch-mutt
> index 
> 0e46a8c1b95e76163eed68694aa5a1a973c8b371..d33223bdd88e776acf79ae8b4ba2703ff1e6cc58
>  100755 (executable)
> --- a/contrib/notmuch-mutt/notmuch-mutt
> +++ b/contrib/notmuch-mutt/notmuch-mutt
> @@ -50,7 +50,7 @@ sub search($$$) {
>  empty_maildir($maildir);
>  system("notmuch search --output=files $dup_option $query"
>. " | sed -e 's: : :g'"
> -  . " | xargs -r -I searchoutput ln -s searchoutput $maildir/cur/");
> +  . " | while IFS= read -r searchoutput; do ln -s \$searchoutput 
> $maildir/cur/; done");
>  }

This could work, cannot test (compiles OK w/ perl -c when I outcommented
packages I don't have.

--8<8<8<8<8<8<8<8<8<8<8<8<8<--

diff --git a/contrib/notmuch-mutt/notmuch-mutt 
b/contrib/notmuch-mutt/notmuch-mutt
index d33223bd..b6c2d7b5 100755
--- a/contrib/notmuch-mutt/notmuch-mutt
+++ b/contrib/notmuch-mutt/notmuch-mutt
@@ -12,6 +12,7 @@ use strict;
 use warnings;
 
 use File::Path;
+use File::Basename;
 use Getopt::Long qw(:config no_getopt_compat);
 use Mail::Header;
 use Mail::Box::Maildir;
@@ -41,16 +42,19 @@ sub search($$$) {
 my ($maildir, $remove_dups, $query) = @_;
 my $dup_option = "";
 
-$query = shell_quote($query);
-
+my @args = qw/notmuch search --output=files/;
 if ($remove_dups) {
-  $dup_option = "--duplicate=1";
+   push @args, "--duplicate=1";
 }
+push @args, $query;
 
 empty_maildir($maildir);
-system("notmuch search --output=files $dup_option $query"
-  . " | sed -e 's: : :g'"
-  . " | while IFS= read -r searchoutput; do ln -s \$searchoutput 
$maildir/cur/; done");
+open my $p, '-|', @args or die "Running @args failed: $!\n";
+while (<$p>) {
+   chomp;
+   my $bn = basename $_;
+   symlink $_, "$maildir/cur/$bn";  # fixme: check (report?) error
+}
 }
 
 sub prompt($$) {

--8<8<8<8<8<8<8<8<8<8<8<8<8<--


>  
>  sub prompt($$) {
> - - - - - - - - -
>
>
> -- System Information:
> Debian Release: bullseye/sid
>   APT prefers testing
>   APT policy: (500, 'testing')
> Architecture: amd64 (x86_64)
>
> Kernel: Linux 5.7.0-1-amd64 (SMP w/16 CPU threads)
> Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not 
> set
> Shell: /bin/sh linked to /bin/dash
> Init: systemd (via /run/systemd/system)
> LSM: AppArmor: enabled
>
> Versions of packages notmuch-mutt depends on:
> ii  libmail-box-perl   3.008-1
> ii  libmailtools-perl  2.21-1
> ii  libstring-shellquote-perl  1.04-1
> ii  libterm-readline-gnu-perl  1.36-2+b1
> ii  notmuch0.30-1
> ii  perl   5.30.3-4
>
> Versions of packages notmuch-mutt recommends:
> pn  mutt  
>
> notmuch-mutt suggests no packages.
>
> -- no debconf information
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 1/2] doc: replace use of environment variables with a generated config

2020-07-17 Thread Tomi Ollila
On Tue, Jul 14 2020, Floris Bruynooghe wrote:

> On Sat 11 Jul 2020 at 10:20 -0300, David Bremner wrote:
>
>> I don't love the use of exec, but it is getting unwieldy to pass
>
> It's already a config file written in Python which is a terrible sin.
> So no need to apologise, I think it makes sense in this context.
>
>> configuration options on the sphinx-build command line, and I
>> anticipate further use of conditionals.
>> ---
>>  configure  |  8 
>>  doc/Makefile.local |  2 +-
>>  doc/conf.py| 11 ---
>>  3 files changed, 17 insertions(+), 4 deletions(-)
>>
>> diff --git a/configure b/configure
>> index 80cbac4f..177432db 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1548,6 +1548,14 @@ NOTMUCH_HAVE_PYTHON3_PYTEST=${have_python3_pytest}
>>  PLATFORM=${platform}
>>  EOF
>>  
>> +cat > sphinx.config <> +# Generate by configure, run from doc/conf.py
>
> Minor insignificant typo: Generated

Just to tease David more, I think I had that fixed in my suggestion ;)
LFTM with this typo fixed.

Tomi

>
>> +EOF
>> +if [ $WITH_EMACS = "1" ]; then
>> +printf "tags.add('WITH_EMACS')\n" >> sphinx.config
>> +fi
>> +printf "rsti_dir = '%s'\n" $(realpath emacs) >> sphinx.config
>> +
>>  # Finally, after everything configured, inform the user how to continue.
>>  cat <>  
>> diff --git a/doc/Makefile.local b/doc/Makefile.local
>> index 769438ed..598b6028 100644
>> --- a/doc/Makefile.local
>> +++ b/doc/Makefile.local
>> @@ -4,7 +4,7 @@ dir := doc
>>  
>>  # You can set these variables from the command line.
>>  SPHINXOPTS:= -q
>> -SPHINXBUILD   = WITH_EMACS=${WITH_EMACS} RSTI_DIR=$(realpath emacs) 
>> sphinx-build
>> +SPHINXBUILD   = sphinx-build
>>  DOCBUILDDIR  := $(dir)/_build
>>  
>>  # Internal variables.
>> diff --git a/doc/conf.py b/doc/conf.py
>> index 70987ac5..fdff2a2c 100644
>> --- a/doc/conf.py
>> +++ b/doc/conf.py
>> @@ -22,6 +22,13 @@ for pathdir in ['.', '..']:
>>  with open(version_file,'r') as infile:
>>  version=infile.read().replace('\n','')
>>  
>> +# read generated config
>> +for pathdir in ['.', '..']:
>> +conf_file = os.path.join(location,pathdir,'sphinx.config')
>> +if os.path.exists(conf_file):
>> +with open(conf_file,'r') as infile:
>> +exec(''.join(infile.readlines()))
>> +
>>  # The full version, including alpha/beta/rc tags.
>>  release = version
>>  
>> @@ -29,12 +36,10 @@ release = version
>>  # directories to ignore when looking for source files.
>>  exclude_patterns = ['_build']
>>  
>> -if os.environ.get('WITH_EMACS') == '1':
>> +if tags.has('WITH_EMACS'):
>>  # Hacky reimplementation of include to workaround limitations of
>>  # sphinx-doc
>>  lines = ['.. include:: /../emacs/rstdoc.rsti\n\n'] # in the source tree
>> -rsti_dir = os.environ.get('RSTI_DIR')
>> -# the other files are from the build tree
>>  for file in ('notmuch.rsti', 'notmuch-lib.rsti', 'notmuch-show.rsti', 
>> 'notmuch-tag.rsti'):
>>  lines.extend(open(rsti_dir+'/'+file))
>>  rst_epilog = ''.join(lines)
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] doc: make gzipped man pages reproducible

2020-07-11 Thread Tomi Ollila
On Sat, Jul 11 2020, Jonas Witschel wrote:

> gzip includes the name of the uncompressed file and its modification
> timestamp into the compressed archive. The latter makes it hard to
> reproduce the generated files bit for bit at a later time, so omit this
> information from the archive using the "--no-name" option. This is a
> reproducibility best practice, see
> https://wiki.debian.org/ReproducibleBuilds/TimestampsInGzipHeaders

LGTM.

Tomi

> ---
>  doc/Makefile.local | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/doc/Makefile.local b/doc/Makefile.local
> index 769438ed..19b953ed 100644
> --- a/doc/Makefile.local
> +++ b/doc/Makefile.local
> @@ -40,7 +40,7 @@ INFO_INFO_FILES := $(INFO_TEXI_FILES:.texi=.info)
>  .PHONY: install-man build-man apidocs install-apidocs
>  
>  %.gz: %
> - rm -f $@ && gzip --stdout $^ > $@
> + rm -f $@ && gzip --no-name --stdout $^ > $@
>  
>  ifeq ($(WITH_EMACS),1)
>  $(DOCBUILDDIR)/.roff.stamp sphinx-html sphinx-texinfo: docstring.stamp
> -- 
> 2.27.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 1/2] doc: replace use of environment variables with a generated config

2020-07-11 Thread Tomi Ollila
On Sat, Jul 11 2020, David Bremner wrote:

> I don't love the use of exec, but it is getting unwieldy to pass
> configuration options on the sphinx-build command line, and I
> anticipate further use of conditionals.

Perhaps less "opinions" in commit message.

(and as I think I don't comment 2/2, s/seperate/separate/ there)


> ---
>  configure  |  8 
>  doc/Makefile.local |  2 +-
>  doc/conf.py| 11 ---
>  3 files changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/configure b/configure
> index 80cbac4f..177432db 100755
> --- a/configure
> +++ b/configure
> @@ -1548,6 +1548,14 @@ NOTMUCH_HAVE_PYTHON3_PYTEST=${have_python3_pytest}
>  PLATFORM=${platform}
>  EOF
>  
> +cat > sphinx.config < +# Generate by configure, run from doc/conf.py
> +EOF
> +if [ $WITH_EMACS = "1" ]; then
> +printf "tags.add('WITH_EMACS')\n" >> sphinx.config
> +fi
> +printf "rsti_dir = '%s'\n" $(realpath emacs) >> sphinx.config
> +

perhaps instead of multiple redirections to the file, 

{
echo "# Generated by configure, run from doc/conf.py"
echo
if [ $WITH_EMACS = "1" ]; then
printf "tags.add('WITH_EMACS')\n"
fi 
printf "rsti_dir = '%s'\n" "$(realpath emacs)"

} > sphinx.config

alternative (someone might think less readable... ;/):

 exec 3>&1 1> sphinx.config

 echo "# Generated by configure, run from doc/conf.py"
 ...

 exec 1>&3 3>&-


>  # Finally, after everything configured, inform the user how to continue.
>  cat <

Re: [PATCH] emacs: Add notmuch-show-local-dates option

2020-07-04 Thread Tomi Ollila
On Fri, Jul 03 2020, David Bremner wrote:

> Daniel Kahn Gillmor  writes:
>
>> But if the sender is in TZ=Europe/Berlin, i would see:
>>
>> Date: Fri, 03 Jul 2020 13:22:36 -0400 [Fri, 03 Jul 2020 19:22:36 +0200]
>>
>> (Note that RFC 5322 Date format shows the hour offset, but not the
>> actual TZ -- i can't tell from -0400 whether someone is in
>> TZ=America/New_York or TZ=America/Manaus)
>>
>> Is there anyone who would complain about this just being the default
>> behavior -- with no additional settings to change?
>
> The bikeshed must be blue! Uh, I mean what about narrowish screens (80
> columns or so) and or deeply indented threads?

After very casual read-thru we have had similar discussion in thread starting

id:1427132722-20346-1-git-send-email-tomi.oll...@iki.fi

https://nmbug.notmuchmail.org/nmweb/search/id%3A1427132722-20346-1-git-send-email-tomi.ollila%40iki.fi

I've been patching my notmuch-emacs interface with that ever since, using 

https://github.com/domo141/nottoomuch/blob/master/build/01-date-local.patch

The Date header from David's email looked to me as

Date: Fri, 03 Jul 2020 19:58:23 -0300  (Sat, 04 Jul 2020 01:58:23 +0300)

(and fits fine in 80-column terminal window ;D -- 72 chars used -- when
 indent or replies with > goes too deep, everything wraps (or gets cut)...) 

Anyway, there are good comments in that thread -- and every now and then
I've tried to figure out a bit different way to "solve" this -- but as
my workaround work I've usually stopped short on that.

For me the interests are to know what time the user sent the email (their
timezone) and how that relates the time the other emails I've received
(my timezone) -- not too much the (exact) location sender is...

>
> d

Tomi
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] doc: update name of gmime package to install

2020-07-01 Thread Tomi Ollila
On Fri, Jun 26 2020, David Bremner wrote:

> Fedora still has an old gmime-devel which is 2.6.x. This is no longer
> supported by notmuch.
> ---
>  INSTALL   | 2 +-
>  configure | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/INSTALL b/INSTALL
> index f1236e71..3f11c2b7 100644
> --- a/INSTALL
> +++ b/INSTALL
> @@ -95,7 +95,7 @@ dependencies with a single simple command line. For example:
>  
>For Fedora and similar:
>  
> - sudo yum install xapian-core-devel gmime-devel libtalloc-devel 
> zlib-devel python3-sphinx texinfo info
> + sudo yum install xapian-core-devel gmime30-devel libtalloc-devel 
> zlib-devel python3-sphinx texinfo info

Since 'Fedora', change 'yum' to 'dnf' (no yum nomore on no fedora system)

(also:
 $ podman pull centos:8
 $ podman run --rm -it centos:8 command -v dnf
 /usr/bin/dnf
)

>  
>  On other systems, a similar command can be used, but the details of
>  the package names may be different.
> diff --git a/configure b/configure
> index 05ade05b..680e0e6e 100755
> --- a/configure
> +++ b/configure
> @@ -956,7 +956,7 @@ On Debian and similar systems:
>  
>  Or on Fedora and similar systems:
>  
> - sudo yum install xapian-core-devel gmime-devel libtalloc-devel 
> zlib-devel
> + sudo yum install xapian-core-devel gmime30-devel libtalloc-devel 
> zlib-devel

Ditto.

Tomi

>  
>  On other systems, similar commands can be used, but the details of the
>  package names may be different.
> -- 
> 2.27.0
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] Makefile.global: drop -std=gnu99. C11 (or later) compiler required

2020-06-24 Thread Tomi Ollila
Since October 2018 building notmuch has actually required compiler
that knows C11.

Also this -std=gnu99 was not used in code compiled by configure,
so in theory this could have caused problems...

...but no related reports have been sent, perhaps ever.

Both gcc and clang has been shipping compilers supporting C11
(or later) by default for more than four years now.

Therefore, just dropping -std=gnu99 (and not checking C11
compatibility for now, for simplicity) is easiest to do,
and removes inconsistency between configure and build time
compilations.
---
 Makefile.global | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Makefile.global b/Makefile.global
index 0aee5876..98b6962e 100644
--- a/Makefile.global
+++ b/Makefile.global
@@ -49,8 +49,7 @@ DETACHED_SIG_FILE=$(TAR_FILE).asc
 PV_FILE=bindings/python/notmuch/version.py
 
 # Smash together user's values with our extra values
-STD_CFLAGS := -std=gnu99
-FINAL_CFLAGS = -DNOTMUCH_VERSION=$(VERSION) $(CPPFLAGS) $(STD_CFLAGS) 
$(CFLAGS) $(WARN_CFLAGS) $(extra_cflags) $(CONFIGURE_CFLAGS)
+FINAL_CFLAGS = -DNOTMUCH_VERSION=$(VERSION) $(CPPFLAGS) $(CFLAGS) 
$(WARN_CFLAGS) $(extra_cflags) $(CONFIGURE_CFLAGS)
 FINAL_CXXFLAGS = $(CPPFLAGS) $(CXXFLAGS) $(WARN_CXXFLAGS) $(extra_cflags) 
$(extra_cxxflags) $(CONFIGURE_CXXFLAGS)
 FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) -Lutil -lnotmuch_util -Llib -lnotmuch
 ifeq ($(LIBDIR_IN_LDCONFIG),0)
-- 
2.25.1

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


Re: [PATCH 1/2] configure: detect 64 bit time_t

2020-06-24 Thread Tomi Ollila
On Wed, Jun 24 2020, David Bremner wrote:

> Certain tests involving timestamps > 32bits cannot pass with the
> current libnotmuch API. We will avoid this isssue for now by disabling

s/isssue/issue/

> those tests on "old" architectures with 32bit time_t.
> ---
>  configure | 33 -
>  1 file changed, 32 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 05ade05b..ecb0bdb7 100755
> --- a/configure
> +++ b/configure
> @@ -1045,6 +1045,34 @@ else
>  fi
>  rm -f compat/have_timegm
>  
> +cat < _time_t.c
> +#include 
> +#include 
> +int main(int argc, char**argv) {
> +  printf("%d\n",sizeof(time_t) >= 8);

Since notmuch now (since fall 2018) requires c11 compiler, static_assert
would be simpler alternative:

#include 
#include 

static_assert(sizeof(time_t) >= 8, "sizeof(time_t) < 8");

and

if ${CC} -c _time_t.c -o /dev/null > /dev/null 2>&1
then 
 printf "Yes.\n"
 have_64bit_time_t=1
else 
 printf "No.\n"
 have_64bit_time_t=0
fi

but if not... 

> +}
> +EOF
> +
> +printf "Checking for 64 bit time_t... "
> +if ${CC} _time_t.c -o _time_t > /dev/null 2>&1;
> +then
> +have_64bit_time_t=$(./_time_t)

anyway would be better for _time_t just exit 0 or 1 and
set have_64bit_time_t as (inverse =D) of that (like above),
... but still, static_assert FTW \0/ ;)

> +if [ $have_64bit_time_t -eq 1 ]
> +then
> +printf "Yes.\n"
> +else
> +printf "No.\n"
> +fi
> +else
> +cat < +
> +*** Error: compilation failed.  Please try running configure again in
> +a clean environment, and if the problem persists, report a bug.
> +EOF
> +rm -f _time_t _time_t.c exit 1
> +fi
> +
> +
>  printf "Checking for dirent.d_type... "
>  if ${CC} -o compat/have_d_type "$srcdir"/compat/have_d_type.c > /dev/null 
> 2>&1
>  then
> @@ -1128,7 +1156,7 @@ for flag in -Wmissing-declarations; do
>  done
>  printf "\n\t%s\n" "${WARN_CFLAGS}"
>  
> -rm -f minimal minimal.c _libversion.c _libversion _libversion.sh 
> _check_session_keys.c _check_session_keys _check_x509_validity.c 
> _check_x509_validity
> +rm -f minimal minimal.c _time_t _time_t.c _libversion.c _libversion 
> _libversion.sh _check_session_keys.c _check_session_keys 
> _check_x509_validity.c _check_x509_validity
>  
>  # construct the Makefile.config
>  cat > Makefile.config < @@ -1429,6 +1457,9 @@ NOTMUCH_HAVE_MAN=$((have_sphinx))
>  NOTMUCH_HAVE_BASH=${have_bash}
>  NOTMUCH_BASH_ABSOLUTE=${bash_absolute}
>  
> +# Whether time_t is 64 bits (or more)
> +NOTMUCH_HAVE_64BIT_TIME_T=${have_64bit_time_t}
> +
>  # Whether perl exists, and if so where
>  NOTMUCH_HAVE_PERL=${have_perl}
>  NOTMUCH_PERL_ABSOLUTE=${perl_absolute}
> -- 
> 2.27.0
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] completion: remove "setup" from the list of possible completions

2020-06-23 Thread Tomi Ollila
On Sat, Jun 20 2020, Ralph Seichter wrote:

> * Tomi Ollila:
>
>> imo.the completions should primarily provide convenience to the
>> interactive user, to see all possible options (also those
>> seldomly.used) one can use help and namual pages...
>
> "Can use" being the operative term, not "should have to use". I would
> not want completion to omit certain commands, based on somebody else's
> notion of what is convenient, which in turn forces me to use other means
> of figuring out a seldom-used command I may or may not be aware of.
>
> If this means entering three characters instead of two, then three
> characters it is. Alternatively, make it a configurable option, with
> "convenient=false" being the default. I vote against the change.
>
> First world problems... ;-)

Indeed! You're wrong and I am right... ;) unfortunately the margin is too
small and status quo (i.e. what we have now) may prevail.

(well, I haven't even installed the completions -- perhaps I write my own
 zsh completions which will expand 'notmuch s' -> 'notmuch search' ;D) --
 note that I also have no notmuch-* commands in my PATH, so 'notm' expands
 to 'notmuch ' ! \o/ FTW ;)

>
> -Ralph

Tomi (one random user like all of us)
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] completion: remove "setup" from the list of possible completions

2020-06-20 Thread Tomi Ollila
On Sat, Jun 20 2020, reto@labrat.space wrote:

> On Fri, Jun 19, 2020 at 12:40:49PM +0200, Łukasz Stelmach wrote:
>> Having "setup" in the set requires entering three instad of two characters
>> for "search". Since "setup" is rearly used it makes little sense to have
>> it in the set and cripple UX for much more frequently used "search".
>
> I very much disagree with this patch.
> The completions should contain all possible values, saving a single keystroke 
> is
> certainly not a valid reason to remove a valid option from the completions.

I disagree your disagreement, and would.be very much favorable to this
change.

imo.the completions should primarily provide convenience to the interactive
user, to see all possible options (also those seldomly.used) one can use
help and namual pages...

Tomi

>
> Writeuu an alias into your bashrc if that bothers you so much... Then you 
> can save
> much more keystrokes.
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Feature freeze for notmuch 0.30: June 1

2020-06-17 Thread Tomi Ollila
On Wed, Jun 17 2020, Tomi Ollila wrote:

> On Wed, Jun 17 2020, Dan Čermák wrote:
>
>>
>> I have tried updating the package in openSUSE Tumbleweed to 0.30~rc2 but
>> running the tests results in the following failures:
>> --8<---cut here---start->8---
>> T357-index-decryption: Testing indexing decrypted mail
>>  FAIL   verify signature with stashed session key
>> good_sig: value not equal: 
>> data[0][0][0]["crypto"]["signed"]["status"][0]["status"] = 'error' != 'good'
>
> FYI: On Fedora 32 I (also) get:
>
>   T357-index-decryption: Testing indexing decrypted mail
>FAIL   verify signature with stashed session key
>   good_sig: value not equal:  
> data[0][0][0]["crypto"]["signed"]["status"][0]["status"] = 'error' != 'good'
>
> (i.e exactly the same)
>
> I've not bothered to care ;/

However, more detail:

executed

  notmuch show --format=json id:encrypted-sig...@crypto.notmuchmail.org | jq .

before that failing test -- this is the related data:

"crypto": {
  "signed": {
"status": [
  {
"status": "error",
"keyid": "6D92612D94E46381",
"errors": {
  "key-missing": true
}
  }
],
"encrypted": true
  },

>
> The BROKEN failures are expected failures...
>
> Tomi
>
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Feature freeze for notmuch 0.30: June 1

2020-06-17 Thread Tomi Ollila
On Wed, Jun 17 2020, Dan Čermák wrote:

>
> I have tried updating the package in openSUSE Tumbleweed to 0.30~rc2 but
> running the tests results in the following failures:
> --8<---cut here---start->8---
> T357-index-decryption: Testing indexing decrypted mail
>  FAIL   verify signature with stashed session key
> good_sig: value not equal: 
> data[0][0][0]["crypto"]["signed"]["status"][0]["status"] = 'error' != 'good'

FYI: On Fedora 32 I (also) get:

  T357-index-decryption: Testing indexing decrypted mail
   FAIL   verify signature with stashed session key
  good_sig: value not equal:  
data[0][0][0]["crypto"]["signed"]["status"][0]["status"] = 'error' != 'good'

(i.e exactly the same)

I've not bothered to care ;/

The BROKEN failures are expected failures...

Tomi


>
> T590-thread-breakage: Testing thread breakage during reindexing
>  BROKEN No ghosts should remain after deletion of second message
>
> T670-duplicate-mid: Testing duplicate message ids
>  BROKEN First subject preserved in notmuch-show (json)
>  BROKEN Regexp search for second subject
>
> Notmuch test suite complete.
> 1152/1156 tests passed.
> 3 broken tests failed as expected.
> 1 test failed.
> All tests in 1 file skipped.
> ERROR: parallel test suite returned error code 1
> make: *** [test/Makefile.local:69: test] Error 1
> --8<---cut here---end--->8---
>
> I can reproduce these failures on my local machine as well as in the
> openSUSE build environment (the Open Build Service). As I am a bit
> reluctant to skip even more tests: could someone who is more familiar
> with notmuch maybe take a look at this or guide me through this?
>
>
> Thanks in advance,
>
> Dan
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] Update tox.ini for python3.8 and fix pypy3.6

2020-06-15 Thread Tomi Ollila
On Mon, Jun 15 2020, David Bremner wrote:

> Floris Bruynooghe  writes:
>
>>  [testenv]
>>  deps =
>> @@ -14,3 +14,6 @@ commands = pytest --cov={envsitepackagesdir}/notmuch2 
>> {posargs}
>>  
>>  [testenv:pypy35]
>>  basepython = pypy3.5
>> +
>> +[testenv:pypy36]
>> +basepython = pypy3.6
>
> I'm not an expert, but should python 3.7 and python 3.8 have similar
> clauses? Or do they work by default?

"Python 3.6 compatible PyPy3.6 v7.3.1" in https://www.pypy.org/download.html
hints there are not (yet) pypy3.7 nor pypy3.8

>
> d

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


Re: [PATCH 1/2] python/notmuch2: do not destroy messages owned by a query

2020-06-10 Thread Tomi Ollila
Hi Anton,

On Thu, May 21 2020, Anton Khirnov wrote:

> ping

Great (an important) stuff in this series !

...just that...

Floris did good review on your changes the next day.

What I remember was there (looked 30 mins ago)

- style: somewhat important (I press more there). Easy to get better,
 good and consistent style makes it better

- docs in code: like Floris mentioned, the docs in commit messages are
are not seen by user. The relevant documentation is 
to be with the code. commit message tells what was done
and why

- tests: since pytest is used to test the current notmuch2 cffi python
 tests, all new code that can be tested pytest code to do so
 is to be added

And these have to be done now -- postponing such a things into future
will just mean that it never happens, and the messines and entropy of
the notmuch code gets even greater in such a case...

>
> -- 
> Anton Khirnov

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


[PATCH v2] configure: use cffi.FFI().verify() to test buildability of CFFI bindings

2020-06-09 Thread Tomi Ollila
Checking existence of pyconfig.h to determine whether CFFI-based
notmuch bindings are buildable is not enough; for example Fedora 32
ships pyconfig.h in python3-libs package, but python3-devel is required
to be installed for the bindings to build.

Executing cffi.FFI().verify() is pretty close to what is done in
bindings/python-cffi/notmuch2/_build.py to get the c code part of the
bindings built.
---

diff to v1:

> +rm -rf __pycache__  # cffi.FFI().verify() uses this space

fits pretty well w/ pytest $conf removal few lines below

 configure | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/configure b/configure
index f4b3c61a..05ade05b 100755
--- a/configure
+++ b/configure
@@ -711,14 +711,12 @@ if [ $have_python -eq 0 ]; then
 errors=$((errors + 1))
 fi
 
-have_python3_dev=0
+have_python3=0
 if [ $have_python -eq 1 ]; then
-printf "Checking for python3 dev (>= 3.5)..."
-if "$python" -c 'import os, sys, sysconfig;
-assert sys.version_info >= (3,5)
-assert os.path.isfile(sysconfig.get_config_h_filename())' >/dev/null 2>&1; then
+printf "Checking for python3 (>= 3.5)..."
+if "$python" -c 'import sys, sysconfig; assert sys.version_info >= (3,5)'; 
>/dev/null 2>&1; then
 printf "Yes.\n"
-have_python3_dev=1
+have_python3=1
 else
 printf "No (will not install CFFI-based python bindings).\n"
 fi
@@ -726,14 +724,15 @@ fi
 
 have_python3_cffi=0
 have_python3_pytest=0
-if [ $have_python3_dev -eq 1 ]; then
+if [ $have_python3 -eq 1 ]; then
 printf "Checking for python3 cffi and setuptools... "
-if "$python" -c 'import cffi; import setuptools' >/dev/null 2>&1; then
+if "$python" -c 'import cffi,setuptools; cffi.FFI().verify()' >/dev/null 
2>&1; then
 printf "Yes.\n"
 have_python3_cffi=1
 else
 printf "No (will not install CFFI-based python bindings).\n"
 fi
+rm -rf __pycache__  # cffi.FFI().verify() uses this space
 
 printf "Checking for python3 pytest (>= 3.0)... "
 conf=$(mktemp)
-- 
2.25.1

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


Re: [PATCH] NEWS: The minimum supported version of Xapian is now 1.4.0

2020-06-08 Thread Tomi Ollila
On Sun, Jun 07 2020, David Bremner wrote:

> Tomi Ollila  writes:
>>  
>> +Dependencies
>> +
>> +
>> +Support for Xapian 1.2 is removed. The minimum supported version of
>> +Xapian is now 1.4.0.
>> +
>>  Notmuch 0.29.3 (2019-11-27)
>>  ===
>
> These are not the diffs you are looking for (already in release and
> master).

Yes, I attempted to send id:20200609053446.11478-1-tomi.oll...@iki.fi

I forgot the final step to `notmuch new` the mail sent and reread it.
Now I saw straight from subject list that it did not look right ;/
Applied patch (as usual) from mail and tested (once again) it worked
(Ubuntu 20.04 this time).

Sorry for the noise =D

Tomi

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


[PATCH] configure: use cffi.FFI().verify() to test buildability of CFFI bindings

2020-06-08 Thread Tomi Ollila
Checking existence of pyconfig.h to determine whether CFFI-based
notmuch bindings are buildable is not enough; for example Fedora 32
ships pyconfig.h in python3-libs package, but python3-devel is required
to be installed for the bindings to build.

Executing cffi.FFI().verify() is pretty close to what is done in
bindings/python-cffi/notmuch2/_build.py to get the c code part of the
bindings built.
---

I just could not get this right last time. Probably I concentrated on
testing in debian 10 container so much, that the small differences in
other systems went unnoticed (had that fedora 32 host polluted by
installed python3-devel when doing final tests on that system)...

 configure | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/configure b/configure
index f4b3c61a..d85fe5d2 100755
--- a/configure
+++ b/configure
@@ -711,14 +711,12 @@ if [ $have_python -eq 0 ]; then
 errors=$((errors + 1))
 fi
 
-have_python3_dev=0
+have_python3=0
 if [ $have_python -eq 1 ]; then
-printf "Checking for python3 dev (>= 3.5)..."
-if "$python" -c 'import os, sys, sysconfig;
-assert sys.version_info >= (3,5)
-assert os.path.isfile(sysconfig.get_config_h_filename())' >/dev/null 2>&1; then
+printf "Checking for python3 (>= 3.5)..."
+if "$python" -c 'import sys, sysconfig; assert sys.version_info >= (3,5)'; 
>/dev/null 2>&1; then
 printf "Yes.\n"
-have_python3_dev=1
+have_python3=1
 else
 printf "No (will not install CFFI-based python bindings).\n"
 fi
@@ -726,9 +724,9 @@ fi
 
 have_python3_cffi=0
 have_python3_pytest=0
-if [ $have_python3_dev -eq 1 ]; then
+if [ $have_python3 -eq 1 ]; then
 printf "Checking for python3 cffi and setuptools... "
-if "$python" -c 'import cffi; import setuptools' >/dev/null 2>&1; then
+if "$python" -c 'import cffi,setuptools; cffi.FFI().verify()' >/dev/null 
2>&1; then
 printf "Yes.\n"
 have_python3_cffi=1
 else
-- 
2.26.2

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


[PATCH] NEWS: The minimum supported version of Xapian is now 1.4.0

2020-06-07 Thread Tomi Ollila
---
 NEWS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/NEWS b/NEWS
index 1921127fe02c..a16689cae04a 100644
--- a/NEWS
+++ b/NEWS
@@ -36,6 +36,12 @@ Introduce new CFFI-based python bindings in the python 
module named
 "notmuch2".  Officially deprecate (but still support) the older
 "notmuch" module.
 
+Dependencies
+
+
+Support for Xapian 1.2 is removed. The minimum supported version of
+Xapian is now 1.4.0.
+
 Notmuch 0.29.3 (2019-11-27)
 ===
 
-- 
2.13.3

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


[PATCH] configure: require python 3.5 for CFFI-based notmuch bindings

2020-06-05 Thread Tomi Ollila
Also tell users what the consequences of a "No" answer is when
python version is less than 3.5, cffi or setuptools is missing,
or no pytest >= 3.0 is available.
---
 configure | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index e4c738e5..f4b3c61a 100755
--- a/configure
+++ b/configure
@@ -713,14 +713,14 @@ fi
 
 have_python3_dev=0
 if [ $have_python -eq 1 ]; then
-printf "Checking for python3 dev..."
+printf "Checking for python3 dev (>= 3.5)..."
 if "$python" -c 'import os, sys, sysconfig;
-assert sys.version_info >= (3,0)
+assert sys.version_info >= (3,5)
 assert os.path.isfile(sysconfig.get_config_h_filename())' >/dev/null 2>&1; then
 printf "Yes.\n"
 have_python3_dev=1
 else
-printf "No.\n"
+printf "No (will not install CFFI-based python bindings).\n"
 fi
 fi
 
@@ -732,7 +732,7 @@ if [ $have_python3_dev -eq 1 ]; then
 printf "Yes.\n"
 have_python3_cffi=1
 else
-printf "No.\n"
+printf "No (will not install CFFI-based python bindings).\n"
 fi
 
 printf "Checking for python3 pytest (>= 3.0)... "
@@ -742,7 +742,7 @@ if [ $have_python3_dev -eq 1 ]; then
 printf "Yes.\n"
 have_python3_pytest=1
 else
-printf "No.\n"
+printf "No (will not test CFFI-based python bindings).\n"
 fi
 rm -f $conf
 fi
-- 
2.26.2

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


Re: [PATCH] devel: script to calculate a list of authors.

2020-06-05 Thread Tomi Ollila
On Fri, Jun 05 2020, David Bremner wrote:

> As an initial heuristic, report anyone with at least 15 lines of code
> in the current source tree. Test corpora are excluded, although
> probabably this doesn't change much about the list of authors
> produced.
> ---
>  devel/author-scan.sh | 11 +++
>  1 file changed, 11 insertions(+)
>  create mode 100644 devel/author-scan.sh
>
> diff --git a/devel/author-scan.sh b/devel/author-scan.sh
> new file mode 100644
> index ..2d9c4af8
> --- /dev/null
> +++ b/devel/author-scan.sh
> @@ -0,0 +1,11 @@
> +#!/bin/sh
> +
> +FILE_EXCLUDE='corpora'
> +AUTHOR_EXCLUDE='uncrustify'
> +# based on the FSF guideline, for want of a better idea.
> +THRESHOLD=15
> +
> +git ls-files | grep -v -e "$FILE_EXCLUDE" | xargs -n 1 -d \\n \
> +  git blame -w 
> --line-porcelain -- | \

It worked !? =D -- good -- this indentation in line above is interesting...

Tomi

> +sed -n "/$AUTHOR_EXCLUDE/d; s/^[aA][uU][tT][hH][Oo][rR] //p" | \
> +sort -fd | uniq -ic | awk "\$1 >= $THRESHOLD" | sort -nr
> -- 
> 2.26.2
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] tweaks to NEWS suggest by Tomi

2020-06-05 Thread Tomi Ollila
On Fri, Jun 05 2020, David Bremner wrote:

> See id:m27dwp40sx@guru.guru-group.fi

LGTM.

Tomi

> ---
>  this is on top of Tomi's NEWS patch re Xapian
>  NEWS | 14 +++---
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/NEWS b/NEWS
> index a16689ca..556172bb 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -5,8 +5,8 @@ S/MIME
>  --
>  
>  Handle S/MIME (PKCS#7) messages -- one-part signed messages, encrypted
> -messages, and multilayer messages.  Treat them symmetrically to
> -OpenPGP messages.  This includes handling protected headers
> +messages, and multilayer messages. Treat them symmetrically to
> +OpenPGP messages. This includes handling protected headers
>  gracefully.
>  
>  If you're using Notmuch with S/MIME, you currently need to configure
> @@ -16,21 +16,21 @@ Mixed-up MIME Repair
>  
>  
>  Detect and automatically repair a common form of message mangling
> -created by Microsoft Exchange. (see index.repaired=mixedup in
> -notmuch-properties(7).
> +created by Microsoft Exchange (see index.repaired=mixedup in
> +notmuch-properties(7)).
>  
>  Protected Headers
>  -
>  
>  Avoid indexing the legacy-display part of an encrypted message that
> -has protected headers. (see
> +has protected headers (see
>  index.repaired=skip-protected-headers-legacy-display in
> -notmuch-properties(7).
> +notmuch-properties(7)).
>  
>  Python
>  --
>  
> -Drop compatibility with python2, focus on python3.
> +Drop support for python2, focus on python3.
>  
>  Introduce new CFFI-based python bindings in the python module named
>  "notmuch2".  Officially deprecate (but still support) the older
> -- 
> 2.26.2
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] NEWS: The minimum supported version of Xapian is now 1.4.0

2020-06-04 Thread Tomi Ollila
---
 NEWS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/NEWS b/NEWS
index 1921127fe02c..a16689cae04a 100644
--- a/NEWS
+++ b/NEWS
@@ -36,6 +36,12 @@ Introduce new CFFI-based python bindings in the python 
module named
 "notmuch2".  Officially deprecate (but still support) the older
 "notmuch" module.
 
+Dependencies
+
+
+Support for Xapian 1.2 is removed. The minimum supported version of
+Xapian is now 1.4.0.
+
 Notmuch 0.29.3 (2019-11-27)
 ===
 
-- 
2.13.3

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


Re: [RFC] devel: script to calculate a list of authors.

2020-06-03 Thread Tomi Ollila
On Wed, Jun 03 2020, David Bremner wrote:

> As an initial heuristic, report anyone with at least 15 lines of code
> in the current source tree. Test corpora are excluded, although
> probabably this doesn't change much about the list of authors
> produced.
> ---
>
> I realized both AUTHORS and debian/copyright are woefully out of
> date. I think it makes sense to keep something like this in the repo,
> both to ease updates and to document a policy. Presuambly 'author '
> should be removed from the output, but I'm guessing Tomi will tear
> this apart anyway ;).

Hi David,

I started doing that before even reading your commit (used less(1) to
look the email from bottom... ;)

I got some idea, but then decided there is no point spending too
many minutes (what was that one 'time management' xkcd again... =D)

anyway, some fun editing the nifty pipeline you write

git ls-files | grep -v -e "$FILE_EXCLUDE" | xargs -n 1 -d \\n | \
git blame -w --line-porcelain -- | \
sed -n "/$AUTHOR_EXCLUDE/d; s/^[aA][uU][tT][hH][Oo][rR] //p" | \
sort -fd | uniq -ic | awk "\$1 >= $THRESHOLD" | sort -nr

If there are more authors or files to exclude, then it is easiest
to just write those out in pipeline, e.g.

grep -v -e 'file-one' -e 'file 2 with spaces' ...

and

sed -n '/author1_ex1/d; /author2_ex1/d; s/^[aA][uU][tT][hH][Oo][rR] //p'

(and, as usual, I always recommend 'set -euf' in shell scripts)

Tomi

>  devel/author-scan.sh | 11 +++
>  1 file changed, 11 insertions(+)
>  create mode 100644 devel/author-scan.sh
>
> diff --git a/devel/author-scan.sh b/devel/author-scan.sh
> new file mode 100644
> index ..b7b46a33
> --- /dev/null
> +++ b/devel/author-scan.sh
> @@ -0,0 +1,11 @@
> +#!/bin/sh
> +
> +FILE_EXCLUDE='corpora'
> +AUTHOR_EXCLUDE='uncrustify'
> +# based on the FSF guideline, for want of a better idea.
> +THRESHOLD=15
> +
> +git ls-files | grep -v "$FILE_EXCLUDE" |
> +while read f; do
> +git blame -w --line-porcelain -- "$f" | grep -I '^author ' | grep -v 
> "$AUTHOR_EXCLUDE"
> +done | sort -fd | uniq -ic | awk "\$1 >= $THRESHOLD" |  sort -nr
> -- 
> 2.26.2
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] add NEWS for 0.30

2020-06-02 Thread Tomi Ollila


post-push comments =D

On Mon, Jun 01 2020, Daniel Kahn Gillmor wrote:

> Signed-off-by: Daniel Kahn Gillmor 
> ---
>  NEWS | 35 +++
>  1 file changed, 35 insertions(+)
>
> diff --git a/NEWS b/NEWS
> index 14db7f6f..1921127f 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -1,6 +1,41 @@
>  Notmuch 0.30 (2020-06-01)
>  =
>  
> +S/MIME
> +--
> +
> +Handle S/MIME (PKCS#7) messages -- one-part signed messages, encrypted
> +messages, and multilayer messages.  Treat them symmetrically to
> +OpenPGP messages.  This includes handling protected headers
> +gracefully.

2 spaces after period (.) ending sentence. I've been told that thiis is
(official) style somewhere (which I personally dislike, but...) -- anyway
that style is inconsistent with NEWS entries done previously 
(possibly not all of the NEWS entries I quickly looked but).

> +
> +If you're using Notmuch with S/MIME, you currently need to configure
> +gpgsm appropriately.
> +
> +Mixed-up MIME Repair
> +
> +
> +Detect and automatically repair a common form of message mangling
> +created by Microsoft Exchange. (see index.repaired=mixedup in
> +notmuch-properties(7).

No closing paren for (see...

What about period (.) after Exchange. 

> +
> +Protected Headers
> +-
> +
> +Avoid indexing the legacy-display part of an encrypted message that
> +has protected headers. (see
> +index.repaired=skip-protected-headers-legacy-display in
> +notmuch-properties(7).

ditto ((see ...)

ditto (period (.) after headers.)

> +
> +Python
> +--
> +
> +Drop compatibility with python2, focus on python3.

Was 'compatibility' completely dropped. Doesn't old bindings still
work with python2 ?

> +Introduce new CFFI-based python bindings in the python module named
> +"notmuch2".  Officially deprecate (but still support) the older
> +"notmuch" module.
> +
>  Notmuch 0.29.3 (2019-11-27)
>  ===
>  
> -- 
> 2.26.2
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] doc: field processor support now always included, adjust manual pages

2020-06-02 Thread Tomi Ollila
The features that require field processor support, are now just
documented w/o mentioning **Xapian Field Processors**' is needed
for those.

Replaced "compact" and "field_processor" with "retry_lock" in
build_with config option, as it is currently the only one that
is optionally excluded. The former 2 are now documented as
features always included.

Dropped one 'we' "passive" in notmuch-search-terms.rst. It was the
only one, and inconsistent with rest of the documentation in that
file.

Dropped message about conditional open-ended ranges support, as
those are now always supported.
---
 doc/man1/notmuch-config.rst   |  5 +--
 doc/man7/notmuch-search-terms.rst | 54 +--
 2 files changed, 18 insertions(+), 41 deletions(-)

diff --git a/doc/man1/notmuch-config.rst b/doc/man1/notmuch-config.rst
index 323a8b65..769f336a 100644
--- a/doc/man1/notmuch-config.rst
+++ b/doc/man1/notmuch-config.rst
@@ -198,8 +198,9 @@ The available configuration items are described below.
 
 **built_with.**
 Compile time feature . Current possibilities include
-"compact" (see **notmuch-compact(1)**) and "field_processor" (see
-**notmuch-search-terms(7)**).
+"retry_lock" (configure option, included by default).
+(since notmuch 0.30, "compact" and "field_processor" are
+always included.)
 
 **query.** **[STORED IN DATABASE]**
 Expansion for named query called . See
diff --git a/doc/man7/notmuch-search-terms.rst 
b/doc/man7/notmuch-search-terms.rst
index 1dd2dc58..28fca737 100644
--- a/doc/man7/notmuch-search-terms.rst
+++ b/doc/man7/notmuch-search-terms.rst
@@ -37,9 +37,8 @@ In addition to free text, the following prefixes can be used 
to force
 terms to match against specific portions of an email, (where 
 indicate user-supplied values).
 
-If notmuch is built with **Xapian Field Processors** (see below) some
-of the prefixes with  forms can be also used to restrict the
-results to those whose value matches a regular expression (see
+Some of the prefixes with  forms can be also used to restrict
+the results to those whose value matches a regular expression (see
 **regex(7)**) delimited with //, for example::
 
notmuch search 'from:"/bob@.*[.]example[.]com/"'
@@ -87,8 +86,7 @@ thread:
 of output from **notmuch search**
 
 thread:{}
-If notmuch is built with **Xapian Field Processors** (see below),
-threads may be searched for indirectly by providing an arbitrary
+Threads may be searched for indirectly by providing an arbitrary
 notmuch query in **{}**. For example, the following returns
 threads containing a message from mallory and one (not necessarily
 the same message) with Subject containing the word "crypto".
@@ -158,9 +156,7 @@ lastmod:..
 
 query:
 The **query:** prefix allows queries to refer to previously saved
-queries added with **notmuch-config(1)**. Named queries are only
-available if notmuch is built with **Xapian Field Processors**
-(see below).
+queries added with **notmuch-config(1)**.
 
 property:=
 The **property:** prefix searches for messages with a particular
@@ -353,23 +349,21 @@ since 1970-01-01 00:00:00 UTC. For example:
 
 date:@..@
 
-date:..! can be used as a shorthand for date:... The
-expansion takes place before interpretation, and thus, for example,
-date:monday..! matches from the beginning of Monday until the end of
-Monday.
-With **Xapian Field Processor** support (see below), non-range
-date queries such as date:yesterday will work, but otherwise
-will give unexpected results; if in doubt use date:yesterday..!
-
-Currently, we do not support spaces in range expressions. You can
+Currently, spaces in range expressions are not supported. You can
 replace the spaces with '\_', or (in most cases) '-', or (in some cases)
 leave the spaces out altogether. Examples in this man page use spaces
 for clarity.
 
-Open-ended ranges are supported (since Xapian 1.2.1), i.e. it's possible
-to specify date:.. or date:.. to not limit the start or
-end time, respectively. Pre-1.2.1 Xapian does not report an error on
-open ended ranges, but it does not work as expected either.
+Open-ended ranges are supported. I.e. it's possible to specify
+date:.. or date:.. to not limit the start or
+end time, respectively.
+
+Single expression
+-
+
+date: works as a shorthand for date:...
+For example, date:monday matches from the beginning of Monday until
+the end of Monday.
 
 Relative date and time
 --
@@ -446,24 +440,6 @@ Time zones
 
 Some time zone codes, e.g. UTC, EET.
 
-XAPIAN FIELD PROCESSORS
-===
-
-Certain optional features of the notmuch query processor rely on the
-presence of the Xapian field processor API. You can determine if your
-notmuch was built against a sufficiently recent version of Xapian by running
-
-::
-
-  % notmuch config get built_with.field_processor
-
-Currently the following features require field processor support:
-
-- 

[PATCH] configure: check existence of python3 setuptools and dev package

2020-05-31 Thread Tomi Ollila
The notmuch2 CFFI-based Python interface is not buildable unless
python3 dev package and python3 setuptools are installed.

Check that these exist in configure (and disable notmuch2 bindings
build if not) so that build of these bindings don't fail when make(1)
is executed.
---
 configure | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/configure b/configure
index 32a836bb..e4c738e5 100755
--- a/configure
+++ b/configure
@@ -711,12 +711,14 @@ if [ $have_python -eq 0 ]; then
 errors=$((errors + 1))
 fi
 
-have_python3=0
+have_python3_dev=0
 if [ $have_python -eq 1 ]; then
-printf "Checking for python3..."
-if "$python" -c 'import sys; assert sys.version_info >= (3,0)' > /dev/null 
2>&1; then
+printf "Checking for python3 dev..."
+if "$python" -c 'import os, sys, sysconfig;
+assert sys.version_info >= (3,0)
+assert os.path.isfile(sysconfig.get_config_h_filename())' >/dev/null 2>&1; then
 printf "Yes.\n"
-have_python3=1
+have_python3_dev=1
 else
 printf "No.\n"
 fi
@@ -724,9 +726,9 @@ fi
 
 have_python3_cffi=0
 have_python3_pytest=0
-if [ $have_python3 -eq 1 ]; then
-printf "Checking for python3 cffi... "
-if "$python" -c 'import cffi' >/dev/null 2>&1; then
+if [ $have_python3_dev -eq 1 ]; then
+printf "Checking for python3 cffi and setuptools... "
+if "$python" -c 'import cffi; import setuptools' >/dev/null 2>&1; then
 printf "Yes.\n"
 have_python3_cffi=1
 else
-- 
2.25.1

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


Re: [PATCH] emacs/tree: add notmuch-tree-filter

2020-05-31 Thread Tomi Ollila
On Sat, Apr 25 2020, William Casarin wrote:

> This implements the notmuch-tree version of notmuch-show-filter-thread
> and binds it to the L key.

No reasoning in commit message why 'L' is chosen...

Tomi

>
> Signed-off-by: William Casarin 
> ---
>  emacs/notmuch-tree.el | 9 +
>  1 file changed, 9 insertions(+)
>
> diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
> index e5c23de2..8f7738d7 100644
> --- a/emacs/notmuch-tree.el
> +++ b/emacs/notmuch-tree.el
> @@ -328,6 +328,7 @@ FUNC."
>  (define-key map "p" 'notmuch-tree-prev-matching-message)
>  (define-key map "N" 'notmuch-tree-next-message)
>  (define-key map "P" 'notmuch-tree-prev-message)
> +(define-key map "L" 'notmuch-tree-filter)
>  (define-key map (kbd "M-p") 'notmuch-tree-prev-thread)
>  (define-key map (kbd "M-n") 'notmuch-tree-next-thread)
>  (define-key map "k" 'notmuch-tag-jump)
> @@ -965,6 +966,14 @@ Complete list of currently available key bindings:
> (insert (format " (process returned %d)" exit-status)))
>   (insert "\n")
>  
> +(defun notmuch-tree-filter (query)
> +  "Filter or LIMIT the current tree based on a new query string.
> +
> +Reshows the current tree with matches defined by the new query-string."
> +  (interactive (list (notmuch-read-query "Filter tree: ")))
> +  (setq notmuch-tree-query-context (if (string= query "") nil query))
> +  (notmuch-tree-refresh-view t))
> +
>  (defun notmuch-tree-process-filter (proc string)
>"Process and filter the output of \"notmuch show\" for tree view"
>(let ((results-buf (process-buffer proc))
> -- 
> 2.25.1
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] doc: fix for out-of-tree builds of notmuch-emacs docs

2020-05-31 Thread Tomi Ollila
On Sun, May 31 2020, David Bremner wrote:

> The sphinx-doc include directive does not have the ability to include
> files from the build tree, so we replace the include with reading the
> files in conf.py. The non-trivial downside of this is that the emacs
> docstrings are now defined for every rst source file. They are
> namespaced with docstring::, so hopefully there will not be any
> surprises. One thing that is noticable is a small (absolute) time
> penalty in running sphinx-doc.

IMO good enough tolerable hack to get this done for no (read: I don't
know alternatives).

Some comments below...

> ---
>  doc/Makefile.local|  2 +-
>  doc/conf.py   | 19 +++
>  doc/notmuch-emacs.rst | 10 --
>  3 files changed, 16 insertions(+), 15 deletions(-)
>
> diff --git a/doc/Makefile.local b/doc/Makefile.local
> index b4e0c955..769438ed 100644
> --- a/doc/Makefile.local
> +++ b/doc/Makefile.local
> @@ -4,7 +4,7 @@ dir := doc
>  
>  # You can set these variables from the command line.
>  SPHINXOPTS:= -q
> -SPHINXBUILD   = WITH_EMACS=${WITH_EMACS} sphinx-build
> +SPHINXBUILD   = WITH_EMACS=${WITH_EMACS} RSTI_DIR=$(realpath emacs) 
> sphinx-build

I was about to comment the above, before realized $(realpath ...) executes
GNU Make function instead of system command :) ...

>  DOCBUILDDIR  := $(dir)/_build
>  
>  # Internal variables.
> diff --git a/doc/conf.py b/doc/conf.py
> index fc9738ff..d8841d99 100644
> --- a/doc/conf.py
> +++ b/doc/conf.py
> @@ -29,10 +29,21 @@ release = version
>  # directories to ignore when looking for source files.
>  exclude_patterns = ['_build']
>  
> -# If we don't have emacs (or the user configured --without-emacs),
> -# don't build the notmuch-emacs docs, as they need emacs to generate
> -# the docstring include files
> -if os.environ.get('WITH_EMACS') != '1':
> +if os.environ.get('WITH_EMACS') == '1':
> +# Hacky reimplementation of include to workaround limitations of
> +# sphinx-doc
> +accumulator='.. include:: /../emacs/rstdoc.rsti\n\n' # in the source tree

accumulator=['.. include:: /../emacs/rstdoc.rsti\n\n' # in the source tree]

(in list, see below)

> +rsti_dir=os.environ.get('RSTI_DIR')

spaces around '='

> +# the other files are from the build tree
> +for file in ['notmuch.rsti', 'notmuch-lib.rsti', 'notmuch-show.rsti', 
> 'notmuch-tag.rsti']:

tuple ('notmuch.rsti', 'notmuch-lib.rsti', ...) could have been used

> +with open(rsti_dir+'/'+file) as f:
> +for line in f:
> +accumulator += line
> +rst_epilog=accumulator

   accumulator.append(open(rsti_dir + '/' + file).read())
   accumulator = ''.join(accumulator)
   rst_epilog = accumulator

alternative last 2 lines

   rst_epilog = ''.join(accumulator)
   del accumulator

(I personally would have left 'accumulator' away and used 'rst_epilog'
directly (and perhaps commented its use as temporary list type).)


> +else:
> +# If we don't have emacs (or the user configured --without-emacs),
> +# don't build the notmuch-emacs docs, as they need emacs to generate
> +# the docstring include files
>  exclude_patterns.append('notmuch-emacs.rst')
>  
>  # The name of the Pygments (syntax highlighting) style to use.

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


Re: Python 3.x bindings support which versions, exactly?

2020-05-25 Thread Tomi Ollila
On Mon, May 25 2020, Floris Bruynooghe wrote:

> In tox.ini the earliest version is 3.5 and if memory serves me right
> there's a reasonably good reason for that.  I think the notmuch2
> bindings use some features not yet present in 3.4.  But anything >= 3.5
> should be supported and if not a bug.  I guess tox.ini should be updated
> with 3.8 sometime :)

I've been long thinking whether our current python3 check is "strict"
enough, as it, in configure, is:

if "$python" -c 'import sys; assert sys.version_info >= (3,0)' > /dev/null 2>&1

Perhaps that should be updated to (3,5) ?

>
> Cheers,
> Floris

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


Re: [PATCH v3 3/3] emacs: Use `dolist' instead of `mapcar' for side-effects

2020-05-24 Thread Tomi Ollila
On Sat, Apr 25 2020, Jonas Bernoulli wrote:

> As recommended by the byte-compiler.

I don't know about v3 2/3, but this, v3 3/3 looks good to me.

Tomi

> ---
>  test/emacs-attachment-warnings.el | 23 +++
>  1 file changed, 11 insertions(+), 12 deletions(-)
>
> diff --git a/test/emacs-attachment-warnings.el 
> b/test/emacs-attachment-warnings.el
> index a23692d7..8f4918ef 100644
> --- a/test/emacs-attachment-warnings.el
> +++ b/test/emacs-attachment-warnings.el
> @@ -67,16 +67,15 @@ (defvar attachment-check-tests
>  
>  (defun notmuch-test-attachment-warning-1 ()
>(let (output expected)
> -(mapcar (lambda (test)
> -   (let* ((expect (car test))
> -  (body (cdr test))
> -  (result (attachment-check-test body)))
> - (push expect expected)
> - (push (if (eq result expect)
> -   result
> - ;; In the case of a failure, include the test
> - ;; details to make it simpler to debug.
> - (format "%S <-- %S" result body))
> -   output)))
> - attachment-check-tests)
> +(dolist (test attachment-check-tests)
> +  (let* ((expect (car test))
> +  (body (cdr test))
> +  (result (attachment-check-test body)))
> + (push expect expected)
> + (push (if (eq result expect)
> +   result
> + ;; In the case of a failure, include the test
> + ;; details to make it simpler to debug.
> + (format "%S <-- %S" result body))
> +   output)))
>  (notmuch-test-expect-equal output expected)))
> -- 
> 2.26.0
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs docstrings: consistent indentation, newlines, periods

2020-05-24 Thread Tomi Ollila
Fixed emacs docstrings to be consistent. No functional change.

- removed some (accidental) indentation
- removed some trailing newlines
- added trailing periods where missing (some exclusions)
---

V2 of id:"20200503212136.11070-1-tomi.oll...@iki.fi"

changes to v1:
- trailing periods removed when example code in comments
- re-indented (setq's after For example: ..
- all 'tree view' consistently uncapitalized now 

 emacs/notmuch-address.el | 21 -
 emacs/notmuch-draft.el   |  6 +--
 emacs/notmuch-hello.el   | 11 ++---
 emacs/notmuch-jump.el|  3 +-
 emacs/notmuch-lib.el |  8 ++--
 emacs/notmuch-maildir-fcc.el |  4 +-
 emacs/notmuch-mua.el |  2 +-
 emacs/notmuch-query.el   | 13 +++---
 emacs/notmuch-show.el| 22 -
 emacs/notmuch-tag.el |  8 ++--
 emacs/notmuch-tree.el| 90 ++--
 emacs/notmuch-wash.el|  2 +-
 emacs/notmuch.el | 34 +++---
 13 files changed, 110 insertions(+), 114 deletions(-)

diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index 64887a43..0d56fba7 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -29,11 +29,11 @@
 (declare-function company-manual-begin "company")
 
 (defvar notmuch-address-last-harvest 0
-  "Time of last address harvest")
+  "Time of last address harvest.")
 
 (defvar notmuch-address-completions (make-hash-table :test 'equal)
   "Hash of email addresses for completion during email composition.
-  This variable is set by calling `notmuch-address-harvest'.")
+This variable is set by calling `notmuch-address-harvest'.")
 
 (defvar notmuch-address-full-harvest-finished nil
   "t indicates that full completion address harvesting has been
@@ -73,11 +73,11 @@ (defcustom notmuch-address-internal-completion '(sent nil)
   "Determines how internal address completion generates candidates.
 
 This should be a list of the form '(DIRECTION FILTER), where
- DIRECTION is either sent or received and specifies whether the
- candidates are searched in messages sent by the user or received
- by the user (note received by is much faster), and FILTER is
- either nil or a filter-string, such as \"date:1y..\" to append
- to the query."
+DIRECTION is either sent or received and specifies whether the
+candidates are searched in messages sent by the user or received
+by the user (note received by is much faster), and FILTER is
+either nil or a filter-string, such as \"date:1y..\" to append
+to the query."
   :type '(list :tag "Use internal address completion"
   (radio
:tag "Base completion on messages you have"
@@ -126,8 +126,7 @@ (defcustom notmuch-address-post-completion-functions nil
 
 The completed address is passed as an argument to each function.
 Note that this hook will be invoked for completion in headers
-matching `notmuch-address-completion-headers-regexp'.
-"
+matching `notmuch-address-completion-headers-regexp'."
   :type 'hook
   :group 'notmuch-address
   :group 'notmuch-hooks)
@@ -147,7 +146,7 @@ (defun notmuch-address-message-insinuate ()
   (message "calling notmuch-address-message-insinuate is no longer needed"))
 
 (defcustom notmuch-address-use-company t
-  "If available, use company mode for address completion"
+  "If available, use company mode for address completion."
   :type 'boolean
   :group 'notmuch-send
   :group 'notmuch-address)
@@ -285,7 +284,7 @@ (defun notmuch-address-harvest-filter (proc string)
 (defvar notmuch-address-harvest-procs '(nil . nil)
   "The currently running harvests.
 
-The car is a partial harvest, and the cdr is a full harvest")
+The car is a partial harvest, and the cdr is a full harvest.")
 
 (defun notmuch-address-harvest ( addr-prefix synchronous callback)
   "Collect addresses completion candidates.
diff --git a/emacs/notmuch-draft.el b/emacs/notmuch-draft.el
index 504b33be..27abc7d9 100644
--- a/emacs/notmuch-draft.el
+++ b/emacs/notmuch-draft.el
@@ -76,7 +76,7 @@ (defcustom notmuch-draft-quoted-tags '()
 
 (defcustom notmuch-draft-save-plaintext 'ask
   "Should notmuch save/postpone in plaintext messages that seem
-  like they are intended to be sent encrypted
+like they are intended to be sent encrypted
 (i.e with an mml encryption tag in it)."
   :type '(radio
  (const :tag "Never" nil)
@@ -87,10 +87,10 @@ (defcustom notmuch-draft-save-plaintext 'ask
 
 (defvar notmuch-draft-encryption-tag-regex
   "<#\\(part encrypt\\|secure.*mode=.*encrypt>\\)"
-  "Regular expression matching mml tags indicating encryption of part or 
message")
+  "Regular expression matching mml tags indicating encryption of part or 
message.")
 
 (defvar notmuch-draft-id nil
-  "Message-id of the most recent saved draft of this message")
+  "Message-id of the most recent saved draft of this message.")
 (make-variable-buffer-local 'notmuch-draft-id)
 
 (defun notmuch-draft--mark-deleted ()
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 

Re: [PATCH] tests: fix test_json_nodes() in out-of-tree builds

2020-05-24 Thread Tomi Ollila
On Thu, May 21 2020, Daniel Kahn Gillmor wrote:

> In out-of-tree builds, $TEST_DIRECTORY doesn't contain
> json_check_nodes.py.  This caused 27 tests to fail in such an
> environment.

are you shure the run_emacs.sh change in 

id:"20200423212643.864-1-tomi.oll...@iki.fi"

is not needed ? =D

Tomi

>
> Signed-off-by: Daniel Kahn Gillmor 
> ---
>  test/test-lib.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/test/test-lib.sh b/test/test-lib.sh
> index 58972339..792b1cb9 100644
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -556,7 +556,7 @@ test_json_nodes () {
>  
>   if ! test_skip "$test_subtest_name"
>   then
> - output=$(PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON 
> "$TEST_DIRECTORY"/json_check_nodes.py "$@")
> + output=$(PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON 
> "$NOTMUCH_SRCDIR"/test/json_check_nodes.py "$@")
>   if [ "$?" = 0 ]
>   then
>   test_ok_
> -- 
> 2.26.2
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs docstrings: consistent indentation, newlines, periods

2020-05-21 Thread Tomi Ollila
On Thu, May 21 2020, Daniel Kahn Gillmor wrote:

> On Mon 2020-05-04 00:21:36 +0300, Tomi Ollila wrote:
>> Fixed emacs docstrings to be consistent. No functional change.
>>
>> - removed some (accidental) indentation
>> - removed some trailing newlines
>> - added trailing periods where missing (some exclusions)
>
> This all looks good to me, except for the following changes.
>
> I think if the last line of the docstring is an example, deliberately
> indented to indicate that it is verbatim code, adding a trailing period
> is a mistake, because it encourages naive users to make the obvious
> error of including the period in their text.
>
> These were the examples i noticed in a skim of the changeset:
>
>> --- a/emacs/notmuch-draft.el
>> +++ b/emacs/notmuch-draft.el
>> @@ -45,7 +45,7 @@ (defcustom notmuch-draft-tags '("+draft")
>>  For example, if you wanted to give the message a \"draft\" tag
>>  but not the (normally added by default) \"inbox\" tag, you would
>>  set:
>> -(\"+draft\" \"-inbox\")"
>> +(\"+draft\" \"-inbox\")."
>>:type '(repeat string)
>>:group 'notmuch-draft)
>>  
>
>
>> --- a/emacs/notmuch-lib.el
>> +++ b/emacs/notmuch-lib.el
>> @@ -145,7 +145,7 @@ (defcustom notmuch-archive-tags '("-inbox")
>>  
>>  For example, if you wanted to remove an \"inbox\" tag and add an
>>  \"archived\" tag, you would set:
>> -(\"-inbox\" \"+archived\")"
>> +(\"-inbox\" \"+archived\")."
>>:type '(repeat string)
>>:group 'notmuch-search
>>:group 'notmuch-show)
>
>
>> --- a/emacs/notmuch-message.el
>> +++ b/emacs/notmuch-message.el
>> @@ -33,7 +33,7 @@ (defcustom notmuch-message-replied-tags '("+replied")
>>  
>>  For example, if you wanted to add a \"replied\" tag and remove
>>  the \"inbox\" and \"todo\" tags, you would set:
>> -(\"+replied\" \"-inbox\" \"-todo\")"
>> +(\"+replied\" \"-inbox\" \"-todo\")."
>>:type '(repeat string)
>>:group 'notmuch-send)
>>  
>> @@ -46,7 +46,7 @@ (defcustom notmuch-message-forwarded-tags '("+forwarded")
>>  
>>  For example, if you wanted to add a \"forwarded\" tag and remove
>>  the \"inbox\" tag, you would set:
>> -(\"+forwarded\" \"-inbox\")"
>> +(\"+forwarded\" \"-inbox\")."
>>:type '(repeat string)
>>:group 'notmuch-send)
>
>
>> --- a/emacs/notmuch-show.el
>> +++ b/emacs/notmuch-show.el
>> @@ -237,7 +237,7 @@ (defcustom notmuch-show-mark-read-tags '("-unread")
>>  
>>  For example, if you wanted to remove an \"unread\" tag and add a
>>  \"read\" tag (which would make little sense), you would set:
>> -(\"-unread\" \"+read\")"
>> +(\"-unread\" \"+read\")."
>>:type '(repeat string)
>>:group 'notmuch-show)
>
>
> I'd prefer this changeset to not have trailing periods when the
> docstring ends in an example.   (and maybe also to clean up any trailing
> periods that might already be in such a docstring, if they exist)
>
> I recognize this is something of an aesthetic position with no
> objectively correct answer, but so is the question of trailing periods,
> i suppose.  I'm not going to die on this hill, though.

I agree with your point. Like I mentioned I excluded trailing period at
least in one case where missing, probably similar to this. I have to
reconsider also to re-indent some content after For example: 

How I did the changeset I used David's rstdoc.el to get long list of all
docstrings and then looked through that and went editing original .el
files -- monotonic changes makes one blind of all kinds of considerations.

>
> Regards,
>
> --dkg

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


Re: test suite: FIXED messages are misordered with tests

2020-05-21 Thread Tomi Ollila
On Thu, May 21 2020, Daniel Kahn Gillmor wrote:

> On Thu 2020-05-21 00:16:48 +0300, Tomi Ollila wrote:
>> (just tested this latest works)
>
> Thanks for looking into this, Tomi!
>
> Do you have a patch to propose?

Looked a bit (now). Somewhat complicated to make perfect (enemy of good)
change.

print_test_description could be added as first line in 
test_known_broken_ok_ (then inconsistent with test_known_broken_failure_)
or in test_ok_ just before calling test_known_broken_ok_ 
(test_known_broken_ok_ is called only once in test-lib.sh)

but it looks like test_check_missing_external_prereqs_ and
test_report_skip_ may be called before print_test_description is called
(and there may be more...)

We've accumulated quite a bit of mess during these years to the test
system, which makes it harder to do larger adjustments (and not (yet)
mentioning even larger refactorings...).

>
>--dkg

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


Re: test suite: FIXED messages are misordered with tests

2020-05-20 Thread Tomi Ollila
On Thu, May 21 2020, Tomi Ollila wrote:

>
> the message that prints FIXED, does not execute print_test_description
> but the ones that do BROKEN or FAIL does (did not fully check but yes).
>
> And:
>
> print_test_description ()
> {
> test -z "$test_description_printed" || return 0
> echo
> echo $this_test: "Testing ${test_description}"
> test_description_printed=1
> }


btw: I would rewrite this function as:

 print_test_description ()
 {
 echo
 echo $this_test: "Testing ${test_description}"

 print_test_description () { :; } 
 }

If I wanted to reduce XTRACE noise (even further), even further:

 _print_test_description ()
 {
 echo
 echo $this_test: "Testing ${test_description}"

 print_test_description=
 }
 print_test_description=_print_test_description

(and then use $print_test_description in "calls")

or even

 alias print_test_description='
   echo
   echo echo $this_test: "Testing ${test_description}"
   alias print_test_description='

(just tested this latest works)

Note on aliases: bash namual states:

 For almost every purpose, aliases are superseded by shell functions.

One notable exception is XTRACE noise reduction. In our case best 
candidate would be prerequisite work -- but SMOP..

Tomi

> if [ -z "$NOTMUCH_TEST_QUIET" ]
> then
> print_test_description
> fi
>
> Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: test suite: FIXED messages are misordered with tests

2020-05-20 Thread Tomi Ollila
On Tue, May 12 2020, Daniel Kahn Gillmor wrote:

> I'm debugging/diagnosing/trying to clean up some "FIXED" known-broken
> tests right now.
>
> Sometimes, depending on circumstances i can't predict (race
> conditions?), I see funny output like:
>
> ~~~
> Use "make V=1" to see the details for passing and known broken tests.
> INFO: using 2m timeout for tests
> INFO: running tests with moreutils parallel
>  FIXED  verify signed PKCS#7 subject (onepart-signed) signer User ID
>
> T356-protected-headers: Testing Message decryption with protected headers
>  BROKEN confirm signed and encrypted PKCS#7 subject (sign+enc)
>  BROKEN confirm signed and encrypted PKCS#7 subject (sign+enc) signer User ID
>  BROKEN confirm signed and encrypted PKCS#7 subject (sign+enc+legacy-disp)
>  BROKEN confirm signed and encrypted PKCS#7 subject (sign+enc+legacy-disp) 
> signer User ID
>  BROKEN confirm encryption-protected PKCS#7 subject (enc+legacy-disp)
> ~~~
>
> Clearly, that FIXED should come *after* the "T356-protected-headers:"
> separator.


After your second mail I tried to reproduce by taking a test file,
marking one known_broken, even it is not to get FIXED, and then broke
next one.

And I got it reproduced.

the message that prints FIXED, does not execute print_test_description
but the ones that do BROKEN or FAIL does (did not fully check but yes).

And:

print_test_description ()
{
test -z "$test_description_printed" || return 0
echo
echo $this_test: "Testing ${test_description}"
test_description_printed=1
}
if [ -z "$NOTMUCH_TEST_QUIET" ]
then
print_test_description
fi


Tomi


>
> This is a minor bug, i suppose, but i confess i don't understand the
> maze of shell functions in test-lib.sh well enough to see why this is
> happening, let alone to fix it.
>
> Anyone interested in fixing it should be able to do so by marking a good
> test "known broken" and then re-running the test suite.  The above
> output is taken from:
>
> make -j4 check NOTMUCH_TESTS=T356-protected-headers.sh
>
> Sorry to send a bug report with no fixes!
>
>--dkg
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: feature request: parameters for reply templates

2020-05-13 Thread Tomi Ollila
On Wed, May 13 2020, Jörg Volbers wrote:

> OK, seems there is something I do not understand. What do you mean 
> with "spec in mind"?

In this particular case the implementation is probably pretty easy
(still SMOP, though), just what exactly should be done is the hard
part, to get nice, clean, useable and maintainable solution.

Tomi

>
> JV
>
>
> Tomi Ollila  writes:
>
>> 
>> Did you have spec in mind ? =D 
>> 
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: feature request: parameters for reply templates

2020-05-12 Thread Tomi Ollila
On Tue, May 12 2020, Jörg Volbers wrote:

>> My gut reaction is that doing more formatting in notmuch reply 
>> is probably a mistake; it's hard enough to get two users to 
>> agree on these kind of customizations, never mind two different 
>> MUAs. Probably what we need to do is make sure the structured 
>> (json/s-expr) output has enough information for clients to do 
>> what they need/want to do.
>
> I agree, but why not add some switches which allow to turn some 
> aspects of the reply output on or off? I am thinking here in 
> particular of the parts which are not plain text. Since not every 
> mail has an attachment, it makes perfect sense to let the user 
> decide whether a reply includes a text reference to the 
> attachment. A simple on-off-switch would be enough.

Did you have spec in mind ? =D

>
> JV
>

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


Re: [PATCH 1/2 v2] test-lib: mark function variables as local

2020-05-09 Thread Tomi Ollila
On Fri, May 08 2020, Daniel Kahn Gillmor wrote:

> Several functions in test/test-lib.sh used variable names that are
> also used outside of those functions (e.g. $output and $expected are
> used in many of the test scripts), but they are not expected to
> communicate via those variables.
>
> We mark those variables "local" within test-lib.sh so that they do not
> get clobbered when used outside test-lib.
>
> We also move the local variable declarations to beginning of each
> function, to avoid weird gotchas with local variable declarations as
> described in https://tldp.org/LDP/abs/html/localvar.html.

LGTM. I have to tolerate 'we' (passive) as I seem to use those myself, too
(although communicating a bit different thing...) =D

Tomi

> Signed-off-by: Daniel Kahn Gillmor 
> ---
>  test/test-lib.sh | 31 ++-
>  1 file changed, 22 insertions(+), 9 deletions(-)
>
> diff --git a/test/test-lib.sh b/test/test-lib.sh
> index 5c8eab7c..58972339 100644
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -109,7 +109,6 @@ unset ALTERNATE_EDITOR
>  
>  add_gnupg_home ()
>  {
> -local output
>  [ -e "${GNUPGHOME}/gpg.conf" ] && return
>  _gnupg_exit () { gpgconf --kill all 2>/dev/null || true; }
>  at_exit_function _gnupg_exit
> @@ -345,13 +344,14 @@ trap 'trap_signal' HUP INT TERM
>  # to the message and encrypting/signing.
>  emacs_deliver_message ()
>  {
> -local subject="$1"
> -local body="$2"
> +local subject body smtp_dummy_pid smtp_dummy_port
> +subject="$1"
> +body="$2"
>  shift 2
>  # before we can send a message, we have to prepare the FCC maildir
>  mkdir -p "$MAIL_DIR"/sent/{cur,new,tmp}
>  # eval'ing smtp-dummy --background will set smtp_dummy_pid and -_port
> -local smtp_dummy_pid= smtp_dummy_port=
> +smtp_dummy_pid= smtp_dummy_port=
>  eval `$TEST_DIRECTORY/smtp-dummy --background sent_message`
>  test -n "$smtp_dummy_pid" || return 1
>  test -n "$smtp_dummy_port" || return 1
> @@ -391,13 +391,14 @@ emacs_deliver_message ()
>  # new" after message delivery
>  emacs_fcc_message ()
>  {
> -local nmn_args=''
> +local nmn_args subject body
> +nmn_args=''
>  while [[ "$1" =~ ^-- ]]; do
>  nmn_args="$nmn_args $1"
>  shift
>  done
> -local subject="$1"
> -local body="$2"
> +subject="$1"
> +body="$2"
>  shift 2
>  # before we can send a message, we have to prepare the FCC maildir
>  mkdir -p "$MAIL_DIR"/sent/{cur,new,tmp}
> @@ -427,6 +428,7 @@ emacs_fcc_message ()
>  # number of messages.
>  add_email_corpus ()
>  {
> +local corpus
>  corpus=${1:-default}
>  
>  rm -rf ${MAIL_DIR}
> @@ -457,6 +459,7 @@ test_begin_subtest ()
>  # name.
>  test_expect_equal ()
>  {
> + local output expected testname
>   exec 1>&6 2>&7  # Restore stdout and stderr
>   if [ -z "$inside_subtest" ]; then
>   error "bug in the test script: test_expect_equal without 
> test_begin_subtest"
> @@ -483,6 +486,7 @@ test_expect_equal ()
>  # Like test_expect_equal, but takes two filenames.
>  test_expect_equal_file ()
>  {
> + local file1 file2 testname basename1 basename2
>   exec 1>&6 2>&7  # Restore stdout and stderr
>   if [ -z "$inside_subtest" ]; then
>   error "bug in the test script: test_expect_equal_file without 
> test_begin_subtest"
> @@ -512,10 +516,11 @@ test_expect_equal_file ()
>  # canonicalized before diff'ing.  If an argument cannot be parsed, it
>  # is used unchanged so that there's something to diff against.
>  test_expect_equal_json () {
> +local script output expected
>  # The test suite forces LC_ALL=C, but this causes Python 3 to
>  # decode stdin as ASCII.  We need to read JSON in UTF-8, so
>  # override Python's stdio encoding defaults.
> -local script='import json, sys; json.dump(json.load(sys.stdin), 
> sys.stdout, sort_keys=True, indent=4)'
> +script='import json, sys; json.dump(json.load(sys.stdin), sys.stdout, 
> sort_keys=True, indent=4)'
>  output=$(echo "$1" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -c "$script" 
> \
>  || echo "$1")
>  expected=$(echo "$2" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -c 
> "$script" \
> @@ -540,6 +545,7 @@ test_sort_json () {
>  # read the source of test/json_check_nodes.py (or the output when
>  # invoking it without arguments) for an explanation of the syntax.
>  test_json_nodes () {
> +local output
>  exec 1>&6 2>&7   # Restore stdout and stderr
>   if [ -z "$inside_subtest" ]; then
>   error "bug in the test script: test_json_eval without 
> test_begin_subtest"
> @@ -561,6 +567,7 @@ test_json_nodes () {
>  }
>  
>  test_emacs_expect_t () {
> + local result
>   test "$#" = 1 ||
>   error "bug in the test script: not 1 parameter to test_emacs_expect_t"
>   if [ -z "$inside_subtest" ]; then
> @@ -653,7 +660,8 @@ notmuch_json_show_sanitize 

Re: [PATCH 2/2] smime: tests of X.509 certificate validity are known-broken on GMime < 3.2.7

2020-05-07 Thread Tomi Ollila
On Wed, May 06 2020, Daniel Kahn Gillmor wrote:

> When checking cryptographic signatures, Notmuch relies on GMime to
> tell it whether the certificate that signs a message has a valid User
> ID or not.
>
> If the User ID is not valid, then notmuch does not report the signer's
> User ID to the user.  This means that the consumer of notmuch's
> cryptographic summary of a message (or of its protected headers) can
> be confident in relaying the reported identity to the user.
>
> However, some versions of GMime before 3.2.7 cannot report Certificate
> validity for X.509 certificates.  This is resolved upstream in GMime
> at https://github.com/jstedfast/gmime/pull/90.
>
> We adapt to this by marking tests of reported User IDs for
> S/MIME-signed messages as known-broken if GMime is older than 3.2.7
> and has not been patched.
>
> If GMime >= 3.2.7 and certificate validity still doesn't work for
> X.509 certs, then there has likely been a regression in GMime and we
> should fail early, during ./configure.
>
> To break out these specific User ID checks from other checks, i had to
> split some tests into two parts, and reuse $output across the two
> subtests.

This works, on top of the previous series -- I skipped git am:ing 1/2,
so thos works without it -- it is good stuff just IMO requires some changes)

Tomi

>
> Signed-off-by: Daniel Kahn Gillmor 
> ---
>  configure  | 79 ++
>  test/T355-smime.sh | 19 +---
>  test/T356-protected-headers.sh | 15 ++-
>  3 files changed, 104 insertions(+), 9 deletions(-)
>
> diff --git a/configure b/configure
> index 0cfdaa6f..92e5bd1b 100755
> --- a/configure
> +++ b/configure
> @@ -536,6 +536,82 @@ EOF
>  if [ -n "$TEMP_GPG" -a -d "$TEMP_GPG" ]; then
>  rm -rf "$TEMP_GPG"
>  fi
> +
> +# see https://github.com/jstedfast/gmime/pull/90
> +# should be fixed in GMime in 3.2.7, but some distros might patch
> +printf "Checking for GMime X.509 certificate validity... "
> +
> +cat > _check_x509_validity.c < +#include 
> +#include 
> +
> +int main () {
> +GError *error = NULL;
> +GMimeParser *parser = NULL;
> +GMimeApplicationPkcs7Mime *body = NULL;
> +GMimeSignatureList *sig_list = NULL;
> +GMimeSignature *sig = NULL;
> +GMimeCertificate *cert = NULL;
> +GMimeObject *output = NULL;
> +GMimeValidity validity = GMIME_VALIDITY_UNKNOWN;
> +int len;
> +
> +g_mime_init ();
> +parser = g_mime_parser_new ();
> +g_mime_parser_init_with_stream (parser, 
> g_mime_stream_file_open("test/corpora/pkcs7/smime-onepart-signed.eml", "r", 
> ));
> +if (error) return !! fprintf (stderr, "failed to instantiate parser with 
> test/corpora/pkcs7/smime-onepart-signed.eml\n");
> +
> +body = GMIME_APPLICATION_PKCS7_MIME(g_mime_message_get_mime_part 
> (g_mime_parser_construct_message (parser, NULL)));
> +if (body == NULL) return !!  fprintf (stderr, "did not find a 
> application/pkcs7 message\n");
> +
> +sig_list = g_mime_application_pkcs7_mime_verify (body, 
> GMIME_VERIFY_NONE, , );
> +if (error || output == NULL) return !! fprintf (stderr, "verify 
> failed\n");
> +
> +if (sig_list == NULL) return !! fprintf (stderr, "no GMimeSignatureList 
> found\n");
> +len = g_mime_signature_list_length (sig_list);
> +if (len != 1) return !! fprintf (stderr, "expected 1 signature, got 
> %d\n", len);
> +sig = g_mime_signature_list_get_signature (sig_list, 0);
> +if (sig == NULL) return !! fprintf (stderr, "no GMimeSignature found at 
> position 0\n");
> +cert = g_mime_signature_get_certificate (sig);
> +if (cert == NULL) return !! fprintf (stderr, "no GMimeCertificate 
> found\n");
> +validity = g_mime_certificate_get_id_validity (cert);
> +if (validity != GMIME_VALIDITY_FULL) return !! fprintf (stderr, "Got 
> validity %d, expected %d\n", validity, GMIME_VALIDITY_FULL);
> +
> +return 0;
> +}
> +EOF
> +if ! TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XX"); then
> +printf 'No.\nCould not make tempdir for testing X.509 certificate 
> validity support.\n'
> +errors=$((errors + 1))
> +elif ${CC} ${CFLAGS} ${gmime_cflags} _check_x509_validity.c 
> ${gmime_ldflags} -o _check_x509_validity \
> +&& echo disable-crl-checks > "$TEMP_GPG/gpgsm.conf" \
> +&& echo 
> "4D:E0:FF:63:C0:E9:EC:01:29:11:C8:7A:EE:DA:3A:9A:7F:6E:C1:0D S" >> 
> "$TEMP_GPG/trustlist.txt" \
> +&& GNUPGHOME=${TEMP_GPG} gpgsm --batch --quiet --import < 
> "$srcdir"/test/smime/ca.crt
> +then
> +if GNUPGHOME=${TEMP_GPG} ./_check_x509_validity; then
> +gmime_x509_cert_validity=1
> +printf "Yes.\n"
> +else
> +gmime_x509_cert_validity=0
> +printf "No.\n"
> +if pkg-config --exists "gmime-3.0 >= 3.2.7"; then
> +cat < +*** Error: GMime fails to calculate X.509 certificate validity, and
> +is later 

Re: [PATCH 1/2] test-lib: mark function variables as local

2020-05-07 Thread Tomi Ollila
On Wed, May 06 2020, Daniel Kahn Gillmor wrote:

> Several functions in test/test-lib.sh used variable names that are
> also used outside of those functions (e.g. $output and $expected are
> used in many of the test scripts), but they are not expected to
> communicate via those variables.
>
> We mark those variables "local" within test-lib.sh so that they do not
> get clobbered when used outside test-lib.


Good stuff

robustness comment IMO:

There is slight difference when writing

local foo=`false`

and

local foo; foo=`false`


former does not "fail"; latter does,


Although there is (currently!) no difference in our test code
(we don't have `set -e` there, IMO the former serves as a bad
example for anyone looking the code. 

(same applies to export foo=`bar`, readonly foo=`bar` and so
on, for anyone curious...)

IMO better declare all local variables in one line separately,
e.g.

local output expected

and then either

output=$1
expected=$2
or
output=$1 expected=$2

( FYI: exection latter in shell differs in a way one could do
  output=$expected expected=$output ) (IIRC, did not test >;)

(add double quotes around $1 and $2 if you desire =D)


well, when doing change just add the `local` line, smaller diff :)


Tomi

>
> Signed-off-by: Daniel Kahn Gillmor 
> ---
>  test/test-lib.sh | 44 ++--
>  1 file changed, 22 insertions(+), 22 deletions(-)
>
> diff --git a/test/test-lib.sh b/test/test-lib.sh
> index 5c8eab7c..e8feab3b 100644
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -109,7 +109,6 @@ unset ALTERNATE_EDITOR
>  
>  add_gnupg_home ()
>  {
> -local output
>  [ -e "${GNUPGHOME}/gpg.conf" ] && return
>  _gnupg_exit () { gpgconf --kill all 2>/dev/null || true; }
>  at_exit_function _gnupg_exit
> @@ -427,7 +426,7 @@ emacs_fcc_message ()
>  # number of messages.
>  add_email_corpus ()
>  {
> -corpus=${1:-default}
> +local corpus=${1:-default}
>  
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Handle PKCS#7 S/MIME messages

2020-05-05 Thread Tomi Ollila
On Mon, May 04 2020, Daniel Kahn Gillmor wrote:

> Hi Tomi--
>
> On Sat 2020-05-02 00:15:57 +0300, Tomi Ollila wrote:
>> I did not see anything suspicious in code, but
>>
>> I got these test failures:
>>
>> in ubuntu 19.10 native environment, and
>>
>> in debian 10 (podman) container running in fedora 31 system
>>
>>
>> T355-smime: Testing S/MIME signature verification and decryption
>>  FAIL   Verify signature on PKCS#7 SignedData message
>>  crypto: value not equal: data[0][0][0]["crypto"]["signed"]["status"][0] =
>>  {'status': 'good', 
>>   'fingerprint': '702BA4B157F1E2B7D16B0C6A5FFC8A7DE2057DEB', 
>>   'created': 1574813489,
>>   'expires': 2611032858} != 
>>  {'created': 1574813489, 
>>   'expires': 2611032858,
>>   'fingerprint': '702BA4B157F1E2B7D16B0C6A5FFC8A7DE2057DEB', 
>>   'userid': 'CN=Alice Lovelace', 
>>   'status': 'good'}
>>
>> T356-protected-headers: Testing Message decryption with protected headers
>>  FAIL   verify signed PKCS#7 subject (multipart-signed)
>>  sig_uid: object not found:  
>> data[0][0][0]["crypto"]["signed"]["status"][0]["userid"]
>>  FAIL   verify signed PKCS#7 subject (onepart-signed)
>>  sig_uid: object not found: 
>> data[0][0][0]["crypto"]["signed"]["status"][0]["userid"]
>>  FAIL   confirm signed and encrypted PKCS#7 subject (sign+enc)
>>  sig_uid: object not found: 
>> data[0][0][0]["crypto"]["signed"]["status"][0]["userid"]
>>  FAIL   confirm signed and encrypted PKCS#7 subject (sign+enc+legacy-disp)
>>  sig_uid: object not found: 
>> data[0][0][0]["crypto"]["signed"]["status"][0]["userid"]
>
> Thanks for identifying these.  These are problems related to a bug in
> the released version of GMime on those platforms.  Unfixed versions of
> gmime cannot report *any* certificate validity for X.509 certificates:
>
>https://github.com/jstedfast/gmime/pull/90
>
> The fix for gmime is pretty simple, but it's not something we can
> address directly in notmuch.
>
> The fix was first released in GMime version 3.2.7, but it was first in
> debian in gmime 3.2.6-2, and should be relatively easy to backport for
> any distro that wants it (i suppose i could probably get it into the
> next point release for debian 10 as well, since it is a bugfix for an
> already-exposed API).
>
> So, how should we deal with this in notmuch?  It seems a bit silly to
> bump our required version of gmime to the (relatively new) version
> 3.2.7, for a fix for a cornercase of a novel use case.
>
> Maybe the test suite should change based on version of GMime?  That
> would cause problems for distros that backport the GMime fix, though.
>
> I guess i could write a reproducer for the gmime issue and we could
> include it in ./configure, and modify the test suite on that basis.

Reproducer in case gmime version is less than 3.2.7 -- with newer
gmimes that has to work so if that ever broke in newer gmimes we'd
notice (reproducer could hide that).

>
> Any other suggestions?
>
> --dkg

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


Re: [PATCH 1/2] test: known broken test for reindex tag preservation

2020-05-04 Thread Tomi Ollila
On Mon, May 04 2020, David Bremner wrote:

> In id:1588595993-ner-8.651@TPL520 Franz Fellner reported that tags
> starting with 'attachment' are removed by 'notmuch reindex'. This is
> probably related to the use of STRNCMP_LITERAL in

Haa, I looked this briefly but failed to see it is STRNCMP_LITERAL,
not STRCMP_LITERAL (the latter could be optimized strcmp using memcmp
w/ constant len)

Series LGTM (I'm trying to look away that 'we' passive ;)

Tomi

> _notmuch_message_remove_indexed_terms.
> ---
>  test/T700-reindex.sh | 9 +
>  1 file changed, 9 insertions(+)
>
> diff --git a/test/T700-reindex.sh b/test/T700-reindex.sh
> index 9e795896..7b7e52de 100755
> --- a/test/T700-reindex.sh
> +++ b/test/T700-reindex.sh
> @@ -33,6 +33,15 @@ notmuch reindex '*'
>  notmuch dump > OUTPUT
>  test_expect_equal_file initial-dump OUTPUT
>  
> +test_begin_subtest 'reindex preserves tags with special prefixes'
> +test_subtest_known_broken
> +notmuch tag +attachment2 +encrypted2 +signed2  '*'
> +notmuch dump > EXPECTED
> +notmuch reindex '*'
> +notmuch dump > OUTPUT
> +notmuch tag -attachment2 -encrypted2 -signed2  '*'
> +test_expect_equal_file EXPECTED OUTPUT
> +
>  test_begin_subtest 'reindex moves a message between threads'
>  notmuch search --output=threads id:87iqd9rn3l.fsf@vertex.dottedmag > EXPECTED
>  # re-parent
> -- 
> 2.26.2
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs docstrings: consistent indentation, newlines, periods

2020-05-03 Thread Tomi Ollila
Fixed emacs docstrings to be consistent. No functional change.

- removed some (accidental) indentation
- removed some trailing newlines
- added trailing periods where missing (some exclusions)
---
 emacs/notmuch-address.el | 21 -
 emacs/notmuch-draft.el   |  8 ++--
 emacs/notmuch-hello.el   | 11 ++---
 emacs/notmuch-jump.el|  3 +-
 emacs/notmuch-lib.el | 10 ++--
 emacs/notmuch-maildir-fcc.el |  4 +-
 emacs/notmuch-message.el |  4 +-
 emacs/notmuch-mua.el |  2 +-
 emacs/notmuch-query.el   | 13 +++---
 emacs/notmuch-show.el| 24 +-
 emacs/notmuch-tag.el |  8 ++--
 emacs/notmuch-tree.el| 88 ++--
 emacs/notmuch-wash.el|  2 +-
 emacs/notmuch.el | 34 +++---
 14 files changed, 114 insertions(+), 118 deletions(-)

diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index 64887a43..0d56fba7 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -29,11 +29,11 @@
 (declare-function company-manual-begin "company")
 
 (defvar notmuch-address-last-harvest 0
-  "Time of last address harvest")
+  "Time of last address harvest.")
 
 (defvar notmuch-address-completions (make-hash-table :test 'equal)
   "Hash of email addresses for completion during email composition.
-  This variable is set by calling `notmuch-address-harvest'.")
+This variable is set by calling `notmuch-address-harvest'.")
 
 (defvar notmuch-address-full-harvest-finished nil
   "t indicates that full completion address harvesting has been
@@ -73,11 +73,11 @@ (defcustom notmuch-address-internal-completion '(sent nil)
   "Determines how internal address completion generates candidates.
 
 This should be a list of the form '(DIRECTION FILTER), where
- DIRECTION is either sent or received and specifies whether the
- candidates are searched in messages sent by the user or received
- by the user (note received by is much faster), and FILTER is
- either nil or a filter-string, such as \"date:1y..\" to append
- to the query."
+DIRECTION is either sent or received and specifies whether the
+candidates are searched in messages sent by the user or received
+by the user (note received by is much faster), and FILTER is
+either nil or a filter-string, such as \"date:1y..\" to append
+to the query."
   :type '(list :tag "Use internal address completion"
   (radio
:tag "Base completion on messages you have"
@@ -126,8 +126,7 @@ (defcustom notmuch-address-post-completion-functions nil
 
 The completed address is passed as an argument to each function.
 Note that this hook will be invoked for completion in headers
-matching `notmuch-address-completion-headers-regexp'.
-"
+matching `notmuch-address-completion-headers-regexp'."
   :type 'hook
   :group 'notmuch-address
   :group 'notmuch-hooks)
@@ -147,7 +146,7 @@ (defun notmuch-address-message-insinuate ()
   (message "calling notmuch-address-message-insinuate is no longer needed"))
 
 (defcustom notmuch-address-use-company t
-  "If available, use company mode for address completion"
+  "If available, use company mode for address completion."
   :type 'boolean
   :group 'notmuch-send
   :group 'notmuch-address)
@@ -285,7 +284,7 @@ (defun notmuch-address-harvest-filter (proc string)
 (defvar notmuch-address-harvest-procs '(nil . nil)
   "The currently running harvests.
 
-The car is a partial harvest, and the cdr is a full harvest")
+The car is a partial harvest, and the cdr is a full harvest.")
 
 (defun notmuch-address-harvest ( addr-prefix synchronous callback)
   "Collect addresses completion candidates.
diff --git a/emacs/notmuch-draft.el b/emacs/notmuch-draft.el
index 504b33be..531666d0 100644
--- a/emacs/notmuch-draft.el
+++ b/emacs/notmuch-draft.el
@@ -45,7 +45,7 @@ (defcustom notmuch-draft-tags '("+draft")
 For example, if you wanted to give the message a \"draft\" tag
 but not the (normally added by default) \"inbox\" tag, you would
 set:
-(\"+draft\" \"-inbox\")"
+(\"+draft\" \"-inbox\")."
   :type '(repeat string)
   :group 'notmuch-draft)
 
@@ -76,7 +76,7 @@ (defcustom notmuch-draft-quoted-tags '()
 
 (defcustom notmuch-draft-save-plaintext 'ask
   "Should notmuch save/postpone in plaintext messages that seem
-  like they are intended to be sent encrypted
+like they are intended to be sent encrypted
 (i.e with an mml encryption tag in it)."
   :type '(radio
  (const :tag "Never" nil)
@@ -87,10 +87,10 @@ (defcustom notmuch-draft-save-plaintext 'ask
 
 (defvar notmuch-draft-encryption-tag-regex
   "<#\\(part encrypt\\|secure.*mode=.*encrypt>\\)"
-  "Regular expression matching mml tags indicating encryption of part or 
message")
+  "Regular expression matching mml tags indicating encryption of part or 
message.")
 
 (defvar notmuch-draft-id nil
-  "Message-id of the most recent saved draft of this message")
+  "Message-id of the most recent saved draft of this message.")
 (make-variable-buffer-local 

Re: Handle PKCS#7 S/MIME messages

2020-05-01 Thread Tomi Ollila
On Thu, Apr 30 2020, Daniel Kahn Gillmor wrote:

> This series applies after the "Add tests for S/MIME PKCS#7 messages"
> series, which was introduced in
> id:20200428185723.660184-1-...@fifthhorseman.net
>
> With this series applied, notmuch handles standard PKCS#7 S/MIME
> messages (using GnuPG's gpgsm as a backend, as mediated by GMime's use
> of GPGME) as well as it handles PGP/MIME messages.
>
> In addition to showing and replying to these messages, the series
> covers indexing the cleartext of encrypted messages, and understanding
> protected headers.

I did not see anything suspicious in code, but

I got these test failures:

in ubuntu 19.10 native environment, and

in debian 10 (podman) container running in fedora 31 system


T355-smime: Testing S/MIME signature verification and decryption
 FAIL   Verify signature on PKCS#7 SignedData message
 crypto: value not equal: data[0][0][0]["crypto"]["signed"]["status"][0] =
 {'status': 'good', 
  'fingerprint': '702BA4B157F1E2B7D16B0C6A5FFC8A7DE2057DEB', 
  'created': 1574813489,
  'expires': 2611032858} != 
 {'created': 1574813489, 
  'expires': 2611032858,
  'fingerprint': '702BA4B157F1E2B7D16B0C6A5FFC8A7DE2057DEB', 
  'userid': 'CN=Alice Lovelace', 
  'status': 'good'}

T356-protected-headers: Testing Message decryption with protected headers
 FAIL   verify signed PKCS#7 subject (multipart-signed)
 sig_uid: object not found:  
data[0][0][0]["crypto"]["signed"]["status"][0]["userid"]
 FAIL   verify signed PKCS#7 subject (onepart-signed)
 sig_uid: object not found: 
data[0][0][0]["crypto"]["signed"]["status"][0]["userid"]
 FAIL   confirm signed and encrypted PKCS#7 subject (sign+enc)
 sig_uid: object not found: 
data[0][0][0]["crypto"]["signed"]["status"][0]["userid"]
 FAIL   confirm signed and encrypted PKCS#7 subject (sign+enc+legacy-disp)
 sig_uid: object not found: 
data[0][0][0]["crypto"]["signed"]["status"][0]["userid"]

>
>   --dkg

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


Re: [PATCH 15/15] tests: disable CRL checks from gpgsm

2020-04-29 Thread Tomi Ollila
On Tue, Apr 28 2020, Daniel Kahn Gillmor wrote:

> GPGME has a strange failure mode when it is in offline mode, and/or
> when certificates don't have any CRLs: in particular, it refuses to
> accept the validity of any certificate other than a "root" cert.
>
> This can be worked around by setting the `disable-crl-checks`
> configuration variable for gpgsm.
>
> I've reported this to the GPGME upstream at
> https://dev.gnupg.org/T4883, but I have no idea how it will be
> resolved.  In the meantime, we'll just work around it.
>
> Note that this fixes the test for verification of
> id:smime-multipart-signed@protected-headers.example, because
> multipart/signed messages are already handled correctly (one-part
> PKCS#7 messages will get fixed later).
>
> Signed-off-by: Daniel Kahn Gillmor 

Rest of the series look tolerable to me. That one missing 
"inconsistent quotes" is inconsistent with added quotes
in one of the changes in previous email (which just did that)

Otherwise OK (provided that tests pass)
(except that https://www.ietf.org/id/draft-dkg-lamps-samples-01.html
if not found (by me either, like David)


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


Re: [PATCH 08/15] tests/smime: include secret key material for Bob

2020-04-29 Thread Tomi Ollila
On Tue, Apr 28 2020, Daniel Kahn Gillmor wrote:

> This is taken from the same Internet Draft that test/smime/ca.crt
> comes from.  See that draft for more details.
> https://www.ietf.org/id/draft-dkg-lamps-samples-02.html#name-pkcs12-object-for-bob
>
> We don't use it yet, but it will be used to decrypt other messages in
> the test suite.
>
> Note that we include it here with an empty passphrase, rather than
> with the passphrase "bob" that it is supplied with in the I-D.  The
> underlying cryptographic material is the same, but this way we can
> import cleanly into gpgsm without having a passphrase set on it (gpgsm
> converts an empty-string passphrase into no passphrase at all on
> import).
>
> Signed-off-by: Daniel Kahn Gillmor 
> ---

// stuff deleted //

> diff --git a/test/test-lib.sh b/test/test-lib.sh
> index d9997b27..dd7fdfaa 100644
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -145,6 +145,8 @@ add_gpgsm_home ()
>  gpgsm --quiet --batch --no-tty --no-common-certs-import 
> --disable-dirmngr --import < $NOTMUCH_SRCDIR/test/smime/ca.crt
>  echo "4D:E0:FF:63:C0:E9:EC:01:29:11:C8:7A:EE:DA:3A:9A:7F:6E:C1:0D S" >> 
> "$GNUPGHOME/trustlist.txt"
>  echo include-certs::1 | gpgconf --output /dev/null --change-options gpgsm
> +gpgsm --batch --no-tty --no-common-certs-import --pinentry-mode=loopback 
> --passphrase-fd 3 \
> +  --disable-dirmngr --import $NOTMUCH_SRCDIR/test/smime/bob.p12 
> >>"$GNUPGHOME"/import.log 2>&1 3<<<''

Now that I started w/ consistenly quotes -- "$NOTMUCH_SRCDIR/..."

Or maybe not, is this variable consistently unquoted -- or something ;)

Tomi

>  test_debug "cat $GNUPGHOME/import.log"
>  }
>  
> -- 
> 2.26.2
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 07/15] test: Allow tests to have both gpg and gpgsm active at once

2020-04-29 Thread Tomi Ollila
On Tue, Apr 28 2020, Daniel Kahn Gillmor wrote:

> Without this fix, we couldn't run both add_gnupg_home and
> add_gpgsm_home in the same test script.
>
> Signed-off-by: Daniel Kahn Gillmor 
> ---
>  test/test-lib.sh | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/test/test-lib.sh b/test/test-lib.sh
> index ac1b9315..d9997b27 100644
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -110,10 +110,10 @@ unset ALTERNATE_EDITOR
>  add_gnupg_home ()
>  {
>  local output
> -[ -d ${GNUPGHOME} ] && return
> +[ -e ${GNUPGHOME}/gpg.conf ] && return

So far so good (except perhaps David's comment not "url" not found)

But here this change could include "consistently quoted" variable
(or/and have it done in that one commit earlier...)

So LGTM 1-7, provided that tests pass...

Tomi


>  _gnupg_exit () { gpgconf --kill all 2>/dev/null || true; }
>  at_exit_function _gnupg_exit
> -mkdir -m 0700 "$GNUPGHOME"
> +mkdir -p -m 0700 "$GNUPGHOME"
>  gpg --no-tty --import <$NOTMUCH_SRCDIR/test/gnupg-secret-key.asc 
> >"$GNUPGHOME"/import.log 2>&1
>  test_debug "cat $GNUPGHOME/import.log"
>  if (gpg --quick-random --version >/dev/null 2>&1) ; then
> @@ -132,10 +132,10 @@ add_gnupg_home ()
>  add_gpgsm_home ()
>  {
>  local fpr
> -[ -d "$GNUPGHOME" ] && return
> +[ -e "$GNUPGHOME/gpgsm.conf" ] && return
>  _gnupg_exit () { gpgconf --kill all 2>/dev/null || true; }
>  at_exit_function _gnupg_exit
> -mkdir -m 0700 "$GNUPGHOME"
> +mkdir -p -m 0700 "$GNUPGHOME"
>  openssl pkcs12 -export -passout pass: -inkey 
> "$NOTMUCH_SRCDIR/test/smime/key+cert.pem" \
>  < "$NOTMUCH_SRCDIR/test/smime/test.crt" | \
>  gpgsm --batch --no-tty --no-common-certs-import 
> --pinentry-mode=loopback --passphrase-fd 3 \
> -- 
> 2.26.2
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Inconsistencies in handling command flags: `--flag=value` different than `--flag value`

2020-04-29 Thread Tomi Ollila
On Tue, Apr 28 2020, Daniel Kahn Gillmor wrote:

>
> One final way we could normalize everything and make it less
> idiosyncratic, with shorter, simpler man pages: deprecate and then drop
> the --booloption/--no-booloption mechanisms, requiring --booloption=true
> or --booloption=false instead.  Once they're dropped, allow whitespace
> between "--booloption true" and "--booloption false" just like every
> other type of option.

I must say, being it perhaps slightly inconvenient to the user, that
this is IMO the best option, and just allowing 'true' and 'false'
(case-sensitively). Least chance to work how used did not expected...

> in case it's not clear: I believe that "we have succinct and yet
> complete man pages" is a convenient shorthand for "have we made this
> command-line program behave in an understandable/usable way?"

Sounds/looks like reasonable expectation...

>
>--dkg

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


Re: Inconsistencies in handling command flags: `--flag=value` different than `--flag value`

2020-04-27 Thread Tomi Ollila
On Mon, Apr 27 2020, Daniel Kahn Gillmor wrote:

> On Mon 2020-04-27 14:53:07 -0300, David Bremner wrote:
>> Quoting notmuch(1)
>>
>>OPTION SYNTAX
>>All options accepting an argument can be used with '='
>>or ':' as a separator. For the cases where it's not ambiguous
>>(in particular excluding boolean options), a space can also be
>>used.
>
> This is a pretty twisty way to say what we mean.  Are there other cases
> besides boolean options?  If there are, perhaps it'd be clearer to say
> something like this for the last sentence:
>
> Except for boolean options and other potential ambiguous cases, a
> space can also be used as a separator.
>
> If there aren't, we could say:
>
> Except for boolean options (which would be ambiguous), a space can
> also be used as a separator.
>
> Alternately, we could deprecate using whitespace for all options,
> produce explicit warnings to stderr when whitespace appears on the next

was it so, that originally we did not support whitespace, but David
added that in some commit...

> release, remove the suggestion to use a whitespace separator from the
> documentation, and eventually phase it out entirely in some future
> release.

Alternatively we could check that next arg is (case-insensitively)
(subset of) 'true', 'false', 'yes', 'no', '0', '1', 't', 'nil'
(but not tpyoes of these ;) and in that case have that as an option
value...

... would that work better for human user who just wants to be
fluent on command line -- frontends can then always use = and option
values...

> --dkg

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


Re: [PATCH] util/zlib-extra: de-inline gzerror_str

2020-04-27 Thread Tomi Ollila
On Mon, Apr 27 2020, David Bremner wrote:

> It turns out the behaviour of inline functions in C header files is
> not a good idea, and can cause linking problems if the compiler
> decides not to inline them.  In principle this is solvable by using a
> "static inline" declaration, but this potentially makes a copy in
> every compilation unit. Since we don't actually care about the
> performance of this function, just use a non-inline function.

LGTM.

Tomi

> ---
>  util/zlib-extra.c | 7 +++
>  util/zlib-extra.h | 4 ++--
>  2 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/util/zlib-extra.c b/util/zlib-extra.c
> index 2d2d2414..3a75e504 100644
> --- a/util/zlib-extra.c
> +++ b/util/zlib-extra.c
> @@ -85,3 +85,10 @@ gz_error_string (util_status_t status, gzFile file)
>  else
>   return util_error_string (status);
>  }
> +
> +const char *
> +gzerror_str(gzFile file)
> +{
> +int dummy;
> +return gzerror (file, );
> +}
> diff --git a/util/zlib-extra.h b/util/zlib-extra.h
> index 296dc914..e9925c98 100644
> --- a/util/zlib-extra.h
> +++ b/util/zlib-extra.h
> @@ -29,8 +29,8 @@ gz_error_string (util_status_t status, gzFile stream);
>  
>  /* Call gzerror with a dummy errno argument, the docs don't promise to
>   * support the NULL case */
> -inline const char *
> -gzerror_str(gzFile file) { int dummy; return gzerror (file, ); }
> +const char *
> +gzerror_str(gzFile file);
>  
>  #ifdef __cplusplus
>  }
> -- 
> 2.26.2
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: test_emacs_expect_t does ignore Emacs as prerequisite

2020-04-26 Thread Tomi Ollila
On Fri, Apr 24 2020, David Bremner wrote:

> Milton Vandersloot  writes:
>>
>> [PATCH] Let test_emacs_expect_t respect missing external prerequisites
>>
>> test_emacs_expect_t did not test for missing prerequisites (even though
>> it called test_emacs which does it). Fix that by testing for missing
>> prerequisites.
>>
>
> I agree there's a bug here, but I'm not sure this is the best/cleanest
> fix. Maybe Tomi (in Cc) can comment. The logic for prerequisite checking
> is already opaque. For example test_skip is already calling
> test_check_missing_external_prereqs_ as a side effect. For starters I
> wonder if test_emacs should use a return value to indicate failure,
> along the lines of the patch at the end of the message.

I'd like David's approach, but in that case we don't get the 
"missing prerequisities" messages. Milton's solution looks like
something that works =D. 

Just that the content inside {} needs to be indented, and opening
brace ({) should be after || in same line...

In case of test_skip it doesn't know about missing emacs prerequisities
as the "subtest prerequisities" infomation is cleaned before every
test and the information is regained in test_emacs...

Tomi

> BTW, it will make our life easier if you follow
> https://notmuchmail.org/contributing/#index5h2; in particular using
> git-send-email and keeping the discussion/notes after ---.
>
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] test/test-lib.sh: fix two out of tree test issues

2020-04-23 Thread Tomi Ollila
json_check_nodes.py exists in source tree, not in out of tree
build tree. Added -B to the execution so source tree is not
"polluted" by a .pyc file when json_check_nodes.py is executed.

When creating run_emacs.sh make it load .elc files from out of
tree build tree, not from source tree if such files existed.
If existed, those may be outdated, or even created by some other
emacs than the one that was used to build .elc files in out of
tree build dir.
---

Noticed latter when did in-tree build on Fedora 31 host, then
out-of-tree build running Ubuntu 18.04 in (podman) container;
Fedora had Emacs 26, and ubuntu emacs 25 -- got bytecode
errors...

 test/test-lib.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 7f8a3a4d..f9b7d866 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -523,7 +523,7 @@ test_json_nodes () {
 
if ! test_skip "$test_subtest_name"
then
-   output=$(PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON 
"$TEST_DIRECTORY"/json_check_nodes.py "$@")
+   output=$(PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -B 
"$NOTMUCH_SRCDIR"/test/json_check_nodes.py "$@")
if [ "$?" = 0 ]
then
test_ok_
@@ -984,7 +984,7 @@ export NOTMUCH_CONFIG=$NOTMUCH_CONFIG
 # --load   Force loading of notmuch.el and test-lib.el
 
 exec ${TEST_EMACS} --quick \
-   --directory "$NOTMUCH_SRCDIR/emacs" --load notmuch.el \
+   --directory "$NOTMUCH_BUILDDIR/emacs" --load notmuch.el \
--directory "$NOTMUCH_SRCDIR/test" --load test-lib.el \
"\$@"
 EOF
-- 
2.25.3

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


[PATCH] configure: disable features that do not work out of tree

2020-04-23 Thread Tomi Ollila
When doing out of tree build,

- sphinx-build cannot collect source files from source code
  directory and generated files from build directory.

- python3-cffi did not work, did not investigate further.

In order to get at least something done out of tree, these
features are disabled when doing out of tree builds. The output
is still useful if these features are not needed, and helps with
e.g. test output comparisons.
---
 configure | 9 +
 1 file changed, 9 insertions(+)

diff --git a/configure b/configure
index 70031d14..8c2c9b72 100755
--- a/configure
+++ b/configure
@@ -70,6 +70,10 @@ if [ "$srcdir" != "." ]; then
 mkdir bindings/ruby
 cp -a "$srcdir"/bindings/ruby/*.[ch] bindings/ruby
 cp -a "$srcdir"/bindings/ruby/extconf.rb bindings/ruby
+
+out_of_tree_build=1
+else
+out_of_tree_build=0
 fi
 
 # Set several defaults (optionally specified by the user in
@@ -1089,6 +1093,11 @@ printf "\n\t%s\n" "${WARN_CFLAGS}"
 
 rm -f minimal minimal.c _libversion.c _libversion _libversion.sh 
_check_session_keys.c _check_session_keys
 
+if [ "$out_of_tree_build" = 1 ]; then
+   printf '\n*** Out of tree build: disabling sphinx docs, python3-cffi ***\n'
+   have_sphinx=0 have_python3_cffi=0
+fi
+
 # construct the Makefile.config
 cat > Makefile.config 

Re: Database path discovery in bindings

2020-04-22 Thread Tomi Ollila
On Sun, Apr 19 2020, Kirill Elagin wrote:

> Hello,
>
> Notmuch contains a bit of logic for “normalising” the database path: it can
> be relative to $HOME and fallsback to $MAILDIR or $HOME/mail. However, this
> logic is implemented in `notmuch_config_open` and is not available through
> bindings. So if a third-party tool wants to discover the database, it will
> either do this incorrectly ([alot]) or will have to roll its own
> implementation ([afew]). Neither option is good.
>
> [alot]: https://github.com/pazz/alot/issues/1396
> [afew]: https://github.com/afewmail/afew/pull/233
>
> Rather than reimplementing it in bindings, I see two possible solutions:
>
> 1. Move the logic to `notmuch_database_open` itself.
> 2. Extract into a separate C function, use it in `notmuch_config_open`, and
> expose through bindings.
>
> What do you think?

There has been thoughts to dump the configuration file, and put the
configuration to the database -- so then the bindings can just open the
database to find the configuration oh wait...

In this case we'd find the database in $NOTMUCH_DATABASE_DIR[ECTORY?] or
in $HOME/mail/.notmuch/... if that env var did not exist.

There are at least 2 issues to solve with this approach:

1: SMOP
2: how to edit the configuration using text editor (preserving comments),
   i.e. export and import functionality
3. review latency (especially w/ large patches...) ;/

>
> Cheers,
> Kirill

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


[PATCH v2] build: drop support for xapian versions less than 1.4

2020-04-21 Thread Tomi Ollila
Xapian 1.4 is over 3 years old now (1.4.0 released 2016-06-24),
and 1.2 has been deprecated in Notmuch version 0.27 (2018-06-13).

Xapian 1.4 supports compaction, field processors and retry locking;
conditionals checking compaction and field processors were removed
but user may want to disable retry locking at configure time so it
is kept.
---

This is v2 of id:2020022955.6795-1-tomi.oll...@iki.fi

Change to v1: restored known_broken indication of that one test which
*is* known broken when tried with xapian 1.4...

doc/man7/notmuch-search-terms.rst was not changed in this commit --
I did not fully understand what was it saying...

 configure| 101 +++
 lib/built-with.c |   4 +-
 lib/database.cc  |  10 
 lib/parse-time-vrp.cc|   2 -
 lib/parse-time-vrp.h |   3 +-
 lib/query-fp.cc  |   3 --
 lib/query-fp.h   |   3 +-
 lib/regexp-fields.cc |   2 -
 lib/regexp-fields.h  |   4 +-
 lib/thread-fp.cc |   3 --
 lib/thread-fp.h  |   3 +-
 test/T020-compact.sh |  12 -
 test/T500-search-date.sh |   3 --
 test/T585-thread-subquery.sh |  12 -
 test/T600-named-queries.sh   |   6 ---
 test/T650-regexp-query.sh|   4 --
 test/T670-duplicate-mid.sh   |   6 +--
 17 files changed, 28 insertions(+), 153 deletions(-)

diff --git a/configure b/configure
index 70031d14..0cfdaa6f 100755
--- a/configure
+++ b/configure
@@ -422,15 +422,22 @@ else
 have_pkg_config=0
 fi
 
-printf "Checking for Xapian development files... "
+
+
+printf "Checking for Xapian development files (>= 1.4.0)... "
 have_xapian=0
-for xapian_config in ${XAPIAN_CONFIG} xapian-config xapian-config-1.3; do
+for xapian_config in ${XAPIAN_CONFIG} xapian-config; do
 if ${xapian_config} --version > /dev/null 2>&1; then
xapian_version=$(${xapian_config} --version | sed -e 's/.* //')
-   printf "Yes (%s).\n" ${xapian_version}
-   have_xapian=1
-   xapian_cxxflags=$(${xapian_config} --cxxflags)
-   xapian_ldflags=$(${xapian_config} --libs)
+   case $xapian_version in
+   1.[4-9]* | 1.[1-9][0-9]* | [2-9]* | [1-9][0-9]*)
+   printf "Yes (%s).\n" ${xapian_version}
+   have_xapian=1
+   xapian_cxxflags=$(${xapian_config} --cxxflags)
+   xapian_ldflags=$(${xapian_config} --libs)
+   ;;
+   *) printf "Xapian $xapian_version not supported... "
+   esac
break
 fi
 done
@@ -439,59 +446,8 @@ if [ ${have_xapian} = "0" ]; then
 errors=$((errors + 1))
 fi
 
-have_xapian_compact=0
-have_xapian_field_processor=0
 if [ ${have_xapian} = "1" ]; then
-printf "Checking for Xapian compaction support... "
-cat>_compact.cc<
-class TestCompactor : public Xapian::Compactor { };
-EOF
-if ${CXX} ${CXXFLAGS_for_sh} ${xapian_cxxflags} -c _compact.cc -o 
_compact.o > /dev/null 2>&1
-then
-   have_xapian_compact=1
-   printf "Yes.\n"
-else
-   printf "No.\n"
-   errors=$((errors + 1))
-fi
-
-rm -f _compact.o _compact.cc
-
-printf "Checking for Xapian FieldProcessor API... "
-cat>_field_processor.cc<
-class TitleFieldProcessor : public Xapian::FieldProcessor { };
-EOF
-if ${CXX} ${CXXFLAGS_for_sh} ${xapian_cxxflags} -c _field_processor.cc -o 
_field_processor.o > /dev/null 2>&1
-then
-   have_xapian_field_processor=1
-   printf "Yes.\n"
-else
-   printf "No. (optional)\n"
-fi
-
-rm -f _field_processor.o _field_processor.cc
-
 default_xapian_backend=""
-# DB_RETRY_LOCK is only supported on Xapian > 1.3.2
-have_xapian_db_retry_lock=0
-if [ $WITH_RETRY_LOCK = "1" ]; then
-   printf "Checking for Xapian lock retry support... "
-   cat>_retry.cc<
-int flag = Xapian::DB_RETRY_LOCK;
-EOF
-   if ${CXX} ${CXXFLAGS_for_sh} ${xapian_cxxflags} -c _retry.cc -o 
_retry.o > /dev/null 2>&1
-   then
-   have_xapian_db_retry_lock=1
-   printf "Yes.\n"
-   else
-   printf "No. (optional)\n"
-   fi
-   rm -f _retry.o _retry.cc
-fi
-
 printf "Testing default Xapian backend... "
 cat >_default_backend.cc <
@@ -879,8 +835,8 @@ EOF
 if [ $have_python -eq 0 ]; then
echo "  python interpreter"
 fi
-if [ $have_xapian -eq 0 -o $have_xapian_compact -eq 0 ]; then
-   echo "  Xapian library (>= version 1.2.6, including development files 
such as headers)"
+if [ $have_xapian -eq 0 ]; then
+   echo "  Xapian library (>= version 1.4.0, including development files 
such as headers)"
echo "  https://xapian.org/;
 fi
 if [ $have_zlib -eq 0 ]; then
@@ -1278,14 +1234,8 @@ HAVE_TIMEGM = ${have_timegm}
 # Whether struct dirent has d_type (if not, then notmuch will use stat)
 HAVE_D_TYPE = ${have_d_type}
 
-# Whether the Xapian version in use supports compaction

Re: [PATCH] test: sort the output of the "prefix" test in T610-message-property

2020-04-20 Thread Tomi Ollila
On Sun, Apr 19 2020, Olivier Taïbi wrote:

> This test extracts values from a (key,value) map where multiple entries
> can have the same key, and the entries are sorted by key, but not by
> value.  The test incorrectly assumes that the values will be sorted as
> well, so sort the output.

This sure looks good to me.

Tomi

> ---
>  test/T610-message-property.sh | 12 
>  1 file changed, 12 insertions(+)
>
> diff --git a/test/T610-message-property.sh b/test/T610-message-property.sh
> index 53a0be3b..b8774230 100755
> --- a/test/T610-message-property.sh
> +++ b/test/T610-message-property.sh
> @@ -186,6 +186,18 @@ EXPECT0(notmuch_message_add_property (message, 
> "testkey3", "testvalue3"));
>  EXPECT0(notmuch_message_add_property (message, "testkey3", "alice3"));
>  print_properties (message, "testkey", FALSE);
>  EOF
> +# expected: 4 values for testkey1, 3 values for testkey3
> +# they are not guaranteed to be sorted, so sort them, leaving the first
> +# line '== stdout ==' and the end ('== stderr ==' and whatever error
> +# may have been printed) alone
> +mv OUTPUT unsorted_OUTPUT
> +awk ' NR == 1 { print; next } \
> +  NR < 6  { print | "sort"; next } \
> +  NR == 6 { close("sort") } \
> +  NR < 9  { print | "sort"; next } \
> +  NR == 9 { close("sort") } \
> +  { print }' unsorted_OUTPUT > OUTPUT
> +rm unsorted_OUTPUT
>  cat <<'EOF' >EXPECTED
>  == stdout ==
>  alice
> -- 
> 2.26.1
> ---
> a better version of the previous patch I sent with head/tail replaced by an 
> awk
> script by Tomi Ollila which is clearer, and comments added in the test for
> clarity.
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: sort the output of the "prefix" test in T610-message-property as needed

2020-04-18 Thread Tomi Ollila
On Fri, Apr 17 2020, Olivier Taïbi wrote:

> the "prefix" test in T610-message-property extracts values from a
> (key,value) map where multiple entries can have the same key, and the
> entries are sorted by key, but not by value.  The test incorrectly
> assumes that the values will be sorted as well, so correct this by
> splitting the output using head and tail and sorting each chunk using
> sort.
> NB: the relevant key/values are as follows.
> testkey1: alice, testvalue1, testvalue2, bob
> testkey3: alice3, bob3, testvalue3
> ---
>  test/T610-message-property.sh | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/test/T610-message-property.sh b/test/T610-message-property.sh
> index 53a0be3b..e1be2fc3 100755
> --- a/test/T610-message-property.sh
> +++ b/test/T610-message-property.sh
> @@ -186,6 +186,11 @@ EXPECT0(notmuch_message_add_property (message, 
> "testkey3", "testvalue3"));
>  EXPECT0(notmuch_message_add_property (message, "testkey3", "alice3"));
>  print_properties (message, "testkey", FALSE);
>  EOF

Whichever way done, this should be commented here, not (just) in git
history, that information is not readily available (one has to know
git blame and then go to see to the commit message :)

> +mv OUTPUT unsorted_OUTPUT
> +head -n 5 unsorted_OUTPUT | sort >OUTPUT

Relying that '== stdout ==' sorts first is kinda ugly, as it does not
be part of the sorting range, 

> +tail -n +6 unsorted_OUTPUT | head -n 3 | sort >>OUTPUT

if there were more content in file i would have suggested `sed -n 6,9p`

> +tail -n +9 unsorted_OUTPUT >>OUTPUT
> +rm unsorted_OUTPUT

due to the '== stdout ==' I'd suggest:

awk ' NR == 1 { print; next }
  NR < 6  { print | "sort"; next }
  NR == 6 { close("sort") }
  NR < 9  { print | "sort"; next }
  NR == 9 { close("sort") }
  { print }' unsorted_OUTPUT > OUTPUT

(works w/ gawk and mawk), with some explanation why.

(perhaps how the sorting is done does not need to be explained in commit
message =D

>  cat <<'EOF' >EXPECTED
>  == stdout ==
>  alice
> -- 
> 2.26.0
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: timezone in notmuch

2020-04-15 Thread Tomi Ollila
On Tue, Apr 14 2020, di...@santanas.co.za wrote:

> Greetings :)
>
> In notmuch-show-mode, some emails have a date like this: Date: Thu, 09
> Apr 2020 14:34:42 + while others like this Date: Sun, 12 Apr 2020
> 21:04:01 +0200
>
> Is this something I can change in notmuch to always show the date/time
> in my local timezone (SAST/+0200)?

I use this:

https://github.com/domo141/nottoomuch/blob/master/build/01-date-local.patch

I've been thinking if some hook could be added to notmuch-emacs so
that such a custom date mangling can be done outside of the notmuch-emacs
source...

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


Re: [PATCH] emacs doc: replace `...' with `...` in emacs docstrings for rst

2020-04-13 Thread Tomi Ollila
On Mon, Apr 13 2020, Tomi Ollila wrote:

> Previously ' without preceding \ was replaced with `, to make emacs
> document content structure `...' to work with reStructuredText.

The change is good, but comment message crap. 

While trying to make rstdoc.el to load elisp code so that in docstrings
single quotes (') were not changed to their better-looking unicode
counterparts I notices that in `...' the ' in that is not converted
(since it is syntax-highlighted internally by emacs). 

Since that the original version where 's not preceded by \ are converted.
(as rest are already changed) -- ¡¡¡unless the locale is C!!!.

So we really are better just converting `...' to `...` (If we had `:s
w/o ...' then those should be escaped -- but (so far) we don't -- 
doing those is not trivial, but possible).

I'll resend this w/ different commit message later.

(but please review and comment if there is anything wrong before that =)

Tomi

>
> But there are also single uses of ' in parts of the extracted
> docstrings, so better "restrict" the matching content to `[^']+'.
>
> Dropped checking preceding \ before ' -- it is not needed anymore;
> there is now one \' in the docstrings, but outside `...'.
>
> Note: In UTF-8 locales ` and ' may be replaced by some (arguably)
> better looking unicode counterparts (by emacs).
> ---
>
> This also "avoids" the bug building emacs/notmuch-parser.rsti in
> Debian 10. The doc content with "... SP's ..." no longer matches
> the re which caused emacs to barf then in (replace-match) (*)
> there. The bug is still a mystery (and may stay so).
>
> (* used (setq debug-on-error t) to dig a bit of the problem)
>
>  emacs/rstdoc.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/emacs/rstdoc.el b/emacs/rstdoc.el
> index 2225aefc..94596061 100644
> --- a/emacs/rstdoc.el
> +++ b/emacs/rstdoc.el
> @@ -68,7 +68,7 @@ (defun rstdoc--insert-docstring (symbol docstring)
>  
>  (defvar rst--escape-alist
>'( ("='" . "'")
> - ("\\([^\\]\\)'" . "\\1`")
> + ("`\\([^']+\\)'" . "`\\1`")
>   ("^[[:space:]\t]*$" . "|br|")
>   ("^[[:space:]\t]" . "|indent| "))
>  "list of (regex . replacement) pairs")
> -- 
> 2.25.2
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] zlib-related bugs

2020-04-13 Thread Tomi Ollila
On Fri, Apr 10 2020, Olivier Taïbi wrote:

> the following diff addresses 3 zlib-related bugs in notmuch.

> 3) in gz_getline(), if gz_error sets its second argument to Z_STREAM_END
>then there was no error (only EOF).  Unfortunately the zlib manual is
>not very clear on the meaning of Z_STREAM_END, but I don't see how it
>could be an error.  I found this issue by using notmuch on OpenBSD,
>which has an old zlib.  I encountered other issues with notmuch on
>OpenBSD (e.g. there is no transparency mode in this older zlib, so
>notmuch dump output is always gzipped), but they do not seem to be
>bugs in notmuch.

Interesting. What versions of gmime and xapian are you using with
notmuch on OpenBSD? IIRC(*) xapian 1.4 also wants zlib (but I am not
sure how new one).

Tomi

(*) I am building notmuch for centos 6 using this script:
  
https://github.com/domo141/nottoomuch/blob/master/build/podman-notmuch-build-on-centos6.sh
  and I've configured xapian to use self-built zlib -- perhans not since
  xapian required, but that the same is used what notmuch(1) uses.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 4/6] cli/dump: define GZPRINTF macro and use it in place of gzprintf

2020-04-13 Thread Tomi Ollila
On Mon, Apr 13 2020, David Bremner wrote:

> This will at least catch errors, and can be replaced with more
> sophisticated error handling where appropriate.
> ---
>  notmuch-client.h |  4 
>  notmuch-dump.c   | 24 
>  2 files changed, 16 insertions(+), 12 deletions(-)
>
> diff --git a/notmuch-client.h b/notmuch-client.h
> index 467e1d84..01f5101a 100644
> --- a/notmuch-client.h
> +++ b/notmuch-client.h
> @@ -497,6 +497,10 @@ print_status_gzbytes (const char *loc,
> gzFile file,
> int bytes);
>  
> +/* the __location__ macro is defined in talloc.h */
> +#define ASSERT_GZBYTES(file, bytes) ((print_status_gzbytes (__location__, 
> file, bytes)) ?  exit (1) : 0)

The 2 spaces before exit (1) I tried to communicate ;) well, perhaps the
__location__ thing broke the flow...

can be amended if no other comments to be seen

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


[PATCH] emacs doc: replace `...' with `...` in emacs docstrings for rst

2020-04-13 Thread Tomi Ollila
Previously ' without preceding \ was replaced with `, to make emacs
document content structure `...' to work with reStructuredText.

But there are also single uses of ' in parts of the extracted
docstrings, so better "restrict" the matching content to `[^']+'.

Dropped checking preceding \ before ' -- it is not needed anymore;
there is now one \' in the docstrings, but outside `...'.

Note: In UTF-8 locales ` and ' may be replaced by some (arguably)
better looking unicode counterparts (by emacs).
---

This also "avoids" the bug building emacs/notmuch-parser.rsti in
Debian 10. The doc content with "... SP's ..." no longer matches
the re which caused emacs to barf then in (replace-match) (*)
there. The bug is still a mystery (and may stay so).

(* used (setq debug-on-error t) to dig a bit of the problem)

 emacs/rstdoc.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/emacs/rstdoc.el b/emacs/rstdoc.el
index 2225aefc..94596061 100644
--- a/emacs/rstdoc.el
+++ b/emacs/rstdoc.el
@@ -68,7 +68,7 @@ (defun rstdoc--insert-docstring (symbol docstring)
 
 (defvar rst--escape-alist
   '( ("='" . "'")
- ("\\([^\\]\\)'" . "\\1`")
+ ("`\\([^']+\\)'" . "`\\1`")
  ("^[[:space:]\t]*$" . "|br|")
  ("^[[:space:]\t]" . "|indent| "))
 "list of (regex . replacement) pairs")
-- 
2.25.2

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


Re: [PATCH 3/5] cli/dump: define GZPRINTF macro and use it in place of gzprintf

2020-04-13 Thread Tomi Ollila
On Sun, Apr 12 2020, David Bremner wrote:

> This will at least catch errors, and can be replaced with more
> sophisticated error handling where appropriate.
> ---
>  notmuch-client.h |  3 +++
>  notmuch-dump.c   | 24 
>  2 files changed, 15 insertions(+), 12 deletions(-)
>
> diff --git a/notmuch-client.h b/notmuch-client.h
> index 467e1d84..55d4d526 100644
> --- a/notmuch-client.h
> +++ b/notmuch-client.h
> @@ -497,6 +497,9 @@ print_status_gzbytes (const char *loc,
> gzFile file,
> int bytes);
>  
> +#define ASSERT_GZBYTES(file, bytes) ( (print_status_gzbytes(__location__, 
> file, bytes)) ?  exit(1) : 0 )

__location__ ?? never seen such a (preprocessor?) definition. could not
find any reference by search...

there are also some suspiciously looking like inconsistent spaces in that
macro above

rest of the series (before and after) look good 

Tomi

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


Re: [PATCH] test: add known_broken test for dumping large stored queries

2020-04-13 Thread Tomi Ollila
On Sun, Apr 12 2020, David Bremner wrote:

> 'qsx' reported a bug on #notmuch with notmuch-dump and large stored
> queries. This test will pass (on my machine) if the value of `repeat'
> is made smaller.
> ---
>  test/T240-dump-restore.sh | 13 +
>  1 file changed, 13 insertions(+)
>
> diff --git a/test/T240-dump-restore.sh b/test/T240-dump-restore.sh
> index 0870ff92..374db5c2 100755
> --- a/test/T240-dump-restore.sh
> +++ b/test/T240-dump-restore.sh
> @@ -322,6 +322,19 @@ EOF
>  
>  test_expect_equal_file EXPECTED OUTPUT
>  
> +test_begin_subtest 'dumping large queries'
> +test_subtest_known_broken
> +# This value repeat was found experimentally by binary search. The
> +# config value after URL encoding is exactly 4096 bytes, which
> +# suggests a buffer size bug.
> +repeat=1329
> +notmuch config set query.big "$(seq -s' ' $repeat)"
> +notmuch dump --include=config > OUTPUT
> +notmuch config set query.big ''
> +printf "#notmuch-dump batch-tag:3 config\n#@ query.big " > EXPECTED

> +seq -s'%20'  $repeat >> EXPECTED

Extra space, otherwise tolerable =D

Tomi

> +test_expect_equal_file EXPECTED OUTPUT
> +
>  test_begin_subtest 'roundtripping random message-ids and tags'
>  
>  ${TEST_DIRECTORY}/random-corpus --config-path=${NOTMUCH_CONFIG} \
> -- 
> 2.25.1
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: notmuch-mode: Emails with PDF attachments incorrectly tagged as text/plain expose a few issues

2020-04-06 Thread Tomi Ollila
On Mon, Apr 06 2020, David Bremner wrote:

> Leo Gaspard  writes:
>
>> David Bremner  writes:
>>
>>> Leo Gaspard  writes:
>>>
 Hello,

 I have recently started conversing with someone whose email client
 incorrectly tags PDF attachments as text/plain.

>>>
>>> Hi Leo;
>>>
>>> As I mentioned on IRC, we most likely need a reproducer message before
>>> making any progress on this. Maybe you can ask your correspondent to
>>> send you a shareable message, then sanitize the addesses in the headers.
>>
>> So, I've just been able to re-create at least the “freeze on reply” isue
>> with the email attached. The image doesn't get corrupted when saving,
>> though, so I'm not sure it'll be enough to fix both issues, but
>> hopefully fixing this one would fix the other one too.
>>
>> If you try to notmuch-show on the attached email, then hit `r`, you
>> should notice the image being included verbatim in the text/plain
>> output, and when hitting C-c C-c it should start freezing emacs.
>>
>> Hope that helps!
>>   Leo
>
> Probably the rest of the list hasn't seen the message yet, but I did try
> it out. ...

Rest of the list hasn't seen the message (yet?) as the body is 440805 bytes
in size (and there is limit in the mailing list) and it is hanging in 
moderator queue. I am not too enthusiastic to bloat the mailing list
archive with just a large test message (but am not against is there more
people who do think that it is a good idea).

Tomi

> ... It doesn't actually hang emacs for me (C-g enough times gets me
> back). I agree that inserting binary data into the buffer is probably
> not a great idea.  I'm not sure offhand how notmuch should detect
> mislabeled parts. Perhaps it should just refuse to insert large parts as
> reply text.
>
> d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2] mime-node: Clean up unwrapped MIME parts correctly.

2020-03-20 Thread Tomi Ollila
On Thu, Mar 19 2020, Daniel Kahn Gillmor wrote:

> Avoid a memory leak in the notmuch command line.
>
> gmime_multipart_encrypted_decrypt returns a GMimeObject marked by
> GMime as "transfer full", so we are supposed to clean up after it.
>
> When parsing a message, notmuch would leak one GMimeObject part per
> multipart/encrypted MIME layer.  We clean it up by analogy with
> cleaning up the signature list associated with a MIME node.
>
> Signed-off-by: Daniel Kahn Gillmor 

Looks good to me.

Tomi

> ---
>  mime-node.c | 22 ++
>  1 file changed, 22 insertions(+)
>
> diff --git a/mime-node.c b/mime-node.c
> index 2a823dfd..ff6805bf 100644
> --- a/mime-node.c
> +++ b/mime-node.c
> @@ -192,6 +192,26 @@ set_signature_list_destructor (mime_node_t *node)
>  }
>  }
>  
> +/* Unwrapped MIME part destructor */
> +static int
> +_unwrapped_child_free (GMimeObject **proxy)
> +{
> +g_object_unref (*proxy);
> +return 0;
> +}
> +
> +/* Set up unwrapped MIME part destructor */
> +static void
> +set_unwrapped_child_destructor (mime_node_t *node)
> +{
> +GMimeObject **proxy = talloc (node, GMimeObject *);
> +
> +if (proxy) {
> + *proxy = node->unwrapped_child;
> + talloc_set_destructor (proxy, _unwrapped_child_free);
> +}
> +}
> +
>  /* Verify a signed mime node */
>  static void
>  node_verify (mime_node_t *node, GMimeObject *part)
> @@ -238,6 +258,8 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject 
> *part)
>
> node->ctx->crypto->decrypt,
>message,
>encrypteddata, 
> _result, );
> + if (node->unwrapped_child)
> + set_unwrapped_child_destructor (node);
>  }
>  if (! node->unwrapped_child) {
>   fprintf (stderr, "Failed to decrypt part: %s\n",
> -- 
> 2.25.1
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] mime-node: Pass the correct flags to g_mime_multipart_signed_verify

2020-03-18 Thread Tomi Ollila
On Wed, Mar 18 2020, Daniel Kahn Gillmor wrote:

> GMIME_ENCRYPT_NONE and GMIME_VERIFY_NONE have the same value, but they
> are different enumerated types.  So in C, this is a cosmetic change,
> but it is technically correct if we only had stricter typing.

Change consistent with '@@ node_verify', LGTM.

Tomi

>
> Signed-off-by: Daniel Kahn Gillmor 
> ---
>  mime-node.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mime-node.c b/mime-node.c
> index d4996a33..e531078c 100644
> --- a/mime-node.c
> +++ b/mime-node.c
> @@ -201,7 +201,7 @@ node_verify (mime_node_t *node, GMimeObject *part)
>  
>  node->verify_attempted = true;
>  node->sig_list = g_mime_multipart_signed_verify (
> - GMIME_MULTIPART_SIGNED (part), GMIME_ENCRYPT_NONE, );
> + GMIME_MULTIPART_SIGNED (part), GMIME_VERIFY_NONE, );
>  
>  if (node->sig_list)
>   set_signature_list_destructor (node);
> -- 
> 2.25.1
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


  1   2   3   4   5   6   7   8   9   10   >