[PATCH] notmuch-config: ENOENT vs generic handling when file open fails.
When opening configuration file fails, ENOENT (file not found) is handled specially -- in setup missing file is ok (often expected), and otherwise user can be informed to run notmuch setup. In any other case the the reason is unknown, so there is no other option but to print generic error message to stderr. --- notmuch-config.c | 29 ++--- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/notmuch-config.c b/notmuch-config.c index cdb4088d1535..baead520096b 100644 --- a/notmuch-config.c +++ b/notmuch-config.c @@ -215,24 +215,23 @@ get_config_from_file (notmuch_config_t *config, notmuch_bool_t create_new) FILE *fp = fopen(config->filename, "r"); if (fp == NULL) { - /* If create_new is true, then the caller is prepared for a -* default configuration file in the case of FILE NOT FOUND. -*/ - if (create_new) { - config->is_new = TRUE; - ret = TRUE; - goto out; - } else if (errno == ENOENT) { - fprintf (stderr, "Configuration file %s not found.\n" -"Try running 'notmuch setup' to create a configuration.\n", -config->filename); - goto out; + if (errno == ENOENT) { + /* If create_new is true, then the caller is prepared for a +* default configuration file in the case of FILE NOT FOUND. +*/ + if (create_new) { + config->is_new = TRUE; + ret = TRUE; + } else { + fprintf (stderr, "Configuration file %s not found.\n" +"Try running 'notmuch setup' to create a configuration.\n", +config->filename); + } } else { - fprintf (stderr, "Error opening config file '%s': %s\n" -"Try running 'notmuch setup' to create a configuration.\n", + fprintf (stderr, "Error opening config file '%s': %s\n", config->filename, strerror(errno)); - goto out; } + goto out; } config_str = talloc_zero_array (config, char, config_bufsize); -- 2.8.2 ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] test: wrap 'wc -l' results in arithmetic evaluation to strip whitespace
Some new unwrapped 'wc -l's have been added since Jani's 60e79e3a9f1c8 --- test/T070-insert.sh| 2 +- test/T580-thread-search.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/T070-insert.sh b/test/T070-insert.sh index 57472b913964..7fb3b87e4584 100755 --- a/test/T070-insert.sh +++ b/test/T070-insert.sh @@ -60,7 +60,7 @@ test_expect_equal_json "$output" "$expected" test_begin_subtest "Insert duplicate message" notmuch insert +duptag -unread < "$gen_msg_filename" -output=$(notmuch search --output=files "subject:insert-subject" | wc -l) +output=$((`notmuch search --output=files "subject:insert-subject" | wc -l`)) test_expect_equal "$output" 2 test_begin_subtest "Duplicate message does not change tags" diff --git a/test/T580-thread-search.sh b/test/T580-thread-search.sh index 6f7106db475a..512559a3aff9 100755 --- a/test/T580-thread-search.sh +++ b/test/T580-thread-search.sh @@ -15,7 +15,7 @@ count=0 success=0 for id in $(notmuch search --output=messages '*'); do count=$((count +1)) -matches=$(notmuch search --output=threads "$id" | wc -l) +matches=$((`notmuch search --output=threads "$id" | wc -l`)) if [ "$matches" = 1 ]; then success=$((success + 1)) fi -- 2.8.2 ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] [EMACS] Adjust notmuch-crypto gpg call-process function
On Thu, Jan 05 2017, John Byrneswrote: >> I think this is reasonable. We're already setting epg-gpg-program in >> test/test-lib.sh, and in debian, epg-gpg-program is provided by >> epg-config.el, which is part of emacs$VERSION-el, which is a dependency >> of emacs$VERSION-common. > > I believe that epg is part of the standard emacs packages now. It > should be available wherever Emacs is. I found that epg-gpg-program -- thanks -- the problem was that i typoed this epg (i think egp or something -- it's so hard... ;) >> If we wanted to be extra careful, we could try to make it fall back to >> plain "gpg" if epg-gpg-program is unset. Just tested -- GNU Emacs 23.1.1 has /usr/share/emacs/23.1/lisp/epg-config.elc and that defines epg-gpg-program (so definitely all (yet supported and) non-deprecated emacs versions have it. Tomi ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] [EMACS] Adjust notmuch-crypto gpg call-process function
Hi Tomi, > Well, I don't know how to add epg-gpg-program to this fedora 25 > installation... epg-gpg-program is an elisp variable which points to the actual GnuPG binary on your system. You can customize this by setting it in your init.el or in the Emacs customization mode. Best regards, John signature.asc Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] [EMACS] Adjust notmuch-crypto gpg call-process function
> I think this is reasonable. We're already setting epg-gpg-program in > test/test-lib.sh, and in debian, epg-gpg-program is provided by > epg-config.el, which is part of emacs$VERSION-el, which is a dependency > of emacs$VERSION-common. I believe that epg is part of the standard emacs packages now. It should be available wherever Emacs is. > If we wanted to be extra careful, we could try to make it fall back to > plain "gpg" if epg-gpg-program is unset. This isn't a bad idea. My elisp-fu is limited, but I think that I can probably figure out how to do this. It looks like epg-gpg-program is set with this in epg-config.el. https://github.com/emacs-mirror/emacs/blob/65eee8392ff95f58f7b0bd036e1fe065523658c6/lisp/epg-config.el (defcustom epg-gpg-program (if (executable-find "gpg2") "gpg2" "gpg") "The `gpg' executable. Setting this variable directly does not take effect; instead use \\[customize] (see the info node `Easy Customization')." :version "25.1" :group 'epg :type 'string) > fwiw, debian will be shipping gpg2 as /usr/bin/gpg in stretch, and the > old 1.4 branch will be /usr/bin/gpg1 -- is there a reason that NixOS > isn't shipping gpg2 as /usr/bin/gpg ? I actually have no idea. I'm usually a Debian user, but liked the idea of having a reproducible setup which was easy to move between machines. Nix works pretty well, but there are a lot of rough edges -- like not having gpg linked to gpg2. Best regards, John signature.asc Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] test: replaced use of python with $NOTMUCH_PYTHON (twice)
$NOTMUCH_PYTHON is sourced from sh.config, configured by ./configure and stated to be used as: "Name of python command to use in configure and the test suite." --- test/T260-thread-order.sh | 2 +- test/test-lib.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/T260-thread-order.sh b/test/T260-thread-order.sh index f720c99817a1..89f4d1be4816 100755 --- a/test/T260-thread-order.sh +++ b/test/T260-thread-order.sh @@ -4,7 +4,7 @@ test_description="threading when messages received out of order" # Generate all single-root four message thread structures. We'll use # this for multiple tests below. -THREADS=$(python ${TEST_DIRECTORY}/gen-threads.py 4) +THREADS=$($NOTMUCH_PYTHON ${TEST_DIRECTORY}/gen-threads.py 4) nthreads=$(wc -l <<< "$THREADS") test_begin_subtest "Messages with one parent get linked in all delivery orders" diff --git a/test/test-lib.sh b/test/test-lib.sh index f55d2c67aac1..6c7beae07352 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -657,7 +657,7 @@ test_expect_equal_json () { # Sort the top-level list of JSON data from stdin. test_sort_json () { -PYTHONIOENCODING=utf-8 python -c \ +PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -c \ "import sys, json; json.dump(sorted(json.load(sys.stdin)),sys.stdout)" } -- 2.8.2 ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
archives and pictures display by default
Hello Notmuchers When I get zip files as attachment with pictures, they all expand for viewing. Can I turn this off? Best regards -- Tomas Nordin | (The computing freedom explorer) GPG Key: AB09AF78 ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] [EMACS] Adjust notmuch-crypto gpg call-process function
On Wed, Jan 04 2017, Daniel Kahn Gillmorwrote: > On Tue 2017-01-03 21:55:48 -0500, John Byrnes wrote: >> I'm running the latest NixOS and noticed that the system does not >> install gpgv1 by default. This means that the only gpg binary available >> is the gpg2 binary. >> >> I found that notmuch-crypto.el hardcodes the GnuPG binary as gpg. I >> thought it might make more sense to rely on the setting provided by >> EasyPG to locate the correct GnuPG binary. >> >> The patch is quite simple - it just replaces "gpg" with the >> epg-gpg-program variable in each place it's used. >> >> -(call-process "gpg" nil t t "--list-keys" fingerprint)) >> +(call-process epg-gpg-program nil t t "--list-keys" fingerprint)) > > I think this is reasonable. We're already setting epg-gpg-program in > test/test-lib.sh, and in debian, epg-gpg-program is provided by > epg-config.el, which is part of emacs$VERSION-el, which is a dependency > of emacs$VERSION-common. > > If we wanted to be extra careful, we could try to make it fall back to > plain "gpg" if epg-gpg-program is unset. Well, I don't know how to add epg-gpg-program to this fedora 25 installation... > > fwiw, debian will be shipping gpg2 as /usr/bin/gpg in stretch, and the > old 1.4 branch will be /usr/bin/gpg1 -- is there a reason that NixOS > isn't shipping gpg2 as /usr/bin/gpg ? On Fedora 25: zsh$ rpm -q -f =gpg gnupg-1.4.21-1.fc25.x86_64 zsh$ rpm -q -f =gpg2 gnupg2-2.1.13-2.fc25.x86_64 zsh$ echo =gpg =gpg2 /usr/bin/gpg /usr/bin/gpg2 Tomi > --dkg ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] [EMACS] Adjust notmuch-crypto gpg call-process function
On Tue 2017-01-03 21:55:48 -0500, John Byrnes wrote: > I'm running the latest NixOS and noticed that the system does not > install gpgv1 by default. This means that the only gpg binary available > is the gpg2 binary. > > I found that notmuch-crypto.el hardcodes the GnuPG binary as gpg. I > thought it might make more sense to rely on the setting provided by > EasyPG to locate the correct GnuPG binary. > > The patch is quite simple - it just replaces "gpg" with the > epg-gpg-program variable in each place it's used. > > - (call-process "gpg" nil t t "--list-keys" fingerprint)) > + (call-process epg-gpg-program nil t t "--list-keys" fingerprint)) I think this is reasonable. We're already setting epg-gpg-program in test/test-lib.sh, and in debian, epg-gpg-program is provided by epg-config.el, which is part of emacs$VERSION-el, which is a dependency of emacs$VERSION-common. If we wanted to be extra careful, we could try to make it fall back to plain "gpg" if epg-gpg-program is unset. fwiw, debian will be shipping gpg2 as /usr/bin/gpg in stretch, and the old 1.4 branch will be /usr/bin/gpg1 -- is there a reason that NixOS isn't shipping gpg2 as /usr/bin/gpg ? --dkg signature.asc Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: some issues with emacs 25
On 03/12/16 01:58, David Bremner wrote: > Matthew Learwrites: > >> >> I'd happily post some debug info to help analyse this if somebody could >> give me a few pointers about what would be needed and the emacs-fu >> needed to generate this. >> > > I think the best thing at this point would be to find (or create) > another public message where you can duplicate the problem. I've sent two test emails directly to David for analysis. -- Matt ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] test: atomicity.py: improve exit probability on failure
Some gdb python exceptions on some os environments (e.g. macOS Sierra, non-codesigned gdb) do not make gdb exit (but to drop down to nonexistent command line?). Mitigate this chance by explict SystemExit on all exceptions. The contents of output file 'gdb.out' is unchanged. --- test/atomicity.py | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/atomicity.py b/test/atomicity.py index 1ca52b9c4f73..389517e1571e 100644 --- a/test/atomicity.py +++ b/test/atomicity.py @@ -71,4 +71,8 @@ class RenameBreakpoint(gdb.Breakpoint): return False RenameBreakpoint('rename') -gdb.execute('run') +try: +gdb.execute('run') +except Exception: +import traceback +raise SystemExit(traceback.format_exc()) -- 2.8.2 ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch