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 14AB2431FBD for ; Sun, 20 Jul 2014 23:59:11 -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=[none] 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 OpjwgvsLmxEn for ; Sun, 20 Jul 2014 23:59:02 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id E212C431FAE for ; Sun, 20 Jul 2014 23:59:01 -0700 (PDT) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id 3F20B100199; Mon, 21 Jul 2014 09:58:54 +0300 (EEST) From: Tomi Ollila To: Mark Oteiza , notmuch@notmuchmail.org Subject: Re: [PATCH] config: read user.name from $NAME if set In-Reply-To: <87r41fo1fv.fsf@holos.localdomain> References: <87r41fo1fv.fsf@holos.localdomain> User-Agent: Notmuch/0.18.1+25~gdaf4b6f (http://notmuchmail.org) Emacs/24.3.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain 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 06:59:11 -0000 On Mon, Jul 21 2014, Mark Oteiza wrote: > Try to read the config parameter user.name from $NAME before taking the > user name from /etc/passwd. LGTM. $NAME is used for the same purpose in https://www.gnu.org/software/emacs/manual/html_node/emacs/General-Variables.html (and probably in many other places too) Tomi > --- > 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