Assaf Gordon <assafgordon@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.Assaf Gordon <assafgordon@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.Assaf Gordon <assafgordon@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.Received: (at 34672) by debbugs.gnu.org; 28 Feb 2019 10:00:15 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 28 05:00:15 2019 Received: from localhost ([127.0.0.1]:54792 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1gzIUA-0002tY-LX for submit <at> debbugs.gnu.org; Thu, 28 Feb 2019 05:00:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36263) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <gscrivano@HIDDEN>) id 1gzIU8-0002tJ-QF for 34672 <at> debbugs.gnu.org; Thu, 28 Feb 2019 05:00:13 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36564) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <gscrivano@HIDDEN>) id 1gzIU3-0005Uh-78; Thu, 28 Feb 2019 05:00:07 -0500 Received: from 79.184.215.192.ipv4.supernova.orange.pl ([79.184.215.192]:33054 helo=localhost) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from <gscrivano@HIDDEN>) id 1gzIU2-0002Z7-NW; Thu, 28 Feb 2019 05:00:07 -0500 From: Giuseppe Scrivano <gscrivano@HIDDEN> To: Bernhard Voelker <mail@HIDDEN> Subject: Re: bug#34672: [RFC] id --numeric References: <87k1hml22r.fsf@HIDDEN> <7f067fd8-21c3-1ea6-bc5d-2586808c9221@HIDDEN> Date: Thu, 28 Feb 2019 11:00:03 +0100 In-Reply-To: <7f067fd8-21c3-1ea6-bc5d-2586808c9221@HIDDEN> (Bernhard Voelker's message of "Thu, 28 Feb 2019 08:22:58 +0100") Message-ID: <87zhqgjkrg.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 34672 Cc: 34672 <at> debbugs.gnu.org, Giuseppe Scrivano <gscrivano@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hi Bernhard, Bernhard Voelker <mail@HIDDEN> writes: > Thanks for the patch. > > What is the use case? I mean, if one wants only the numeric numbers, > then this is usually in a script for automatic processing, and then > I thinks it's clearer to have uid and group/groups separated: > > $ id -u > 1000 > > $ id -g > 100 > > $ id -G > 100 454 457 480 492 > > There's even a -z option to separate by NULs instead of white space. > > And, when still needing all in the same output, one could filter like e.g.: > > $ id | sed 's/([^)]*)//g' > uid=1000 gid=100 groups=100,454,457,480,492 > > So I'm currently 40:60 to add it. as I said, it doesn't really add anything. It is just an aesthetic shortcut that I find useful when using Linux user namespaces. In that use case the uid->username lookup doesn't make much sense. Regards, Giuseppe
bug-coreutils@HIDDEN:bug#34672; Package coreutils.
Full text available.Received: (at 34672) by debbugs.gnu.org; 28 Feb 2019 07:23:09 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 28 02:23:09 2019 Received: from localhost ([127.0.0.1]:54744 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1gzG29-0007S3-3m for submit <at> debbugs.gnu.org; Thu, 28 Feb 2019 02:23:09 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:38737) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <mail@HIDDEN>) id 1gzG26-0007RM-OM for 34672 <at> debbugs.gnu.org; Thu, 28 Feb 2019 02:23:07 -0500 Received: from [192.168.101.10] ([93.218.109.128]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1ML9ds-1ghBBJ3sZ8-00IGIZ; Thu, 28 Feb 2019 08:23:00 +0100 Subject: Re: bug#34672: [RFC] id --numeric To: Giuseppe Scrivano <gscrivano@HIDDEN>, 34672 <at> debbugs.gnu.org References: <87k1hml22r.fsf@HIDDEN> From: Bernhard Voelker <mail@HIDDEN> Openpgp: preference=signencrypt Autocrypt: addr=mail@HIDDEN; prefer-encrypt=mutual; keydata= mQENBFPirzMBCACyzYldTjQ4ufFOkByY5Nn5USb5GFoL48nWBwNHjd9KUbtRRNlQiPNKd6hK Gvd3BGi5aoFKA4ytfRk6jbAbW3jVb3R8wYaV08mOy4KVEKxqN4bxsXlMjNChXVR+rtKDmfI+ oPTL+cPH2X6gW4W02IRbVw0uUhNm6zEedC/gNrY/mTlf1enZ46jxZ7BTUZaG+kx38UMISIMB zSzLRtdkwgmHj4jS3p1fF2cwRqLclIfMjKGpbNFPEXeXKWrCLcqHw78795eAR9q0YvrDkfIn GdDBwfb3VM4NdulwIFzvYZMSXvSbbyPLB5YkHU5aAWQHUse4WlfT5ccDpbzUYldRAvF9ABEB AAG0K0Jlcm5oYXJkIFZvZWx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FG8E8dxqo1n+duOyIMgozrAnzP7X5V/Ob/Ozf/aGGX9+Jd inyfCX18nWcHALKMU/36Eua/ylalf/2c2YkBp9KCLVmGgPkUgW52EeRPgroIsiwu+rwCSV6Z UyCJ+OymCg== Message-ID: <7f067fd8-21c3-1ea6-bc5d-2586808c9221@HIDDEN> Date: Thu, 28 Feb 2019 08:22:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <87k1hml22r.fsf@HIDDEN> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:cmhak24Ut2+CY1BHVt4i/xH1Ha59MGZqmINMcirdr2mui6sh8lc 1ggpulp9wMNvPJpeA7kN3/pGBqZfdnXuGFWV9rEDdP9BWboNikSFnaownb3eaEQSOBVysnI J8Ftc2bgPDON1xwG//BGcMguvOIH/LpDhj3rqtaNDTmMeN2mrGMc9+PXW3BzokT700m6Sh2 ITsRrHjhBYZ2ySG+dAy2Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:4+ChRguFDTM=:tp+A1qXXR2tq3rDVASoFNJ SXFEopsvZo9Nc7K9nSfKjKAZCzlcUOymd05l7odLltFYdlPV5E/js8Q+cq8BtPNIZf6lMmtJj PmabvfPeQcD7P8feeo166OB+q8obk7Gi/0xjlh5nrf0hVzsuejkzp96G7N+RakCaTehZCAAkq XEVyIcFpfrAOLEaJOPpEsNGW+/SBsAPmPlVbZDu8jQS4N7sVlVSU60PBJWliC4V6QuYkqXulZ CRpVR+MD8i/ebZpbIrK7VT9MkBPE2daqiN4+qZeuoSNsbR+Iq10Fu19BY2fm4SJVvCQ7CbR1P CV1AKkv442jkxZm2MIUw2AX+nWPzL7MdrVJOl/F8SzqmZyIEAwPRjN6vxICKUoUd2GfiuFSDQ SNa9L7aOWLfb8C/KybKMoEe5qBBEjM1oCvDBCVcWsY+rV/NZE1OsXziSZBHVAw0qngXAOYPGS lDF6aWBOTwYAe8cY5y5nWy2v4itBxg4bbhitqOFlJSIWdYfTNW9i68c72PEKAax40H9VOBQx/ z51JjvhfEyC+tSITJmmG1CQNV4RSqJIuMyfOOuX3P1SpTbAempJ78ZTzRlkp681bRf+dnxEf6 sAfyu64a7uZ302hnVUg4VcHU3ircyjR657wbJnnw08c4yMcDQHz+cBF8dpCPa8g0gZBYiRTgK PLRWFwKAtgpeSxAQLlb+wY7gLUY3Ibb7itJS10COqL+6Igm4EenhXHKmyIlCvut5m/l8LRWHM +Ag8W8GHQqm8YUDcpwxCAYcl4MzjHgq2UPlD/bCAs2M1sQdipjRbVvi+8LyVS/Me1XXnunsrY TGRC/MW X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 34672 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) severity 34672 wishlist tags 34672 notabug stop On 2/26/19 9:36 PM, Giuseppe Scrivano wrote: > Hi, > > there are cases where I'd like to see only the numeric values in the > `id` output. > > I could get this information separately, but having a new option > and just one command simplifies the task. > > Are you fine with a change like the following? > > If you have nothing against it, I will clean it up and send it again. > > Thanks, > Giuseppe Thanks for the patch. What is the use case? I mean, if one wants only the numeric numbers, then this is usually in a script for automatic processing, and then I thinks it's clearer to have uid and group/groups separated: $ id -u 1000 $ id -g 100 $ id -G 100 454 457 480 492 There's even a -z option to separate by NULs instead of white space. And, when still needing all in the same output, one could filter like e.g.: $ id | sed 's/([^)]*)//g' uid=1000 gid=100 groups=100,454,457,480,492 So I'm currently 40:60 to add it. Thanks & have a nice day, Berny
bug-coreutils@HIDDEN:bug#34672; Package coreutils.
Full text available.
Received: (at submit) by debbugs.gnu.org; 26 Feb 2019 20:36:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 26 15:36:27 2019
Received: from localhost ([127.0.0.1]:53321 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1gyjSk-0005VN-L9
for submit <at> debbugs.gnu.org; Tue, 26 Feb 2019 15:36:26 -0500
Received: from eggs.gnu.org ([209.51.188.92]:44520)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <gscrivano@HIDDEN>) id 1gyjSi-0005VA-KC
for submit <at> debbugs.gnu.org; Tue, 26 Feb 2019 15:36:24 -0500
Received: from lists.gnu.org ([209.51.188.17]:36769)
by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
(Exim 4.71) (envelope-from <gscrivano@HIDDEN>) id 1gyjSd-0003dS-Cu
for submit <at> debbugs.gnu.org; Tue, 26 Feb 2019 15:36:19 -0500
Received: from eggs.gnu.org ([209.51.188.92]:58900)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from <gscrivano@HIDDEN>) id 1gyjSc-0003yd-Ex
for bug-coreutils@HIDDEN; Tue, 26 Feb 2019 15:36:19 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_40
autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:470:142:3::e]:39275)
by eggs.gnu.org with esmtp (Exim 4.71)
(envelope-from <gscrivano@HIDDEN>) id 1gyjSc-0003cn-9T
for bug-coreutils@HIDDEN; Tue, 26 Feb 2019 15:36:18 -0500
Received: from 79.184.28.128.ipv4.supernova.orange.pl ([79.184.28.128]:52562
helo=localhost)
by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
(Exim 4.82) (envelope-from <gscrivano@HIDDEN>) id 1gyjSb-0000IP-WC
for bug-coreutils@HIDDEN; Tue, 26 Feb 2019 15:36:18 -0500
From: Giuseppe Scrivano <gscrivano@HIDDEN>
To: bug-coreutils@HIDDEN
Subject: [RFC] id --numeric
Date: Tue, 26 Feb 2019 21:36:12 +0100
Message-ID: <87k1hml22r.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
Hi,
there are cases where I'd like to see only the numeric values in the
`id` output.
I could get this information separately, but having a new option
and just one command simplifies the task.
Are you fine with a change like the following?
If you have nothing against it, I will clean it up and send it again.
Thanks,
Giuseppe
diff --git a/src/id.c b/src/id.c
index d710caaee..e16c9c625 100644
--- a/src/id.c
+++ b/src/id.c
@@ -59,6 +59,8 @@ static bool ok = true;
static bool multiple_users = false;
/* If true, output user/group name instead of ID number. -n */
static bool use_name = false;
+/* If true, prints only numbers for the IDs. */
+static bool just_numeric = false;
/* The real and effective IDs of the user to print. */
static uid_t ruid, euid;
@@ -78,6 +80,7 @@ static struct option const longopts[] =
{"group", no_argument, NULL, 'g'},
{"groups", no_argument, NULL, 'G'},
{"name", no_argument, NULL, 'n'},
+ {"numeric", no_argument, NULL, 'N'},
{"real", no_argument, NULL, 'r'},
{"user", no_argument, NULL, 'u'},
{"zero", no_argument, NULL, 'z'},
@@ -105,6 +108,7 @@ or (when USER omitted) for the current user.\n\
-g, --group print only the effective group ID\n\
-G, --groups print all group IDs\n\
-n, --name print a name instead of a number, for -ugG\n\
+ -N, --numeric print only numeric values for IDs\n\
-r, --real print the real ID instead of the effective ID, with -ugG\n\
-u, --user print only the effective user ID\n\
-z, --zero delimit entries with NUL characters, not whitespace;\n\
@@ -137,7 +141,7 @@ main (int argc, char **argv)
atexit (close_stdout);
- while ((optc = getopt_long (argc, argv, "agnruzGZ", longopts, NULL)) != -1)
+ while ((optc = getopt_long (argc, argv, "agnruzGZN", longopts, NULL)) != -1)
{
switch (optc)
{
@@ -178,6 +182,9 @@ main (int argc, char **argv)
case 'G':
just_group_list = true;
break;
+ case 'N':
+ just_numeric = true;
+ break;
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
@@ -361,19 +368,19 @@ print_full_info (const char *username)
printf (_("uid=%s"), uidtostr (ruid));
pwd = getpwuid (ruid);
- if (pwd)
+ if (!just_numeric && pwd)
printf ("(%s)", pwd->pw_name);
printf (_(" gid=%s"), gidtostr (rgid));
grp = getgrgid (rgid);
- if (grp)
+ if (!just_numeric && grp)
printf ("(%s)", grp->gr_name);
if (euid != ruid)
{
printf (_(" euid=%s"), uidtostr (euid));
pwd = getpwuid (euid);
- if (pwd)
+ if (!just_numeric && pwd)
printf ("(%s)", pwd->pw_name);
}
@@ -381,7 +388,7 @@ print_full_info (const char *username)
{
printf (_(" egid=%s"), gidtostr (egid));
grp = getgrgid (egid);
- if (grp)
+ if (!just_numeric && grp)
printf ("(%s)", grp->gr_name);
}
@@ -413,9 +420,12 @@ print_full_info (const char *username)
if (i > 0)
putchar (',');
fputs (gidtostr (groups[i]), stdout);
- grp = getgrgid (groups[i]);
- if (grp)
- printf ("(%s)", grp->gr_name);
+ if (! just_numeric)
+ {
+ grp = getgrgid (groups[i]);
+ if (grp)
+ printf ("(%s)", grp->gr_name);
+ }
}
free (groups);
}
Regards,
Giuseppe
Giuseppe Scrivano <gscrivano@HIDDEN>:bug-coreutils@HIDDEN.
Full text available.bug-coreutils@HIDDEN:bug#34672; Package coreutils.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.