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 C5608429E25 for ; Sun, 4 Dec 2011 08:39:51 -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 DltElyE36y+4 for ; Sun, 4 Dec 2011 08:39:51 -0800 (PST) Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU [18.7.68.35]) by olra.theworths.org (Postfix) with ESMTP id 4B0F8429E21 for ; Sun, 4 Dec 2011 08:39:51 -0800 (PST) X-AuditID: 12074423-b7f266d0000008b8-25-4edba25613d5 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP id B3.BB.02232.652ABDE4; Sun, 4 Dec 2011 11:39:50 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id pB4GdnYH013939; Sun, 4 Dec 2011 11:39:50 -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 pB4GdmPS012528 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sun, 4 Dec 2011 11:39:49 -0500 (EST) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1RXF8B-0005zM-5j; Sun, 04 Dec 2011 11:41:35 -0500 Date: Sun, 4 Dec 2011 11:41:34 -0500 From: Austin Clements To: Jani Nikula Subject: Re: [PATCH v2 1/2] cli: introduce the concept of user defined hooks Message-ID: <20111204164134.GT16194@mit.edu> References: <7fbe6befcf31881a9bca672f55b93501249a220c.1322859389.git.jani@nikula.org> <6688b09fffa2a66b496af78008102f88ab4e9450.1322953841.git.jani@nikula.org> <20111204034210.GA16405@mit.edu> <87sjl0ldk0.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87sjl0ldk0.fsf@nikula.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpileLIzCtJLcpLzFFi42IR4hTV1g1bdNvP4Nh8bYum6c4W12/OZHZg 8rh1/zW7x7NVt5gDmKK4bFJSczLLUov07RK4Mtr6zzIXTOaqWP77HlMD40/2LkZODgkBE4nG J/cYIWwxiQv31rOB2EIC+xglXrdadjFyAdnrGSW2TX7ODJE4wSTxcWs2RGIJo8TCM7fAEiwC KhK3/m8Gm8QmoCGxbf9yMFtEQFFi88n9YDazgLTEt9/NTCC2sICPRPfPXWBX8AroSMyb9owF YugjRonLK59AJQQlTs58wgLRrCVx499LoGYOsEHL/3GAhDmBds0+1Ax2gyjQDVNObmObwCg0 C0n3LCTdsxC6FzAyr2KUTcmt0s1NzMwpTk3WLU5OzMtLLdI108vNLNFLTSndxAgKanYX5R2M fw4qHWIU4GBU4uHNPHHLT4g1say4MvcQoyQHk5Iob+n8235CfEn5KZUZicUZ8UWlOanFhxgl OJiVRHj5UoFyvCmJlVWpRfkwKWkOFiVxXpmdDn5CAumJJanZqakFqUUwWRkODiUJ3nMLgRoF i1LTUyvSMnNKENJMHJwgw3mAhoPV8BYXJOYWZ6ZD5E8xKkqJ894ESQiAJDJK8+B6YUnnFaM4 0CvCvGdBqniACQuu+xXQYCagwYqNN0AGlyQipKQaGM0ebbst9V7T4TznRgtnxs01Umomi+/z FXJK34jxlu978pQxOULK2u3d4SWcO/iD/vSwcLZ32tr/0P5r9FJNc0VumH6XbWdzwal0qa4t wm6n/m4tu3B1Q+PiIj2tD2vqTutei1UvsomcO53h2rkctoajWculmtZ/O3TngvMGJo3tv3fe O3FslxJLcUaioRZzUXEiAOez8ToVAwAA 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: Sun, 04 Dec 2011 16:39:51 -0000 Quoth Jani Nikula on Dec 04 at 2:35 pm: > > > +int > > > +notmuch_run_hook (const char *db_path, const char *hook) > > > +{ > > > + char *hook_path; > > > + int status = 0; > > > > You use status as both a notmuch_status_t and for generic C library > > results. This seems a little weird. You may or may not want to do > > anything about it. > > True, it's not consistent. I'll want to do something about it. I wonder > if it's worth returning anything other than ok/fail from this function > anyway. > > There seems to be some confusion in notmuch_status_t usage across > notmuch cli. Should notmuch cli return a notmuch_status_t as exit > status? It currently does at least in some cases, but it also returns > plain 1 too which is (unintentionally) NOTMUCH_STATUS_OUT_OF_MEMORY. > > Does it make sense for the cli to use the lib statuses internally > anyway; you wouldn't want to add new status codes to the lib just to be > able to use them in cli. I think the answer is that there's no good answer because error handling in C is so lame. In this particular case, I'd say there's little point in distinguishing different errors (and especially no point in returning not-quite-appropriate status codes), so perhaps it should follow the 0/1 convention.