Re: notmuch and "mute" -- useful to anyone?
[notmuch-archives.git] / 14 / 77aa15b79bb0dae14bb19b3b72e6d27c5afef7
1 Return-Path: <jani@nikula.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id E8FC2431FD0\r
6         for <notmuch@notmuchmail.org>; Fri,  9 Dec 2011 05:55:24 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id YPpWRb7qgPYA for <notmuch@notmuchmail.org>;\r
16         Fri,  9 Dec 2011 05:55:24 -0800 (PST)\r
17 Received: from mail-qy0-f181.google.com (mail-qy0-f181.google.com\r
18         [209.85.216.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 7A879431FB6\r
21         for <notmuch@notmuchmail.org>; Fri,  9 Dec 2011 05:55:24 -0800 (PST)\r
22 Received: by qcsf13 with SMTP id f13so2475411qcs.26\r
23         for <notmuch@notmuchmail.org>; Fri, 09 Dec 2011 05:55:22 -0800 (PST)\r
24 Received: by 10.229.63.36 with SMTP id z36mr1931821qch.150.1323438922827;\r
25         Fri, 09 Dec 2011 05:55:22 -0800 (PST)\r
26 Received: from localhost (nikula.org. [92.243.24.172])\r
27         by mx.google.com with ESMTPS id j7sm16771322qaq.11.2011.12.09.05.55.20\r
28         (version=SSLv3 cipher=OTHER); Fri, 09 Dec 2011 05:55:21 -0800 (PST)\r
29 From: Jani Nikula <jani@nikula.org>\r
30 To: Austin Clements <amdragon@MIT.EDU>\r
31 Subject: Re: [PATCH v4 1/3] cli: introduce the concept of user defined hooks\r
32 In-Reply-To: <20111208233429.GA3190@mit.edu>\r
33 References: <cover.1323384304.git.jani@nikula.org>\r
34         <1e4ddb5e3a6b980e47418f67e16709a42e63bc47.1323384304.git.jani@nikula.org>\r
35         <20111208233429.GA3190@mit.edu>\r
36 User-Agent: Notmuch/0.5-232-g917e874 (http://notmuchmail.org) Emacs/23.1.1\r
37         (i686-pc-linux-gnu)\r
38 Date: Fri, 09 Dec 2011 13:55:19 +0000\r
39 Message-ID: <87r50dyhmg.fsf@nikula.org>\r
40 MIME-Version: 1.0\r
41 Content-Type: text/plain; charset=us-ascii\r
42 Cc: notmuch@notmuchmail.org\r
43 X-BeenThere: notmuch@notmuchmail.org\r
44 X-Mailman-Version: 2.1.13\r
45 Precedence: list\r
46 List-Id: "Use and development of the notmuch mail system."\r
47         <notmuch.notmuchmail.org>\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
51 List-Post: <mailto:notmuch@notmuchmail.org>\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
55 X-List-Received-Date: Fri, 09 Dec 2011 13:55:25 -0000\r
56 \r
57 On Thu, 8 Dec 2011 18:34:29 -0500, Austin Clements <amdragon@MIT.EDU> wrote:\r
58 > Quoth Jani Nikula on Dec 09 at 12:48 am:\r
59 > > +    /* Check access before fork() for speed and simplicity of error handling. */\r
60 > > +    if (access (hook_path, X_OK) == -1) {\r
61 > > +   /* Ignore ENOENT. It's okay not to have a hook, hook dir, or even\r
62 > > +    * notmuch dir. Dangling symbolic links also result in ENOENT, but\r
63 > > +    * we'll ignore that too for simplicity. */\r
64 > > +   if (errno != ENOENT) {\r
65 > > +       fprintf (stderr, "Error: %s hook access failed: %s\n", hook,\r
66 > > +                strerror (errno));\r
67 > > +       status = 1;\r
68 > > +   }\r
69\r
70 > Is it the intent that a present but non-executable hook (errno ==\r
71 > EACCES) will print the above error message and return with a failure?\r
72 > I'm pretty sure this differs from the behavior of git hooks.\r
73 \r
74 It differs from git, and it is intentional. Git bails out with success\r
75 status, without even a warning, for *all* access() failures. That may be\r
76 fine for git (which generally expects the user to know what he's doing)\r
77 but I'd argue notmuch should let the user know something is wrong.\r
78 \r
79 Also for EACCES, IMHO failing is more useful to the user than silently\r
80 ignoring. If the hook exists, but isn't executable, I think it's way\r
81 more likely that the user forgot to chmod +x than intentionally dropped\r
82 x so the hook would not be run. (And I think we agreed on IRC that in\r
83 the future, sample hooks would be named hook.sample and have executable\r
84 bit set.)\r
85 \r
86 Anyway, this is my opinion; it's not a big deal to change if there are\r
87 compelling reasons to ignore EACCES that I didn't think of.\r
88 \r
89 \r
90 BR,\r
91 Jani.\r
92 \r