From c843c6a9a41aeb671b3c18419f86e86aa5657549 Mon Sep 17 00:00:00 2001 From: Ketil Malde Date: Mon, 14 Sep 2015 14:18:14 +0200 Subject: [PATCH] bug: notmuch-poll doesn't check return value --- ff/0197d9c02e9fa6e50eb8561a227430b3897be4 | 99 +++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 ff/0197d9c02e9fa6e50eb8561a227430b3897be4 diff --git a/ff/0197d9c02e9fa6e50eb8561a227430b3897be4 b/ff/0197d9c02e9fa6e50eb8561a227430b3897be4 new file mode 100644 index 000000000..4e0e703d8 --- /dev/null +++ b/ff/0197d9c02e9fa6e50eb8561a227430b3897be4 @@ -0,0 +1,99 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id D2B1E6DE0B25 + for ; Mon, 14 Sep 2015 05:25:52 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.001 +X-Spam-Level: +X-Spam-Status: No, score=-0.001 tagged_above=-999 required=5 + tests=[SPF_HELO_PASS=-0.001] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 1EhOafEO-ZQd for ; + Mon, 14 Sep 2015 05:25:50 -0700 (PDT) +X-Greylist: delayed 451 seconds by postgrey-1.35 at arlo; + Mon, 14 Sep 2015 05:25:50 PDT +Received: from engen.priv.no (engen.priv.no [64.22.125.231]) + by arlo.cworth.org (Postfix) with ESMTP id B85AF6DE0A4A + for ; Mon, 14 Sep 2015 05:25:50 -0700 (PDT) +Received: from localhost (localhost [127.0.0.1]) + by engen.priv.no (Postfix) with ESMTP id 50A3B13292 + for ; Mon, 14 Sep 2015 14:18:16 +0200 (CEST) +X-Virus-Scanned: Debian amavisd-new at engen.priv.no +Received: from engen.priv.no ([127.0.0.1]) + by localhost (vegard.engen.priv.no [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id O5wmUXj9iriC for ; + Mon, 14 Sep 2015 14:18:16 +0200 (CEST) +Received: from wespe.malde.org (localhost [127.0.0.1]) + by engen.priv.no (Postfix) with ESMTPSA id B03A613290 + for ; Mon, 14 Sep 2015 14:18:15 +0200 (CEST) +From: Ketil Malde +To: notmuch@notmuchmail.org +Subject: bug: notmuch-poll doesn't check return value +User-Agent: Notmuch/0.20.1 (http://notmuchmail.org) Emacs/24.5.1 + (x86_64-pc-linux-gnu) +Date: Mon, 14 Sep 2015 14:18:14 +0200 +Message-ID: <87bnd5qjnd.fsf@wespe.malde.org> +MIME-Version: 1.0 +Content-Type: text/plain +X-Mailman-Approved-At: Mon, 14 Sep 2015 09:02:42 -0700 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.18 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 14 Sep 2015 12:25:52 -0000 + + +Hi, + +I've been stumped occasionally when new mail fails to appear in notmuch, +and then I suddenly discover it by some other means (web front end, +mobile, etc). + +The problem is that notmuch-poll fails silently when it fails, which is +usually due to broken symlinks in my mail directories, or some IMAP +configuration mistake. Easy to fix when you know about it. + +I've, uh, "fixed" this by redefining notmuch-poll like so: + +---8<------------------------------------- +;;; Make notmuch-poll fail gracelessly when something goes wrong +;;; Better than failing silently, in ancy case. +(defun notmuch-poll () + "Run \"notmuch new\" or an external script to import mail. + +Invokes `notmuch-poll-script', \"notmuch new\", or does nothing +depending on the value of `notmuch-poll-script'." + (interactive) + (if (not (equal 0 + (if (stringp notmuch-poll-script) + (unless (string= notmuch-poll-script "") + (call-process notmuch-poll-script nil nil)) + (call-process notmuch-command nil nil nil "new")))) + (error "Notmuch: poll failed!"))) +---8<------------------------------------- + +Surely, somebody who knows lisp can do something far more elegant than +this, but the point is to bug out when something doesn't work. + +In addtion, I had to fix my notmuch-poll-script, which contains +'offlineimap', then 'notmuch new', followed by some tagging commands. +As the tagging commands tend to work even if 'new' doesn't, this will +often (pretend to) exit successfully. A 'set -e' at the top of the +script is probably a good idea, and should probably be mentioned in +documentation somewhere. + +-k +-- +If I haven't seen further, it is by standing in the footprints of giants -- 2.26.2