--- /dev/null
+Return-Path: <bijan.chokoufe@gmail.com>\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 AD9906DE0173\r
+ for <notmuch@notmuchmail.org>; Mon, 9 May 2016 14:57:39 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.82\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.82 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01,\r
+ RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] 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 HgjtoxGPjqgU for <notmuch@notmuchmail.org>;\r
+ Mon, 9 May 2016 14:57:30 -0700 (PDT)\r
+Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com\r
+ [74.125.82.44]) by arlo.cworth.org (Postfix) with ESMTPS id D2B846DE00DB for\r
+ <notmuch@notmuchmail.org>; Mon, 9 May 2016 14:57:29 -0700 (PDT)\r
+Received: by mail-wm0-f44.google.com with SMTP id e201so154658009wme.0\r
+ for <notmuch@notmuchmail.org>; Mon, 09 May 2016 14:57:29 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=date:from:to:cc:subject:message-id:references:mime-version\r
+ :content-disposition:in-reply-to:user-agent;\r
+ bh=rL/zsVsC0UgazDnXZ/73RVtYwEuNWltJGlZPul6vkPQ=;\r
+ b=mRRyC5O6gW2gZ9IeOFCPVlbS4J2qSDff2z08aGVz8g8BabjnWMfp9p+s7shk9KjiPJ\r
+ /0WNwfvaoqXyBfBflV+tkzwY+6OelK0T+VMU5wRKmgxaZcCNOMWj09YEjLrtRJoGTpqY\r
+ X45nMAqMu7coXGJkoLVv6ZPCK7OQqck0LMW9faaT1zasaYIvelhSdbL/EjNaHBbMVicO\r
+ fByxFXw8lUQrreLyBmfv/VIze3qCEi1YJA2GS6tFxM6Si7HGNZafpXUiyjwdJGPLybMK\r
+ bQHLUtlH2s7ivuGz2ZfQ95jfJyKf/zgFhllsZm7p0Kr+/D6/Hno2zIoaMGZjzejH79VO\r
+ Ii/A==\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:date:from:to:cc:subject:message-id:references\r
+ :mime-version:content-disposition:in-reply-to:user-agent;\r
+ bh=rL/zsVsC0UgazDnXZ/73RVtYwEuNWltJGlZPul6vkPQ=;\r
+ b=aJ1V6za7SrkYTpANwT4s0CoO92wyyxhQ3iz4gRkkNd60UwDA6h+k412xyZbWzQi4hI\r
+ R8ngtKZKrJv9He55tELw/t1fqQ+W3nCdDm6phPtkg9mL9FJ4Zxm/uO+byRODbbwj6U3G\r
+ xIuiOArDqo0miZZBmlg9akYsu0OE28OLzsNpzjAMcHBmQhePJdMFfrnjVJPbmosxexXI\r
+ /gIw0+GIYePTfIuAon53nBgNaLm9d+XyThgEt+Zy20Wb9ir7wJHs7h8oQQmtCgbJB5ZH\r
+ CFflFdc78lh+cerEvssBLY9DhvJ6yiHGau/sqplddkTI2CXpRxv+ESJa1wEPVGEioLzT\r
+ HBcw==\r
+X-Gm-Message-State:\r
+ AOPr4FXw9CAxPkKDq6/zK9lN4blUG8YEcZV9cggPLQT37EWvhPe/Y9XppEIemuRZnjpzlQ==\r
+X-Received: by 10.194.248.135 with SMTP id ym7mr35496223wjc.174.1462831048115;\r
+ Mon, 09 May 2016 14:57:28 -0700 (PDT)\r
+Received: from localhost (ip5f5be327.dynamic.kabel-deutschland.de.\r
+ [95.91.227.39])\r
+ by smtp.gmail.com with ESMTPSA id z125sm16796108wmg.24.2016.05.09.14.57.26\r
+ (version=TLS1_2 cipher=AES128-SHA bits=128/128);\r
+ Mon, 09 May 2016 14:57:26 -0700 (PDT)\r
+Date: Mon, 9 May 2016 23:57:24 +0200\r
+From: Bijan Chokoufe Nejad <bijan.chokoufe@gmail.com>\r
+To: Tomi Ollila <tomi.ollila@iki.fi>\r
+Cc: notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] config: Expand ~ to $HOME\r
+Message-ID: <20160509215724.GA3634@600B5B>\r
+References: <1462722574-4176-1-git-send-email-bijan@chokoufe.com>\r
+ <m2r3dc7azk.fsf@guru.guru-group.fi>\r
+ <CAOsAL0pp+3b-sf_k5kdrN7r1W8EtkC2vJ44Mg-e+su-8V=H6bQ@mail.gmail.com>\r
+ <m21t5bll8y.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/mixed; boundary="ZPt4rx8FFjLCG7dd"\r
+Content-Disposition: inline\r
+In-Reply-To: <m21t5bll8y.fsf@guru.guru-group.fi>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Mailman-Approved-At: Mon, 09 May 2016 21:23:46 -0700\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://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: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 09 May 2016 21:57:39 -0000\r
+\r
+\r
+--ZPt4rx8FFjLCG7dd\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+\r
+On 16-05-09, Tomi Ollila wrote:\r
+> On Sun, May 08 2016, Bijan Chokoufe <bijan@chokoufe.com> wrote:\r
+> \r
+> > Hi Tomi,\r
+> >\r
+> > Thanks for your detailled review. Please see questions below.\r
+> >\r
+> > Cheers,\r
+> > Bijan\r
+> >\r
+> > Tomi Ollila <tomi.ollila@iki.fi> schrieb am So., 8. Mai 2016 um 18:47 Uhr:\r
+> >\r
+> >> On Sun, May 08 2016, Bijan Chokoufe Nejad <bijan@chokoufe.com> wrote:\r
+> >>\r
+> >> > Very useful in case you want to keep your .notmuch-config synchronized\r
+> >> across\r
+> >> > machines where you have different user names.\r
+> >>\r
+> >> Thank you for your interest in improving notmuch!\r
+> >>\r
+> >> There are a few things that needs to be sorted out for this feature to be\r
+> >> good:\r
+> >>\r
+> >> This implementation does not handle ~user/ prefix: i.e. home directory of\r
+> >> 'user' (maybe this should not, but it should handle the case).\r
+> >\r
+> > I don't get it. Is '~user" an alternative to '~'?\r
+> \r
+> ~user is ~ in case you're 'user' -- except that now that I think of it\r
+> ~user could read home directory from /etc/passwd and not using $HOME.\r
+> If you're 'eve', then ~alice should definitely be different than ~\r
+\r
+OK I see. I never used ~user instead of ~ and don't see any advantage in using\r
+~user but good to know it's there.\r
+\r
+> \r
+> >\r
+> >> Whether or not ~user is handled, it should check that slash (/) follows...\r
+> >>\r
+> >>\r
+> > So I guess you aim at the case where someone sets `path=~`? On the other\r
+> > hand why is this checking not necessary in the "normal" case where no\r
+> > expanding of `~` is done? Or is it maybe already handled in\r
+> > `lib/database.cc`. Just to be clear I tested that it works currently with\r
+> > `path=~/.mail`.\r
+> \r
+> your code checked that path[0] == '~', but nothing else, e.g.\r
+> \r
+> ~123randomstuff/... would expand as /home/user23randomstuff/... \r
+> \r
+> ... and you have good point path being set as single '~' !\r
+> \r
+> >> IIRC there is some ready-made implementations of the above -- but if not,\r
+> >> one option is to check how (expand-file-name) works in emacs for reference.\r
+> >>\r
+> >>\r
+> > Well there is wordexp (http://linux.die.net/man/3/wordexp) but I wasn't\r
+> > sure if I should use it. The getenv just seemed simpler but maybe it is\r
+> > necessary.\r
+> \r
+> For the time being we could simply do checking that path[0] == '~' and\r
+> path[1] == '/' and then do expansion based on getenv ("HOME") -- and\r
+> comment that ~any_user is just not supported there.\r
+\r
+alright, done. I am still a bit confused by the way you do pull request here.\r
+I am attaching the rebased commit as git patch. Is this correct or should I use\r
+git send-email again? How do you keep track of lengthy PRs with this workflow?\r
+\r
+Cheers,\r
+Bijan\r
+\r
+> \r
+> From testing point of view doing one positive test which ensures that when\r
+> HOME is a string pointing to valid directory (and does not end with\r
+> trailing slash as it usually is) and path in configuration starts with '~/'\r
+> (and does not have multiple slashes following) works as expected...\r
+> \r
+> (as a special case, from softare functionality point I don't see problem\r
+> setting path=~/ but from usability point that might not be the best -- but\r
+> some users may have peculiar preferences... ;D)\r
+> \r
+> Tomi\r
+\r
+--ZPt4rx8FFjLCG7dd\r
+Content-Type: text/x-diff; charset=us-ascii\r
+Content-Disposition: attachment;\r
+ filename="v2-0001-config-Expand-to-HOME.patch"\r
+\r
+>From ca6a86c6456d7fce2f18da8ec92d6d7ff14dc5f8 Mon Sep 17 00:00:00 2001\r
+From: Bijan Chokoufe Nejad <bijan@chokoufe.com>\r
+Date: Sun, 8 May 2016 15:47:50 +0200\r
+Subject: [PATCH v2] config: Expand ~ to $HOME\r
+\r
+Very useful in case you want to keep your .notmuch-config synchronized across\r
+machines where you have different user names.\r
+\r
+---\r
+Check for '~/' instead of checking for '~' and fix memory issue.\r
+\r
+Unit test is still pending\r
+---\r
+ notmuch-config.c | 10 +++++++++-\r
+ 1 file changed, 9 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/notmuch-config.c b/notmuch-config.c\r
+index d252bb2..e97d5b0 100644\r
+--- a/notmuch-config.c\r
++++ b/notmuch-config.c\r
+@@ -605,7 +605,15 @@ _config_set_list (notmuch_config_t *config,\r
+ const char *\r
+ notmuch_config_get_database_path (notmuch_config_t *config)\r
+ {\r
+- return _config_get (config, &config->database_path, "database", "path");\r
++ const char* path = _config_get (config, &config->database_path, "database", "path");\r
++ /* '~user/some/path' is not supported but only '~/some/path' */\r
++ if (path != NULL && path[0] == '~' && path[1] == '/') {\r
++ char *home_path = getenv("HOME");\r
++ return talloc_asprintf (NULL, "%s/%s", home_path, path + 2);\r
++ }\r
++ else {\r
++ return path;\r
++ }\r
+ }\r
+ \r
+ void\r
+-- \r
+1.9.1\r
+\r
+\r
+--ZPt4rx8FFjLCG7dd--\r