From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#33195: 27.0.50; user-login-name has no group-login-name Date: Tue, 30 Oct 2018 12:34:49 +0200 Message-ID: <837ehzlo3a.fsf@gnu.org> References: <87d0rsegbi.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1540895589 30657 195.159.176.226 (30 Oct 2018 10:33:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 30 Oct 2018 10:33:09 +0000 (UTC) Cc: 33195@debbugs.gnu.org To: Jules Tamagnan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 30 11:33:05 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHRKb-0007rh-1t for geb-bug-gnu-emacs@m.gmane.org; Tue, 30 Oct 2018 11:33:05 +0100 Original-Received: from localhost ([::1]:52052 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHRMh-0007bQ-Ld for geb-bug-gnu-emacs@m.gmane.org; Tue, 30 Oct 2018 06:35:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40940) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHRMa-0007aI-Ns for bug-gnu-emacs@gnu.org; Tue, 30 Oct 2018 06:35:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHRMU-0005EE-RT for bug-gnu-emacs@gnu.org; Tue, 30 Oct 2018 06:35:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49150) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHRMU-0005E4-MD for bug-gnu-emacs@gnu.org; Tue, 30 Oct 2018 06:35:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gHRMU-00033e-ET for bug-gnu-emacs@gnu.org; Tue, 30 Oct 2018 06:35:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 30 Oct 2018 10:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33195 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 33195-submit@debbugs.gnu.org id=B33195.154089569111734 (code B ref 33195); Tue, 30 Oct 2018 10:35:02 +0000 Original-Received: (at 33195) by debbugs.gnu.org; 30 Oct 2018 10:34:51 +0000 Original-Received: from localhost ([127.0.0.1]:53408 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHRMG-000339-Rs for submit@debbugs.gnu.org; Tue, 30 Oct 2018 06:34:51 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:59453) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHRMF-00032v-2f for 33195@debbugs.gnu.org; Tue, 30 Oct 2018 06:34:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHRM6-0004xq-G3 for 33195@debbugs.gnu.org; Tue, 30 Oct 2018 06:34:41 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33943) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHRM6-0004xV-AC; Tue, 30 Oct 2018 06:34:38 -0400 Original-Received: from [176.228.60.248] (port=3399 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gHRM5-00082F-Tq; Tue, 30 Oct 2018 06:34:38 -0400 In-reply-to: <87d0rsegbi.fsf@gmail.com> (message from Jules Tamagnan on Mon, 29 Oct 2018 11:52:17 -0700) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:151820 Archived-At: > From: Jules Tamagnan > Date: Mon, 29 Oct 2018 11:52:17 -0700 > > I've found it difficult to go from an integer group id to the name of > that group. I've looked at the source for `user-login-name` and > `system-groups` and could not find a way to do what I needed. > > As such I think it would be great to add a function to do that. Thanks. Please allow me a few comments: Please always provide a ChangeLog-style commit log message describing your changes. The file CONTRIBUTE has more about that. > I'm unsure how to make an argument not be optional. You want the argument NOT to be optional? If so, make this: > +DEFUN ("group-name", Fgroup_name, Sgroup_name, 0, 1, 0, say this instead: > +DEFUN ("group-name", Fgroup_name, Sgroup_name, 1, 1, 0, See the node "Writing Emacs Primitives" in the ELisp manual, which describes how to use the DEFUN macro. > +DEFUN ("group-name", Fgroup_name, Sgroup_name, 0, 1, 0, > + doc: /* If argument GID is an integer or a float, return the login name > +of the group with that GID, or nil if there is no such GID. */) > + (Lisp_Object gid) > +{ > + struct group *gr; > + gid_t id; > + > + if (NILP (gid)) > + return Qnil; Wouldn't it be more useful to return user's group name when the argument is nil or omitted? Also, would you please write a couple of simple tests for this new function? Finally, this function should be announced in NEWS and documented in the ELisp manual.