Re: [PATCH] config: read user.name from $NAME if set
authorTomi Ollila <tomi.ollila@iki.fi>
Mon, 21 Jul 2014 06:58:54 +0000 (09:58 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:03:49 +0000 (10:03 -0800)
58/507ed001f2a73f0413f2b20f9e63364748f0f3 [new file with mode: 0644]

diff --git a/58/507ed001f2a73f0413f2b20f9e63364748f0f3 b/58/507ed001f2a73f0413f2b20f9e63364748f0f3
new file mode 100644 (file)
index 0000000..5e9253f
--- /dev/null
@@ -0,0 +1,95 @@
+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 olra.theworths.org (Postfix) with ESMTP id 14AB2431FBD\r
+       for <notmuch@notmuchmail.org>; Sun, 20 Jul 2014 23:59:11 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id OpjwgvsLmxEn for <notmuch@notmuchmail.org>;\r
+       Sun, 20 Jul 2014 23:59:02 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id E212C431FAE\r
+       for <notmuch@notmuchmail.org>; Sun, 20 Jul 2014 23:59:01 -0700 (PDT)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+       by guru.guru-group.fi (Postfix) with ESMTP id 3F20B100199;\r
+       Mon, 21 Jul 2014 09:58:54 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Mark Oteiza <mvoteiza@udel.edu>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] config: read user.name from $NAME if set\r
+In-Reply-To: <87r41fo1fv.fsf@holos.localdomain>\r
+References: <87r41fo1fv.fsf@holos.localdomain>\r
+User-Agent: Notmuch/0.18.1+25~gdaf4b6f (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: Mon, 21 Jul 2014 09:58:54 +0300\r
+Message-ID: <m2lhrn2o5t.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.13\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: Mon, 21 Jul 2014 06:59:11 -0000\r
+\r
+On Mon, Jul 21 2014, Mark Oteiza <mvoteiza@udel.edu> wrote:\r
+\r
+> Try to read the config parameter user.name from $NAME before taking the\r
+> user name from /etc/passwd.\r
+\r
+LGTM. $NAME is used for the same purpose in\r
+\r
+https://www.gnu.org/software/emacs/manual/html_node/emacs/General-Variables.html\r
+\r
+(and probably in many other places too)\r
+\r
+\r
+Tomi\r
+\r
+> ---\r
+>  notmuch-config.c | 7 +++++--\r
+>  1 file changed, 5 insertions(+), 2 deletions(-)\r
+>\r
+> diff --git a/notmuch-config.c b/notmuch-config.c\r
+> index 4886d36..8f1f48d 100644\r
+> --- a/notmuch-config.c\r
+> +++ b/notmuch-config.c\r
+> @@ -219,7 +219,8 @@ get_username_from_passwd_file (void *ctx)\r
+>   *\r
+>   *          database_path:          $HOME/mail\r
+>   *\r
+> - *          user_name:              From /etc/passwd\r
+> + *          user_name:              $NAME variable if set, otherwise\r
+> + *                                  read from /etc/passwd\r
+>   *\r
+>   *          user_primary_mail:      $EMAIL variable if set, otherwise\r
+>   *                                  constructed from the username and\r
+> @@ -329,7 +330,9 @@ notmuch_config_open (void *ctx,\r
+>      }\r
+>  \r
+>      if (notmuch_config_get_user_name (config) == NULL) {\r
+> -    char *name = get_name_from_passwd_file (config);\r
+> +    char *name = getenv ("NAME");\r
+> +    if (! name)\r
+> +        name = get_name_from_passwd_file (config);\r
+>      notmuch_config_set_user_name (config, name);\r
+>      talloc_free (name);\r
+>      }\r
+> -- \r
+> 2.0.2\r