--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 6F4546DE0B29\r
+ for <notmuch@notmuchmail.org>; Thu, 11 Jun 2015 13:22:00 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 1\r
+X-Spam-Level: *\r
+X-Spam-Status: No, score=1 tagged_above=-999 required=5 tests=[AWL=0.348,\r
+ SPF_NEUTRAL=0.652] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id MAsKa3X6PHFt for <notmuch@notmuchmail.org>;\r
+ Thu, 11 Jun 2015 13:21:57 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 118056DE0948\r
+ for <notmuch@notmuchmail.org>; Thu, 11 Jun 2015 13:21:56 -0700 (PDT)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id 47C0510005A;\r
+ Thu, 11 Jun 2015 23:21:31 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: David Bremner <david@tethera.net>, David Bremner <david@tethera.net>,\r
+ Morgan Veyret <morgan.veyret@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 1/2] lib: add NOTMUCH_STATUS_PATH_ERROR\r
+In-Reply-To: <1433920621-5279-1-git-send-email-david@tethera.net>\r
+References: <87oakqj5rm.fsf@maritornes.cs.unb.ca>\r
+ <1433920621-5279-1-git-send-email-david@tethera.net>\r
+User-Agent: Notmuch/0.20+12~gf3d9440 (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Thu, 11 Jun 2015 23:21:30 +0300\r
+Message-ID: <m2k2vam1x1.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 11 Jun 2015 20:22:00 -0000\r
+\r
+On Wed, Jun 10 2015, David Bremner <david@tethera.net> wrote:\r
+\r
+> The difference with FILE_ERROR is that this is for things that are\r
+> wrong with the path before looking at the disk.\r
+>\r
+> Add some 3 tests; two broken as a reminder to actually use this new\r
+> code.\r
+> ---\r
+\r
+Series looks good, tests pass.\r
+\r
+Tomi\r
+\r
+\r
+> lib/database.cc | 2 ++\r
+> lib/notmuch.h | 5 +++++\r
+> test/T070-insert.sh | 2 +-\r
+> test/T560-lib-error.sh | 42 ++++++++++++++++++++++++++++++++++++++++--\r
+> 4 files changed, 48 insertions(+), 3 deletions(-)\r
+>\r
+> diff --git a/lib/database.cc b/lib/database.cc\r
+> index 78a24f7..e726f62 100644\r
+> --- a/lib/database.cc\r
+> +++ b/lib/database.cc\r
+> @@ -342,6 +342,8 @@ notmuch_status_to_string (notmuch_status_t status)\r
+> return "Unsupported operation";\r
+> case NOTMUCH_STATUS_UPGRADE_REQUIRED:\r
+> return "Operation requires a database upgrade";\r
+> + case NOTMUCH_STATUS_PATH_ERROR:\r
+> + return "Path supplied is illegal for this function";\r
+> default:\r
+> case NOTMUCH_STATUS_LAST_STATUS:\r
+> return "Unknown error status value";\r
+> diff --git a/lib/notmuch.h b/lib/notmuch.h\r
+> index 20c4e01..aab0151 100644\r
+> --- a/lib/notmuch.h\r
+> +++ b/lib/notmuch.h\r
+> @@ -164,6 +164,11 @@ typedef enum _notmuch_status {\r
+> */\r
+> NOTMUCH_STATUS_UPGRADE_REQUIRED,\r
+> /**\r
+> + * There is a problem with the proposed path, a relative path\r
+> + * passed to a function expecting an absolute path.\r
+> + */\r
+> + NOTMUCH_STATUS_PATH_ERROR,\r
+> + /**\r
+> * Not an actual status value. Just a way to find out how many\r
+> * valid status values there are.\r
+> */\r
+> diff --git a/test/T070-insert.sh b/test/T070-insert.sh\r
+> index 74f1955..7e71c3b 100755\r
+> --- a/test/T070-insert.sh\r
+> +++ b/test/T070-insert.sh\r
+> @@ -188,7 +188,7 @@ notmuch config set new.tags $OLDCONFIG\r
+> # DUPLICATE_MESSAGE_ID is not tested here, because it should actually pass.\r
+> \r
+> for code in OUT_OF_MEMORY XAPIAN_EXCEPTION FILE_NOT_EMAIL \\r
+> - READ_ONLY_DATABASE UPGRADE_REQUIRED; do\r
+> + READ_ONLY_DATABASE UPGRADE_REQUIRED PATH_ERROR; do\r
+> gen_insert_msg\r
+> cat <<EOF > index-file-$code.gdb\r
+> set breakpoint pending on\r
+> diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh\r
+> index c99b17e..9f5f7ae 100755\r
+> --- a/test/T560-lib-error.sh\r
+> +++ b/test/T560-lib-error.sh\r
+> @@ -35,7 +35,8 @@ Error: Cannot open a database for a NULL path.\r
+> EOF\r
+> test_expect_equal_file EXPECTED OUTPUT\r
+> \r
+> -test_begin_subtest "Open nonexistent database"\r
+> +test_begin_subtest "Open relative path"\r
+> +test_subtest_known_broken\r
+> test_C <<'EOF'\r
+> #include <stdio.h>\r
+> #include <notmuch.h>\r
+> @@ -49,7 +50,44 @@ EOF\r
+> cat <<'EOF' >EXPECTED\r
+> == stdout ==\r
+> == stderr ==\r
+> -Error opening database at ./nonexistent/foo/.notmuch: No such file or directory\r
+> +Error: Database path must be absolute.\r
+> +EOF\r
+> +test_expect_equal_file EXPECTED OUTPUT\r
+> +\r
+> +test_begin_subtest "Create database in relative path"\r
+> +test_subtest_known_broken\r
+> +test_C <<'EOF'\r
+> +#include <stdio.h>\r
+> +#include <notmuch.h>\r
+> +int main (int argc, char** argv)\r
+> +{\r
+> + notmuch_database_t *db;\r
+> + notmuch_status_t stat;\r
+> + stat = notmuch_database_create ("./nonexistent/foo", &db);\r
+> +}\r
+> +EOF\r
+> +cat <<'EOF' >EXPECTED\r
+> +== stdout ==\r
+> +== stderr ==\r
+> +Error: Database path must be absolute.\r
+> +EOF\r
+> +test_expect_equal_file EXPECTED OUTPUT\r
+> +\r
+> +test_begin_subtest "Open nonexistent database"\r
+> +test_C ${PWD}/nonexistent/foo <<'EOF'\r
+> +#include <stdio.h>\r
+> +#include <notmuch.h>\r
+> +int main (int argc, char** argv)\r
+> +{\r
+> + notmuch_database_t *db;\r
+> + notmuch_status_t stat;\r
+> + stat = notmuch_database_open (argv[1], 0, 0);\r
+> +}\r
+> +EOF\r
+> +cat <<'EOF' >EXPECTED\r
+> +== stdout ==\r
+> +== stderr ==\r
+> +Error opening database at CWD/nonexistent/foo/.notmuch: No such file or directory\r
+> EOF\r
+> test_expect_equal_file EXPECTED OUTPUT\r
+> \r
+> -- \r
+> 2.1.4\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r