1 Return-Path: <pieter@praet.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 B6C0A431E62
\r
6 for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 02:33:02 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 igpaGb5gTAHX for <notmuch@notmuchmail.org>;
\r
16 Mon, 16 Jan 2012 02:33:02 -0800 (PST)
\r
17 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com
\r
18 [74.125.82.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 E74BB431FC0
\r
21 for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 02:33:01 -0800 (PST)
\r
22 Received: by werh12 with SMTP id h12so1292874wer.26
\r
23 for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 02:33:00 -0800 (PST)
\r
24 Received: by 10.180.93.168 with SMTP id cv8mr13533569wib.2.1326709980847;
\r
25 Mon, 16 Jan 2012 02:33:00 -0800 (PST)
\r
26 Received: from localhost ([109.131.75.86])
\r
27 by mx.google.com with ESMTPS id em13sm11390801wid.7.2012.01.16.02.32.59
\r
28 (version=TLSv1/SSLv3 cipher=OTHER);
\r
29 Mon, 16 Jan 2012 02:33:00 -0800 (PST)
\r
30 From: Pieter Praet <pieter@praet.org>
\r
31 To: David Bremner <david@tethera.net>
\r
32 Subject: Re: [PATCH] test: cli: getting/setting/removing config values
\r
33 In-Reply-To: <87aa5qjx7l.fsf@zancas.localnet>
\r
34 References: <8739bir7do.fsf@praet.org>
\r
35 <1326531476-14556-1-git-send-email-pieter@praet.org>
\r
36 <87aa5qjx7l.fsf@zancas.localnet>
\r
37 User-Agent: Notmuch/0.11+78~g6c58370 (http://notmuchmail.org) Emacs/23.3.1
\r
38 (x86_64-unknown-linux-gnu)
\r
39 Date: Mon, 16 Jan 2012 11:31:11 +0100
\r
40 Message-ID: <874nvw2b2o.fsf@praet.org>
\r
42 Content-Type: text/plain; charset=us-ascii
\r
43 Cc: Notmuch Mail <notmuch@notmuchmail.org>
\r
44 X-BeenThere: notmuch@notmuchmail.org
\r
45 X-Mailman-Version: 2.1.13
\r
47 List-Id: "Use and development of the notmuch mail system."
\r
48 <notmuch.notmuchmail.org>
\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
52 List-Post: <mailto:notmuch@notmuchmail.org>
\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
56 X-List-Received-Date: Mon, 16 Jan 2012 10:33:02 -0000
\r
58 On Sat, 14 Jan 2012 08:16:30 -0400, David Bremner <david@tethera.net> wrote:
\r
59 > On Sat, 14 Jan 2012 09:57:56 +0100, Pieter Praet <pieter@praet.org> wrote:
\r
60 > > Full test coverage for getting, setting and removing options in
\r
61 > > notmuch(1)'s config file ($NOTMUCH_CONFIG or $HOME/.notmuch-config).
\r
65 > > +# FIXME: Not the most robust nor portable solution here...
\r
66 > > +# Especially `hostname --domain' may have unwanted effects on
\r
67 > > +# some platforms, e.g. setting your hostname to "--domain" ;)
\r
68 > > +fallback_name="$(grep $(id -un) /etc/passwd | cut -d ":" -f 5 | cut -d "," -f 1)"
\r
69 > > +fallback_email="$(id -un)@$(hostname).$(hostname --domain)"
\r
71 > I'm not sure how portable it is, but maybe dnsdomainname would at least
\r
72 > have better failure modes.
\r
75 Hmmm, `dnsdomainname' returns "(none)" here; Does it work for you?
\r
77 Running `domainname' instead seems to do the right thing though...
\r
80 It would probably be safest to simply mirror how it's done @
\r
81 notmuch-config.c:313, but that seems rather excessive.
\r
83 > I also wondered about using getent instead of grep.
\r
86 Agreed, much safer; `grep' might return multiple results.
\r
93 fallback_name="$(getent passwd ${USER} | cut -d ":" -f 5 | cut -d "," -f 1)"
\r
94 test -n "${EMAIL}" \
\r
95 && fallback_email="${EMAIL}" \
\r
96 || fallback_email="${USER}@$(hostname).$(domainname)"
\r