Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id EAABC429E25 for ; Fri, 9 Dec 2011 07:58:15 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sjBiLG41CjBf for ; Fri, 9 Dec 2011 07:58:15 -0800 (PST) Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU [18.9.25.14]) by olra.theworths.org (Postfix) with ESMTP id 65EA3431FB6 for ; Fri, 9 Dec 2011 07:58:15 -0800 (PST) X-AuditID: 1209190e-b7f4a6d0000008e5-fc-4ee230165012 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP id 47.EE.02277.61032EE4; Fri, 9 Dec 2011 10:58:14 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id pB9FvxQO022944; Fri, 9 Dec 2011 10:58:00 -0500 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id pB9Fvwur014630 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Fri, 9 Dec 2011 10:57:59 -0500 (EST) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1RZ2rL-0008Q4-74; Fri, 09 Dec 2011 10:59:39 -0500 Date: Fri, 9 Dec 2011 10:59:39 -0500 From: Austin Clements To: Jani Nikula Subject: Re: [PATCH v4 1/3] cli: introduce the concept of user defined hooks Message-ID: <20111209155939.GF3190@mit.edu> References: <1e4ddb5e3a6b980e47418f67e16709a42e63bc47.1323384304.git.jani@nikula.org> <20111208233429.GA3190@mit.edu> <87r50dyhmg.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87r50dyhmg.fsf@nikula.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmleLIzCtJLcpLzFFi42IRYrdT0RUzeORnsGOfhUXTdGeL6zdnMjsw edy6/5rd49mqW8wBTFFcNimpOZllqUX6dglcGevffWYpuMtbMXvdecYGxsNcXYycHBICJhI7 bk9igrDFJC7cW8/WxcjFISSwj1Hi/tzDjBDOekaJ91vnQ2VOMEksvb2TFcJZwiix+vMfVpB+ FgEViYkzdzOC2GwCGhLb9i8Hs0UEFCU2n9wPZjMLSEt8+90Mtk9YwEdix8l5bCA2r4C2xKOp h1jhdrdcXsYMkRCUODnzCQtEs5bEjX8vgZo5wAYt/8cBYnIC7eq/CzZGFOiEKSe3sU1gFJqF pHkWkuZZCM0LGJlXMcqm5Fbp5iZm5hSnJusWJyfm5aUW6Rrr5WaW6KWmlG5iBIU1pyTfDsav B5UOMQpwMCrx8HZyP/QTYk0sK67MPcQoycGkJMq7U/eRnxBfUn5KZUZicUZ8UWlOavEhRgkO ZiURXhV5oBxvSmJlVWpRPkxKmoNFSZy3dhfQJIH0xJLU7NTUgtQimKwMB4eSBK+SPlCjYFFq empFWmZOCUKaiYMTZDgP0PBkkBre4oLE3OLMdIj8KUZFKXFeB5CEAEgiozQPrheWdl4xigO9 IsyrDFLFA0xZcN2vgAYzAQ3+kv0AZHBJIkJKqoGx32URH1865zJeY6Gk3/GMiw+UaKnPWXq3 Vy34/K/1L5xLt3wv+X2pZI3sypj1k4+sKwj8cmjNHNmHGy7y2v3u9r7eeu+MOtf/hMNsv54u +vrkRG35FN2XQfkv+DNad/DO7d69zvnJPb2jQXvjuWYuz0qX6Juh+e34tJunDwfZ+v+a8/3V aw6tM0osxRmJhlrMRcWJAJ8rprQWAwAA Cc: notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 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: Fri, 09 Dec 2011 15:58:16 -0000 Quoth Jani Nikula on Dec 09 at 1:55 pm: > On Thu, 8 Dec 2011 18:34:29 -0500, Austin Clements wrote: > > Quoth Jani Nikula on Dec 09 at 12:48 am: > > > + /* Check access before fork() for speed and simplicity of error handling. */ > > > + if (access (hook_path, X_OK) == -1) { > > > + /* Ignore ENOENT. It's okay not to have a hook, hook dir, or even > > > + * notmuch dir. Dangling symbolic links also result in ENOENT, but > > > + * we'll ignore that too for simplicity. */ > > > + if (errno != ENOENT) { > > > + fprintf (stderr, "Error: %s hook access failed: %s\n", hook, > > > + strerror (errno)); > > > + status = 1; > > > + } > > > > Is it the intent that a present but non-executable hook (errno == > > EACCES) will print the above error message and return with a failure? > > I'm pretty sure this differs from the behavior of git hooks. > > It differs from git, and it is intentional. Git bails out with success > status, without even a warning, for *all* access() failures. That may be > fine for git (which generally expects the user to know what he's doing) > but I'd argue notmuch should let the user know something is wrong. > > Also for EACCES, IMHO failing is more useful to the user than silently > ignoring. If the hook exists, but isn't executable, I think it's way > more likely that the user forgot to chmod +x than intentionally dropped > x so the hook would not be run. (And I think we agreed on IRC that in > the future, sample hooks would be named hook.sample and have executable > bit set.) > > Anyway, this is my opinion; it's not a big deal to change if there are > compelling reasons to ignore EACCES that I didn't think of. Consider me convinced.