From: Mark Oteiza Date: Mon, 21 Jul 2014 03:06:28 +0000 (+2000) Subject: [PATCH] config: read user.name from $NAME if set X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=712a1123f12b1c39c070bbac6d8a3396591ca941;p=notmuch-archives.git [PATCH] config: read user.name from $NAME if set --- diff --git a/1b/346e35a5683e7acdbf70cc7e1e1a06bc541c5e b/1b/346e35a5683e7acdbf70cc7e1e1a06bc541c5e new file mode 100644 index 000000000..4854feea7 --- /dev/null +++ b/1b/346e35a5683e7acdbf70cc7e1e1a06bc541c5e @@ -0,0 +1,94 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id AB88D431FC7 + for ; Sun, 20 Jul 2014 20:10:14 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id ojj+MdO7qNx6 for ; + Sun, 20 Jul 2014 20:10:10 -0700 (PDT) +Received: from plane.gmane.org (plane.gmane.org [80.91.229.3]) + (using TLSv1 with cipher AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 6290B431FC4 + for ; Sun, 20 Jul 2014 20:10:10 -0700 (PDT) +Received: from list by plane.gmane.org with local (Exim 4.69) + (envelope-from ) id 1X93zI-00060L-2c + for notmuch@notmuchmail.org; Mon, 21 Jul 2014 05:10:04 +0200 +Received: from ip68-100-203-36.dc.dc.cox.net ([68.100.203.36]) + by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) + id 1AlnuQ-0007hv-00 + for ; Mon, 21 Jul 2014 05:10:04 +0200 +Received: from mvoteiza by ip68-100-203-36.dc.dc.cox.net with local (Gmexim + 0.1 (Debian)) id 1AlnuQ-0007hv-00 + for ; Mon, 21 Jul 2014 05:10:04 +0200 +X-Injected-Via-Gmane: http://gmane.org/ +To: notmuch@notmuchmail.org +From: Mark Oteiza +Subject: [PATCH] config: read user.name from $NAME if set +Date: Sun, 20 Jul 2014 23:06:28 -0400 +Lines: 35 +Message-ID: <87r41fo1fv.fsf@holos.localdomain> +Mime-Version: 1.0 +Content-Type: text/plain +X-Complaints-To: usenet@ger.gmane.org +X-Gmane-NNTP-Posting-Host: ip68-100-203-36.dc.dc.cox.net +User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) +Cancel-Lock: sha1:EpotO1Mt7QFHKgo8XfQXCAsWTa8= +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 21 Jul 2014 03:10:14 -0000 + + +Try to read the config parameter user.name from $NAME before taking the +user name from /etc/passwd. +--- + notmuch-config.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/notmuch-config.c b/notmuch-config.c +index 4886d36..8f1f48d 100644 +--- a/notmuch-config.c ++++ b/notmuch-config.c +@@ -219,7 +219,8 @@ get_username_from_passwd_file (void *ctx) + * + * database_path: $HOME/mail + * +- * user_name: From /etc/passwd ++ * user_name: $NAME variable if set, otherwise ++ * read from /etc/passwd + * + * user_primary_mail: $EMAIL variable if set, otherwise + * constructed from the username and +@@ -329,7 +330,9 @@ notmuch_config_open (void *ctx, + } + + if (notmuch_config_get_user_name (config) == NULL) { +- char *name = get_name_from_passwd_file (config); ++ char *name = getenv ("NAME"); ++ if (! name) ++ name = get_name_from_passwd_file (config); + notmuch_config_set_user_name (config, name); + talloc_free (name); + } +-- +2.0.2 + +