[PATCH] config: read user.name from $NAME if set
authorMark Oteiza <mvoteiza@udel.edu>
Mon, 21 Jul 2014 03:06:28 +0000 (23:06 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:03:48 +0000 (10:03 -0800)
1b/346e35a5683e7acdbf70cc7e1e1a06bc541c5e [new file with mode: 0644]

diff --git a/1b/346e35a5683e7acdbf70cc7e1e1a06bc541c5e b/1b/346e35a5683e7acdbf70cc7e1e1a06bc541c5e
new file mode 100644 (file)
index 0000000..4854fee
--- /dev/null
@@ -0,0 +1,94 @@
+Return-Path: <gmn-notmuch@m.gmane.org>\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 AB88D431FC7\r
+       for <notmuch@notmuchmail.org>; Sun, 20 Jul 2014 20:10:14 -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\r
+       tests=[RCVD_IN_DNSWL_NONE=-0.0001] 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 ojj+MdO7qNx6 for <notmuch@notmuchmail.org>;\r
+       Sun, 20 Jul 2014 20:10:10 -0700 (PDT)\r
+Received: from plane.gmane.org (plane.gmane.org [80.91.229.3])\r
+       (using TLSv1 with cipher AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 6290B431FC4\r
+       for <notmuch@notmuchmail.org>; Sun, 20 Jul 2014 20:10:10 -0700 (PDT)\r
+Received: from list by plane.gmane.org with local (Exim 4.69)\r
+       (envelope-from <gmn-notmuch@m.gmane.org>) id 1X93zI-00060L-2c\r
+       for notmuch@notmuchmail.org; Mon, 21 Jul 2014 05:10:04 +0200\r
+Received: from ip68-100-203-36.dc.dc.cox.net ([68.100.203.36])\r
+       by main.gmane.org with esmtp (Gmexim 0.1 (Debian))\r
+       id 1AlnuQ-0007hv-00\r
+       for <notmuch@notmuchmail.org>; Mon, 21 Jul 2014 05:10:04 +0200\r
+Received: from mvoteiza by ip68-100-203-36.dc.dc.cox.net with local (Gmexim\r
+       0.1 (Debian)) id 1AlnuQ-0007hv-00\r
+       for <notmuch@notmuchmail.org>; Mon, 21 Jul 2014 05:10:04 +0200\r
+X-Injected-Via-Gmane: http://gmane.org/\r
+To: notmuch@notmuchmail.org\r
+From: Mark Oteiza <mvoteiza@udel.edu>\r
+Subject: [PATCH] config: read user.name from $NAME if set\r
+Date: Sun, 20 Jul 2014 23:06:28 -0400\r
+Lines: 35\r
+Message-ID: <87r41fo1fv.fsf@holos.localdomain>\r
+Mime-Version: 1.0\r
+Content-Type: text/plain\r
+X-Complaints-To: usenet@ger.gmane.org\r
+X-Gmane-NNTP-Posting-Host: ip68-100-203-36.dc.dc.cox.net\r
+User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)\r
+Cancel-Lock: sha1:EpotO1Mt7QFHKgo8XfQXCAsWTa8=\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 03:10:14 -0000\r
+\r
+\r
+Try to read the config parameter user.name from $NAME before taking the\r
+user name from /etc/passwd.\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
+\r
+\r