From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: RFE: 'groups' command ADD command switches "-0", and "-1" Resent-From: Linda Walsh Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 07 Nov 2011 22:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 9987@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.132070505613885 (code B ref -1); Mon, 07 Nov 2011 22:31:01 +0000 Received: (at submit) by debbugs.gnu.org; 7 Nov 2011 22:30:56 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RNXiS-0003bu-7T for submit@debbugs.gnu.org; Mon, 07 Nov 2011 17:30:56 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RNXiP-0003bn-H8 for submit@debbugs.gnu.org; Mon, 07 Nov 2011 17:30:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RNXfa-0008OJ-LC for submit@debbugs.gnu.org; Mon, 07 Nov 2011 17:27:59 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:34511) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNXfa-0008OB-9H for submit@debbugs.gnu.org; Mon, 07 Nov 2011 17:27:58 -0500 Received: from eggs.gnu.org ([140.186.70.92]:43703) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNXfZ-0003LE-Cs for bug-coreutils@gnu.org; Mon, 07 Nov 2011 17:27:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RNXfY-0008NG-Bm for bug-coreutils@gnu.org; Mon, 07 Nov 2011 17:27:57 -0500 Received: from ishtar.tlinx.org ([173.164.175.65]:41376 helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNXfY-0008LQ-2e for bug-coreutils@gnu.org; Mon, 07 Nov 2011 17:27:56 -0500 Received: from [192.168.3.12] (Athenae [192.168.3.12]) by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id pA7MRpgh011215 for ; Mon, 7 Nov 2011 14:27:53 -0800 Message-ID: <4EB85B66.70508@tlinx.org> Date: Mon, 07 Nov 2011 14:27:50 -0800 From: Linda Walsh User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.8 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.0 (-----) I'd like to request an RFE for the groups command to add 2 switches: -1 - print groups in 1 column (cf. ls -1) -0 - print groups followed by null (cf. find et al) reasons: have groups with spaces in them. provide ultimate safety/futureproof with -0 ?? reasonable? From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: RFE: 'groups' command ADD command switches "-0", and "-1" Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 08 Nov 2011 00:30:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Linda Walsh Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.132071218023857 (code B ref 9987); Tue, 08 Nov 2011 00:30:01 +0000 Received: (at 9987) by debbugs.gnu.org; 8 Nov 2011 00:29:40 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RNZZH-0006Cg-Lj for submit@debbugs.gnu.org; Mon, 07 Nov 2011 19:29:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RNZZE-0006CX-Ib for 9987@debbugs.gnu.org; Mon, 07 Nov 2011 19:29:34 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pA80QbSc021316 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 7 Nov 2011 19:26:37 -0500 Received: from [10.36.116.45] (ovpn-116-45.ams2.redhat.com [10.36.116.45]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pA80QYDi018007 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Mon, 7 Nov 2011 19:26:36 -0500 Message-ID: <4EB8773A.5000604@draigBrady.com> Date: Tue, 08 Nov 2011 00:26:34 +0000 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 MIME-Version: 1.0 References: <4EB85B66.70508@tlinx.org> In-Reply-To: <4EB85B66.70508@tlinx.org> X-Enigmail-Version: 1.3.2 Content-Type: text/plain; charset=UTF-8 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id pA80QbSc021316 X-Spam-Score: -10.5 (----------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.5 (----------) On 11/07/2011 10:27 PM, Linda Walsh wrote: >=20 >=20 >=20 > I'd like to request an RFE for the groups command to add 2 switches: >=20 > -1 - print groups in 1 column (cf. ls -1) > -0 - print groups followed by null (cf. find et al) >=20 > reasons: have groups with spaces in them. > provide ultimate safety/futureproof with -0 >=20 > ?? > reasonable? Hmm. I suppose by extension that `id -Gn` should accept -1 too. But do you really want to support group names with spaces? `groupadd` for example won't allow this. I suppose integration with LDAP etc. might get arbitrary group names. Note POSIX is quite specific about the output format for `id`: "=E2=88=92G Output all different group IDs (effective, real, and suppleme= ntary) only, using the format "%u\n". If there is more than one distinct group affiliation, outp= ut each such affiliation, using the format " %u", before the is output.= " That suggests to me that \n is used to distinguish the three types of IDs. So -1 would have to override that functionality. cheers, P=C3=A1draig. From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: RFE: 'groups' command ADD command switches "-0", and "-1" Resent-From: "Linda A. Walsh" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 08 Nov 2011 01:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.132071696430696 (code B ref 9987); Tue, 08 Nov 2011 01:50:02 +0000 Received: (at 9987) by debbugs.gnu.org; 8 Nov 2011 01:49:24 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RNaoW-0007z2-Bk for submit@debbugs.gnu.org; Mon, 07 Nov 2011 20:49:24 -0500 Received: from ishtar.tlinx.org ([173.164.175.65] helo=Ishtar.sc.tlinx.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RNagx-0007o0-Vk for 9987@debbugs.gnu.org; Mon, 07 Nov 2011 20:41:37 -0500 Received: from [192.168.3.12] (Athenae [192.168.3.12]) by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id pA81ccju028408; Mon, 7 Nov 2011 17:38:40 -0800 Message-ID: <4EB8881E.3060707@tlinx.org> Date: Mon, 07 Nov 2011 17:38:38 -0800 From: "Linda A. Walsh" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666 MIME-Version: 1.0 References: <4EB85B66.70508@tlinx.org> <4EB8773A.5000604@draigBrady.com> In-Reply-To: <4EB8773A.5000604@draigBrady.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by Ishtar.sc.tlinx.org id pA81ccju028408 X-Spam-Score: -2.6 (--) X-Mailman-Approved-At: Mon, 07 Nov 2011 20:49:23 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) P=C3=A1draig Brady wrote: > On 11/07/2011 10:27 PM, Linda Walsh wrote: >> >> >> I'd like to request an RFE for the groups command to add 2 switches: >> >> -1 - print groups in 1 column (cf. ls -1) >> -0 - print groups followed by null (cf. find et al) >> >> reasons: have groups with spaces in them. >> provide ultimate safety/futureproof with -0 >> >> ?? >> reasonable? > > Hmm. I suppose by extension that `id -Gn` should accept -1 too. > But do you really want to support group names with spaces? > `groupadd` for example won't allow this. > I suppose integration with LDAP etc. might get arbitrary group names. ---- I already have groups and usernames with spaces in them. Just try merging/supporting a Windows environment via linux. I EVEN have usernames with "\" in them!... Was required for 'ssh' to work...since when I'm validated as 'user' via=20 samba, when I 'ssh' in from a domain workstation, it comes in as user=20 "Domain\user". I just added an extra PW entry for Domain\me, same as "me", and it works.= .. Fortunately most core utils are mostly agnostic towards these things...=20 it's when you get to talking to people who who tell you that spaces and=20 backslashes don't belong there cuz God didn't intend it, that you get int= o 'religious' discussions'.... Anything other a a null (or colon) should be fair game for user/groupname= s=20 -- I'd feel uncomfortable about control chars, but hey. no reason=20 *technically*, why they should be disallowed (policy is separate from=20 technical implementation! ;-)). NT does Unix 1 better -- they alway use a count for strings. So even=20 'nulls' are ok... though windows, like linux uses null-terminated strings. This leads to interesting hacks in windows where NT-progs can create=20 reg-entries and files that Windows progs can't touch/see due to embedded=20 nulls. Might lead to some interesting file portability probs for NT files create= d=20 with an NT inteface, say on an NTFS file system (dunno about FAT), that=20 linux couldn't see -- might even be a way for NT to hide stuff from=20 linux...especially since linux supports NTFS and FAT...probably not an issue in FAT. I'm unsure about NTFS though as it uses the same naming rules as the registry, I don't see why it wouldn't have the same "gotcha's". I do know it's a prob in the registry...various vendors like= =20 to hide registration data with embedded nulls in them so they can't be=20 touched by normal user processes (ms-sysinternals/regdelnull tool will=20 wipe them...but not make them readable...would rather it change the nulls= =20 to spaces or such...)... > > Note POSIX is quite specific about the output format for `id`: --- Which posix? there are about 3-4 different versions. They are NOT compatible. I.e. a shell script written against the 1988=20 (1990?) spec won't necessarily work against the 2008 spec....etc. So you can put alot of stock in POSIX, but you better specify which POSI= X=20 you are talking about ... as for me, as soon as POSIX became incompatible with POSIX, i realized, that they'd "lost the way".... ;-) > > "=E2=88=92G Output all different group IDs (effective, real, and suppl= ementary)=20 only, using the > format "%u\n". If there is more than one distinct group affiliation,=20 output each > such affiliation, using the format " %u", before the is outp= ut." Um... I don't think the same problem would exist in put out 'uid'/rid'=20 which are 32-bit unsigned integers, vs. 'UTF-8 encoded strings' for user=20 names...... Two different problem spaces... I mean you *could* add those options for numeric output, but, personally,= =20 I don't think that would be a logical step. From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: RFE: 'groups' command ADD command switches "-0", and "-1" Resent-From: "Linda A. Walsh" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 08 Nov 2011 02:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.132071807632279 (code B ref 9987); Tue, 08 Nov 2011 02:08:02 +0000 Received: (at 9987) by debbugs.gnu.org; 8 Nov 2011 02:07:56 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RNb6R-0008Oa-MT for submit@debbugs.gnu.org; Mon, 07 Nov 2011 21:07:55 -0500 Received: from ishtar.tlinx.org ([173.164.175.65] helo=Ishtar.sc.tlinx.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RNb6L-0008OO-Qq for 9987@debbugs.gnu.org; Mon, 07 Nov 2011 21:07:53 -0500 Received: from [192.168.3.12] (Athenae [192.168.3.12]) by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id pA824pr2011174; Mon, 7 Nov 2011 18:04:53 -0800 Message-ID: <4EB88E43.40100@tlinx.org> Date: Mon, 07 Nov 2011 18:04:51 -0800 From: "Linda A. Walsh" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666 MIME-Version: 1.0 References: <4EB85B66.70508@tlinx.org> <4EB8773A.5000604@draigBrady.com> In-Reply-To: <4EB8773A.5000604@draigBrady.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by Ishtar.sc.tlinx.org id pA824pr2011174 X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) P=C3=A1draig Brady wrote: > Hmm. I suppose by extension that `id -Gn` should accept -1 too. > But do you really want to support group names with spaces? > `groupadd` for example won't allow this. > I suppose integration with LDAP etc. might get arbitrary group names. ... i.e. some don't have names (thanks samba/winbind!)... Some map to BUILTIN\xxxx Since I'm logged into the Domain Controller, I wouldn't expect to see the= =20 Domainname, FWIW, when I type in 'id', I get: > id uid=3D5001(lindaw) gid=3D201(lwgroup)=20 groups=3D201(lgroup),0(root),5(tty),6(disk),8(mail), 10(wheel),12(games),14(uucp),16(dialout),17(audio),18(SYSGROUP), 20(cdrom),30(wwwrun),31(squid),42(trusted),44(named),76(ldap),100(backup)= ,132(spamd), 133(video),200(unix_users),202(home),203(private),204(powerd),212(mailadm= in),213(devel), 215(lighttpd),225(yard),231(Juno),232(scan),237(cronusers),238(atusers),2= 60(torrent), 512(Domain Admins),513(Domain Users),517(Cert Publishers), 518(Schema Admins),519(Enterprise Admins),544(Administrators), 545(Users),547(Power Users),548(Account Operators), 551(Backup Operators),555(Remote Desktop Users), 558(Performance Monitor Users), 5001(lindaw),10001,10002,10003,10004,10005,10006,10007, 10008,10010,10011,10012,10013,10014,10015,10016,10017,10018, 10019,10020,10021,10022,10023,10024,10025,10026,10027,10028, 10029,10030,10031,10032,10046,10051(BUILTIN\administrators), 10052(BUILTIN\users),10060,20001(media), 50001(samba),50002(Trusted Local Net Users), 50003(CPAN) ---- But on my Windows 7 workstation, under cygwin, I type in 'id' and I see: uid=3D90026(Bliss\lindaw) gid=3D71008(Bliss\lwgroup)=20 groups=3D71008(Bliss\lwgroup),0(root),544(Administrators), 555(Remote Desktop Users),545(Users),1005(lwgroup), 11023(Bliss\torrent),11017(Bliss\media), 60002(Bliss\Trusted Local Net Users), 10512(Bliss\Domain Admins),11039(Bliss\Unix Group root) (none of the local groups are mapped over, but some of the the groups are= =20 'domain group' and get mapped over...)... See and there's that 'Bliss\lindaw', on cygwin, that I had to deal with o= n=20 linux... Of course, another problem Samba causes is it mangles the case names, --=20 windows partly cares and linux/unix REALLY cares.... I've tried to get them to change that, but they pretty much threw up there hands and said=20 'too big a bug to fix...break it down into small pieces for us'... (since it involves user names, groupnames, domain names, hostnames, etc... Windows is case preserving but ignoring, vs. samba is case mangling (uppe= r=20 or lower depending on what it 'thinks' it is, which is great, since user=20 and host names get mangled in opposite directions, but hostnames have to=20 be registered as usernames ...Of course you have "nimnils" like me, who are silly enough to use 'Upper and Lower case...and boy ... it *USED* to work for years...but that was before ...about 6 months ago...I think they= =20 either changed something in samba, in windows or both... Have seen more than one notation on the internet about how MS has done=20 things to break samba compatibility over the years...Now they are both allowing mixed case, and in some cases treating it differently... My workstation is listed as belonging to workgroup 'BLISS', but domain 'Bliss' (my domain name took it's name from the initial XP background=20 (bliss.jpg/bliss.scr)...green grass blue sky...)...It was meant as=20 'irony..'Bliss...& windows...'...oi! -------------------------- Using a somewhat reverse mode of attack,in the Music-labeling space, MS=20 media player is refusing to play any songs labeled in UTF-8...has to be=20 UTF-16 (which is also illegal, but gets by because it's too hard to tell=20 from USC-2) which is what is allowed).... So there they are shutting out products that don't conform to their standard (of course interestingly th= e=20 id3v2.org folks are well padded with MS-centric standards and lingo... Gee..I wonder who sponsors them... From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 30 06:18:32 2012 Received: (at control) by debbugs.gnu.org; 30 Jul 2012 10:18:32 +0000 Received: from localhost ([127.0.0.1]:50119 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Svn3W-0002Dv-Tk for submit@debbugs.gnu.org; Mon, 30 Jul 2012 06:18:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56545) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Svn3V-0002Dm-1P for control@debbugs.gnu.org; Mon, 30 Jul 2012 06:18:29 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6UABFUC003827 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 30 Jul 2012 06:11:15 -0400 Received: from [10.36.116.72] (ovpn-116-72.ams2.redhat.com [10.36.116.72]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q6UABCDQ026789 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Mon, 30 Jul 2012 06:11:14 -0400 Message-ID: <50165DC0.9030109@draigBrady.com> Date: Mon, 30 Jul 2012 11:11:12 +0100 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 MIME-Version: 1.0 To: control@debbugs.gnu.org Subject: bug#12083: bug in groups command -- doesn't quote usage of group-separator in groupnames X-Enigmail-Version: 1.3.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) forcemerge 12083 9987 stop From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: [PATCH] id, groups: optionally delimit output with null or newline Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 28 May 2013 10:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Ondrej Oprala Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.136973772725043 (code B ref 9987); Tue, 28 May 2013 10:43:02 +0000 Received: (at 9987) by debbugs.gnu.org; 28 May 2013 10:42:07 +0000 Received: from localhost ([127.0.0.1]:37296 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UhHLy-0006Vq-Cm for submit@debbugs.gnu.org; Tue, 28 May 2013 06:42:06 -0400 Received: from mail3.vodafone.ie ([213.233.128.45]:63990) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UhHLt-0006Uw-6g; Tue, 28 May 2013 06:42:03 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnYDAN+IpFFtTJ4j/2dsb2JhbAANTIM4wg4DAYEagxcBAQEDAQECLwFGBQsLDQEKCRYPCQMCAQIBFi8GDQEHAQGIAxKqA5Fujj5fB4NUA5R3g22FGI4P Received: from unknown (HELO [192.168.1.79]) ([109.76.158.35]) by mail3.vodafone.ie with ESMTP; 28 May 2013 11:40:36 +0100 Message-ID: <51A489A4.3000907@draigBrady.com> Date: Tue, 28 May 2013 11:40:36 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 References: <51A4746D.4010001@redhat.com> In-Reply-To: <51A4746D.4010001@redhat.com> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.8 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) unarchive 9987 stop On 05/28/2013 10:10 AM, Ondrej Oprala wrote: > Hi, > I'd like to propose a patch based on http://lists.gnu.org/archive/html/bug-coreutils/2011-11/msg00024.html . > The -{0,1} option is only enabled for some option combinations (as discussed in above link) > although I have some doubts about the usefulness of groups -0|-1 without any other arguments; > on the other hand, changing the delims for the "USERNAME_1: group_1...group_n" output is IMHO very weird. > However, maybe we could only print the "USERNAME: " part if more than one username is specified as an argument. > Or does "id USERNAME -Gn" suffice in this case? What do you think? Thanks for following this up. > diff --git a/src/groups.c b/src/groups.c > index 53332d5..8f5a714 100644 > if (optind == argc) > { > } > else > { > + if (nullterm || one_per_line) > + error (EXIT_FAILURE, 0, _("delimiter modififers cannot be " > + "combined with other arguments")); So what you're saying here is that when groups(1) goes into its alternate display mode when multiple users are specified, then discount specified delimiters in this case. I'd concur with that, since this mode would mainly be for human rather than programmatic consumption. So all we have to consider is `groups [$USER]` and 'id -Gn`. I notice that groups goes into "$user: $group1...$groupn" mode even if a single user is specified. I notice solaris or FreeBSD do not do that. As part of this as a separate patch, I'd be inclined to behave like solaris/BSD here so that programmatic access to groups for all users would be improved. As for which of -01z to use. Do we really need -1? That could be trivially achieved with tr '\0' '\n' Given that this is to aid programmatic access to group names, I'd be inclined to not support -1 As for -0 vs -z: -0, --null: du, env, printenv -z, --zero: basename, dirname, join, sort, uniq, readlink, realpath, shuf So for consistency I'd use -z, --zero (adding the long option too). thanks, Pádraig. From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: [PATCH] groups,id: add -0, --null option Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 02 Sep 2013 14:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Bernhard Voelker Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.137813061231674 (code B ref 9987); Mon, 02 Sep 2013 14:04:02 +0000 Received: (at 9987) by debbugs.gnu.org; 2 Sep 2013 14:03:32 +0000 Received: from localhost ([127.0.0.1]:37530 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VGUj5-0008Em-2Z for submit@debbugs.gnu.org; Mon, 02 Sep 2013 10:03:31 -0400 Received: from mail2.vodafone.ie ([213.233.128.44]:60401) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VGUj2-0008ES-0D; Mon, 02 Sep 2013 10:03:29 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArMBADqZJFJtTvvE/2dsb2JhbAANTYM8S4JmvgaBPYMYAQEBAwEBAiQLAUYQCw0BCgkWDwkDAgECARYvBg0BBwEBBYdzDQWmLpJrj38HhB0DlSyDeIUkhWeITQ Received: from unknown (HELO [192.168.1.79]) ([109.78.251.196]) by mail2.vodafone.ie with ESMTP; 02 Sep 2013 15:03:21 +0100 Message-ID: <52249AA8.8040202@draigBrady.com> Date: Mon, 02 Sep 2013 15:03:20 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 References: <5223B306.2080500@bernhard-voelker.de> In-Reply-To: <5223B306.2080500@bernhard-voelker.de> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.6 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.6 (/) unarchive 9987 stop On 09/01/2013 10:35 PM, Bernhard Voelker wrote: > The attached patch implements the -0,--null option for groups(1) > and id(1) as discussed in > > http://bugs.gnu.org/9987 bug CC'd > > and > > http://lists.gnu.org/archive/html/bug-coreutils/2011-11/msg00024.html > > and as mentioned on Padraig's TODO list: > > http://www.pixelbeat.org/patches/coreutils/inbox_apr_2013.html > TODO --> "group -0 to support group names with spaces etc." I'd not updated the TODO, but the details in 9987 above suggested that -z, --zero would be better since most tools use that. Also mentioned there was only honoring -z when the groups for a single user were being output. I.E. no double NUL stuff. But I'm not against the double NUL approach really. It would be good I think to have a separate patch though that aligned with other systems and didn't output the "user:" at the start of the line when only a single user is specified. thanks, Pádraig. From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: [PATCH] groups,id: add -0, --null option Resent-From: Bernhard Voelker Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 03 Sep 2013 06:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.13781901433145 (code B ref 9987); Tue, 03 Sep 2013 06:36:01 +0000 Received: (at 9987) by debbugs.gnu.org; 3 Sep 2013 06:35:43 +0000 Received: from localhost ([127.0.0.1]:38374 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VGkDG-0000oe-Dc for submit@debbugs.gnu.org; Tue, 03 Sep 2013 02:35:42 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:65218) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VGkD9-0000oF-SH for 9987@debbugs.gnu.org; Tue, 03 Sep 2013 02:35:39 -0400 Received: from [192.168.1.11] (p57A5C8E3.dip0.t-ipconnect.de [87.165.200.227]) by mrelayeu.kundenserver.de (node=mrbap4) with ESMTP (Nemesis) id 0M89Pl-1WBc7E1cgL-00vge3; Tue, 03 Sep 2013 08:35:29 +0200 Message-ID: <52258330.1070504@bernhard-voelker.de> Date: Tue, 03 Sep 2013 08:35:28 +0200 From: Bernhard Voelker User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 References: <5223B306.2080500@bernhard-voelker.de> <52249AA8.8040202@draigBrady.com> In-Reply-To: <52249AA8.8040202@draigBrady.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:CqaG7Dr1XgCVUdC0C91sWZyQMaKK49I3tixzk3J+NZe 8DBVuV8lyaZUPMrkR/u9NSyGDEg+7s9TGm76vB8MjidwV/yBpZ xSybHd4GgLvLavt9tcfidRo7UuW+yg2noMYJvgE5a4v/EinRVp hu9APMbZJ8oyy2oYNO/J19YgHysxpuKUMp37SalpqQFa1V9xz+ jNbj/psEhw/6cHfq4u4ag9qhiQX52sT2Bh02JTXInQ0LfdBSZK 4slpDWMfPZBg9NtjEtkUB/f09wE2FXpYLhbxmr/VsBw/SG6fQX j8A5MKpexFtERwafgEjRxxfKO/OPn3iO/ZxZPotPQI3w4AxZFy EkZQUA6BQDeF1DUhhXBlqauiVwMh2p4TX0Ua9E1rf X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) On 09/02/2013 04:03 PM, Pádraig Brady wrote: > I'd not updated the TODO, but the details in 9987 above > suggested that -z, --zero would be better since most tools use that. I'd personally prefer -0 because burning the -z short option may be problematic for future extensions while the only use of the -0 option in any program is "separate output by NULs". But I'm game if you prefer -z. > Also mentioned there was only honoring -z when the groups for > a single user were being output. I.E. no double NUL stuff. > But I'm not against the double NUL approach really. thanks, then I'll keep it. > It would be good I think to have a separate patch though > that aligned with other systems and didn't output the > "user:" at the start of the line when only a single user is specified. Interestingly, groups(1) doesn't seem to be specified by the OpenGroup documents, only id(1): http://pubs.opengroup.org/onlinepubs/9699919799/utilities/id.html Is there any other resource? But I agree, outputting the "user:" prefix for only one argument seems to be silly. Thanks! Have a nice day, Berny From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: [PATCH] groups,id: add -0, --null option Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 16 Sep 2013 00:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Bernhard Voelker Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.13792907183697 (code B ref 9987); Mon, 16 Sep 2013 00:19:01 +0000 Received: (at 9987) by debbugs.gnu.org; 16 Sep 2013 00:18:38 +0000 Received: from localhost ([127.0.0.1]:39502 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLMWU-0000xZ-6o for submit@debbugs.gnu.org; Sun, 15 Sep 2013 20:18:38 -0400 Received: from mail3.vodafone.ie ([213.233.128.45]:4116) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLMWR-0000xD-0P for 9987@debbugs.gnu.org; Sun, 15 Sep 2013 20:18:36 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApMBAFRNNlJtTqhZ/2dsb2JhbAANToM/wUeBMIMZAQEBAwEyAUYQCw0BCgkWDwkDAgECAUUGDQEHAQGHeRKnHZI0j3MHhB4DmSqFKI5C Received: from unknown (HELO [192.168.1.79]) ([109.78.168.89]) by mail3.vodafone.ie with ESMTP; 16 Sep 2013 01:18:28 +0100 Message-ID: <52364E54.9060508@draigBrady.com> Date: Mon, 16 Sep 2013 01:18:28 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 References: <5223B306.2080500@bernhard-voelker.de> <52249AA8.8040202@draigBrady.com> <52258330.1070504@bernhard-voelker.de> In-Reply-To: <52258330.1070504@bernhard-voelker.de> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 09/03/2013 07:35 AM, Bernhard Voelker wrote: > On 09/02/2013 04:03 PM, Pádraig Brady wrote: >> I'd not updated the TODO, but the details in 9987 above >> suggested that -z, --zero would be better since most tools use that. > > I'd personally prefer -0 because burning the -z short option may > be problematic for future extensions while the only use of > the -0 option in any program is "separate output by NULs". > But I'm game if you prefer -z. Yes please use -z, --zero for most consistency. Note also the -O0 display issue and --nul being more accurate than --null >> Also mentioned there was only honoring -z when the groups for >> a single user were being output. I.E. no double NUL stuff. >> But I'm not against the double NUL approach really. > > thanks, then I'll keep it. > >> It would be good I think to have a separate patch though >> that aligned with other systems and didn't output the >> "user:" at the start of the line when only a single user is specified. > > Interestingly, groups(1) doesn't seem to be specified by the > OpenGroup documents, only id(1): > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/id.html > Is there any other resource? > > But I agree, outputting the "user:" prefix for only one argument > seems to be silly. If you could handle that as a separate patch it would be great. thanks, Pádraig. From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: [PATCH] groups,id: add -0, --null option Resent-From: Bernhard Voelker Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 16 Sep 2013 05:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.13793100386964 (code B ref 9987); Mon, 16 Sep 2013 05:41:02 +0000 Received: (at 9987) by debbugs.gnu.org; 16 Sep 2013 05:40:38 +0000 Received: from localhost ([127.0.0.1]:39883 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLRY6-0001oG-4O for submit@debbugs.gnu.org; Mon, 16 Sep 2013 01:40:38 -0400 Received: from moutng.kundenserver.de ([212.227.17.10]:65192) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLRY3-0001ny-9z for 9987@debbugs.gnu.org; Mon, 16 Sep 2013 01:40:36 -0400 Received: from [192.168.1.11] (p5499D871.dip0.t-ipconnect.de [84.153.216.113]) by mrelayeu.kundenserver.de (node=mreu0) with ESMTP (Nemesis) id 0MWfUd-1VRqWl0Sjb-00XYXb; Mon, 16 Sep 2013 07:40:28 +0200 Message-ID: <523699CB.3070109@bernhard-voelker.de> Date: Mon, 16 Sep 2013 07:40:27 +0200 From: Bernhard Voelker User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 References: <5223B306.2080500@bernhard-voelker.de> <52249AA8.8040202@draigBrady.com> <52258330.1070504@bernhard-voelker.de> <52364E54.9060508@draigBrady.com> In-Reply-To: <52364E54.9060508@draigBrady.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:hASOUsy/P1gUJgqLTRhpRdjd/fdmFIBU+kZi7gWvsoS TKWJ5EivKGDqm1WUecsGfEbeXMKnUqKId57oJYFLsomKr1YrUF IfIg7XfqtDhKQ9ZapY4XzVGRwegXNm1VtGYAT0UwltPMWijneO yr94Pf5umXl4BTfyd/EcBUgtana0AkSoMjVbvyJn4+obCakOgx sW8bnhljXbllt3jk0vt0GbB9RTg/d1Qv6W6KFu2VWYfA0Dp6JM zaYMRDEsbSeRv05zD/U3QAZ+dhVluECzekoNv3yIyYHy/8iBhB PdMQ8BkFarXBf5SKfD0GOZ1MajzwLgGndpBbIJqHoGKjepBLnQ lEsWrUu+wuhTjjzlxlhtcpg6TaavkKyA2UCnDKYia X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) On 09/16/2013 02:18 AM, Pádraig Brady wrote: > Yes please use -z, --zero for most consistency. Ok, fine, thanks. >>> It would be good I think to have a separate patch though >>> that aligned with other systems and didn't output the >>> "user:" at the start of the line when only a single user is specified. > If you could handle that as a separate patch it would be great. I'll do, no problem. Thanks & have a nice day, Berny From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: [PATCH] groups,id: add -0, --null option Resent-From: Bernhard Voelker Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 16 Sep 2013 22:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.137937010923147 (code B ref 9987); Mon, 16 Sep 2013 22:22:01 +0000 Received: (at 9987) by debbugs.gnu.org; 16 Sep 2013 22:21:49 +0000 Received: from localhost ([127.0.0.1]:42047 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLhAx-00061F-8O for submit@debbugs.gnu.org; Mon, 16 Sep 2013 18:21:48 -0400 Received: from moutng.kundenserver.de ([212.227.126.171]:62291) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLhAs-00060y-Un for 9987@debbugs.gnu.org; Mon, 16 Sep 2013 18:21:44 -0400 Received: from [192.168.1.11] (p5499D871.dip0.t-ipconnect.de [84.153.216.113]) by mrelayeu.kundenserver.de (node=mreu4) with ESMTP (Nemesis) id 0Lc2Qz-1Vkc3Z0ItB-00jZoQ; Tue, 17 Sep 2013 00:21:36 +0200 Message-ID: <5237846F.3090002@bernhard-voelker.de> Date: Tue, 17 Sep 2013 00:21:35 +0200 From: Bernhard Voelker User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 References: <5223B306.2080500@bernhard-voelker.de> <52249AA8.8040202@draigBrady.com> <52258330.1070504@bernhard-voelker.de> <52364E54.9060508@draigBrady.com> <523699CB.3070109@bernhard-voelker.de> In-Reply-To: <523699CB.3070109@bernhard-voelker.de> Content-Type: multipart/mixed; boundary="------------060703060905020405090304" X-Provags-ID: V02:K0:WKNpSf2zFWhVnt881gtvuKLuTLMBbJuTiBtFAuF3cbH bSeot+f+rw1q0BIt6n9e44CxhEunpjfUy/cCSFUlrW7Zdmf23B RMoKJoZfLvzPt3suNLGi7DpK1YrLfBUETNpj20+8fdI1fy7PTC IP8AuR5Rdxq+WuIBzInSNqOft8HMdAmqC2buPWyTTnxf8N54P3 z3ONgH5fRee0Rq3KHsTaXUSunOj2QnRhbTCinVBeBwPqeQh922 qT0JkQh8Y8qhlLM27AOGQ444vHGYiyHXCkLnp/8qMgSjfMLcIz 99QJLCKcSCWVAXPj7j9Hn/++G3Dodbk7YaO5toHOibtxYBrOEQ DHB0mKc0tcg8Jgw+xwu6AAYId+PA7fITNlqU08pnV X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) This is a multi-part message in MIME format. --------------060703060905020405090304 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit On 09/16/2013 07:40 AM, Bernhard Voelker wrote: > On 09/16/2013 02:18 AM, Pádraig Brady wrote: >> Yes please use -z, --zero for most consistency. > > Ok, fine, thanks. Here comes the new patch with {groups,id} -z,--zero. Have a nice day, Berny --------------060703060905020405090304 Content-Type: text/x-patch; name="groups-id-zero.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="groups-id-zero.patch" >From b01d789b63e0c7721f308d4c292f17237f342d99 Mon Sep 17 00:00:00 2001 From: Bernhard Voelker Date: Tue, 17 Sep 2013 00:03:30 +0200 Subject: [PATCH] groups,id: add -z, --zero option * src/group-list.h (print_group_list): Add a parameter for the separator of type char. * src/group-list.c (print_group_list): Likewise, and use it instead of a white space character to separate the group entries. * src/groups.c (longopts): Add an array element for the new long option. (usage): Document the new options. (main): Define the bool flag opt_zero indicating the use of the new options. In the getopt_long loop, handle it. In the case without a given USERNAME argument, pass either a white space or a NUL character to print_group_list() - depending on the above flag. Only output the final newline character unless the --zero option has been specified. Likewise in the case with a given USERNAME and when the --zero option has been specified, plus output 2 NULs separating consecutive users. * src/id.c (longopts): Add array element for the new long option. (usage): Document the new options. While at it, fix the alignment of the descriptions to match that of HELP_OPTION_DESCRIPTION. (main): Define the bool flag opt_zero indicating the use of the new options. In the getopt_long loop, handle it. Output an error diagnostic in the case the --zero option has been specified together with the default format. In the case of -gG, pass either a NUL or a white space character to print_group_list() - depending on the above new flag. Only output the final newline character unless the --zero option has been specified. * doc/coreutils.texi (optZeroEntry): Add new macro describing the new options. (id invocation): Use the above new macro and mention that the new options are not permitted when using the default format. Move the @exitstatus macro down after @primaryAndSupplementaryGroups in order to be consistent with other info pages. (groups invocation): Instead of saying that the --help and --version options are the only ones, add a @ref to these common options and use the above new macro to explain the new options. Document the resulting output syntax for the cases without, with one and with more user names specified. Move @exitstatus down after @primaryAndSupplementaryGroups here, too. * tests/misc/groups-id-zero.sh: Add new test exercising the new options. * tests/local.mk (all_tests): Reference it. * NEWS (New features): Mention the new options. Fixes http://bugs.gnu.org/9987 --- NEWS | 3 + doc/coreutils.texi | 58 ++++++++++++++++++-- src/group-list.c | 6 +- src/group-list.h | 2 +- src/groups.c | 41 +++++++++++--- src/id.c | 37 +++++++++---- tests/local.mk | 1 + tests/misc/groups-id-zero.sh | 128 +++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 248 insertions(+), 28 deletions(-) create mode 100755 tests/misc/groups-id-zero.sh diff --git a/NEWS b/NEWS index d26722d..e8259eb 100644 --- a/NEWS +++ b/NEWS @@ -44,6 +44,9 @@ GNU coreutils NEWS -*- outline -*- du accepts a new option: --inodes to show the number of inodes instead of the blocks used. + groups and id accept a new option: --zero (-z) to separate the output + entries by a NUL instead of a white space character. + id and ls with -Z report the SMACK security context where available. mkdir, mkfifo and mknod with -Z set the SMACK context where available. diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 21216b4..2715a54 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -14473,7 +14473,28 @@ followed by the corresponding user or group name in parentheses. The options cause @command{id} to print only part of the above information. Also see @ref{Common options}. +@macro optZeroEntry{cmd} +@item -z +@opindex -z +@itemx --zero +@opindex --zero +@cindex output NUL-byte-terminated entries +Output a zero byte (ASCII NUL) to separate the entries, rather than a whitespace +character. Also elide the newline character at the end of the output. +This option enables other programs to parse the output of @command{\cmd\} +even when that output would contain data with embedded whitespaces. +@end macro + @table @samp +@optZeroEntry{id} +This option is not permitted when using the default format. + +Example: +@example +$ id -Gn --zero +users devs +@end example + @item -g @itemx --group @opindex -g @@ -14518,8 +14539,6 @@ set the exit status to 1. @end table -@exitstatus - @macro primaryAndSupplementaryGroups{cmd,arg} Primary and supplementary groups for a process are normally inherited from its parent and are usually unchanged since login. This means @@ -14530,6 +14549,8 @@ database to be consulted afresh, and so will give a different result. @end macro @primaryAndSupplementaryGroups{id,user argument} +@exitstatus + @node logname invocation @section @command{logname}: Print current login name @@ -14587,13 +14608,38 @@ groups [@var{username}]@dots{} The group lists are equivalent to the output of the command @samp{id -Gn}. -@primaryAndSupplementaryGroups{groups,list of users} +The program accepts the following options. Also see @ref{Common options}. -The only options are @option{--help} and @option{--version}. @xref{Common -options}. +@table @samp +@optZeroEntry{id} -@exitstatus +Example: +@example +$ groups -z +users devs +@end example + +When a @var{username} is specified, @command{groups} outputs a NUL byte after +the @var{username} instead of the colon (@samp{" : "}). + +@example +$ groups --zero matt +matt users +@end example + +When further @var{username}s are specified, then @command{groups} outputs +2 NUL bytes before continuing with the next user: +@example +$ groups john matt -z +john users devs +matt users +@end example +@end table + +@primaryAndSupplementaryGroups{groups,list of users} + +@exitstatus @node users invocation @section @command{users}: Print login names of users currently logged in diff --git a/src/group-list.c b/src/group-list.c index 7d4995b..a76ee00 100644 --- a/src/group-list.c +++ b/src/group-list.c @@ -35,7 +35,7 @@ extern bool print_group_list (const char *username, uid_t ruid, gid_t rgid, gid_t egid, - bool use_names) + bool use_names, char separator) { bool ok = true; struct passwd *pwd = NULL; @@ -52,7 +52,7 @@ print_group_list (const char *username, if (egid != rgid) { - putchar (' '); + putchar (separator); if (!print_group (egid, use_names)) ok = false; } @@ -79,7 +79,7 @@ print_group_list (const char *username, for (i = 0; i < n_groups; i++) if (groups[i] != rgid && groups[i] != egid) { - putchar (' '); + putchar (separator); if (!print_group (groups[i], use_names)) ok = false; } diff --git a/src/group-list.h b/src/group-list.h index 3fac887..573de1d 100644 --- a/src/group-list.h +++ b/src/group-list.h @@ -16,4 +16,4 @@ along with this program. If not, see . */ bool print_group (gid_t, bool); -bool print_group_list (const char *, uid_t, gid_t, gid_t, bool); +bool print_group_list (const char *, uid_t, gid_t, gid_t, bool, char); diff --git a/src/groups.c b/src/groups.c index 53332d5..653861e 100644 --- a/src/groups.c +++ b/src/groups.c @@ -38,6 +38,7 @@ static struct option const longopts[] = { + {"zero", no_argument, NULL, 'z'}, {GETOPT_HELP_OPTION_DECL}, {GETOPT_VERSION_OPTION_DECL}, {NULL, 0, NULL, 0} @@ -56,6 +57,9 @@ Print group memberships for each USERNAME or, if no USERNAME is specified, for\ \n\ the current process (which may differ if the groups database has changed).\n"), stdout); + fputs (_("\ + -z, --zero separate entries by a NUL, not whitespace\n\ +"), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout); emit_ancillary_info (); @@ -68,9 +72,11 @@ main (int argc, char **argv) { int optc; bool ok = true; + bool opt_zero = false; gid_t rgid, egid; uid_t ruid; + initialize_main (&argc, &argv); set_program_name (argv[0]); setlocale (LC_ALL, ""); @@ -82,10 +88,14 @@ main (int argc, char **argv) /* Processing the arguments this way makes groups.c behave differently to * groups.sh if one of the arguments is "--". */ - while ((optc = getopt_long (argc, argv, "", longopts, NULL)) != -1) + while ((optc = getopt_long (argc, argv, "z", longopts, NULL)) != -1) { switch (optc) { + case 'z': + opt_zero = true; + break; + case_GETOPT_HELP_CHAR; case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); default: @@ -114,13 +124,17 @@ main (int argc, char **argv) if (rgid == NO_GID && errno) error (EXIT_FAILURE, errno, _("cannot get real GID")); - if (!print_group_list (NULL, ruid, rgid, egid, true)) + if (!print_group_list (NULL, ruid, rgid, egid, true, + opt_zero ? '\0' : ' ')) ok = false; - putchar ('\n'); + + if (!opt_zero) + putchar ('\n'); } else { - /* At least one argument. Divulge the details of the specified users. */ + /* At least one argument. Divulge the details of the specified users. */ + int nusers = 0; while (optind < argc) { struct passwd *pwd = getpwnam (argv[optind]); @@ -129,10 +143,23 @@ main (int argc, char **argv) ruid = pwd->pw_uid; rgid = egid = pwd->pw_gid; - printf ("%s : ", argv[optind]); - if (!print_group_list (argv[optind++], ruid, rgid, egid, true)) + if (opt_zero) + { + /* Separate consecutive user output by two NULs. */ + if (nusers++) + printf ("%c%c", '\0', '\0'); + printf ("%s%c", argv[optind], '\0'); + } + else + { + printf ("%s : ", argv[optind]); + } + if (!print_group_list (argv[optind++], ruid, rgid, egid, true, + opt_zero ? '\0' : ' ')) ok = false; - putchar ('\n'); + + if (!opt_zero) + putchar ('\n'); } } diff --git a/src/id.c b/src/id.c index 3e7016f..7aa50e1 100644 --- a/src/id.c +++ b/src/id.c @@ -61,6 +61,7 @@ static security_context_t context = NULL; static struct option const longopts[] = { + {"zero", no_argument, NULL, 'z'}, {"context", no_argument, NULL, 'Z'}, {"group", no_argument, NULL, 'g'}, {"groups", no_argument, NULL, 'G'}, @@ -83,14 +84,18 @@ usage (int status) fputs (_("\ Print user and group information for the specified USERNAME,\n\ or (when USERNAME omitted) for the current user.\n\ -\n\ - -a ignore, for compatibility with other versions\n\ - -Z, --context print only the security context of 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\ - -r, --real print the real ID instead of the effective ID, with -ugG\n\ - -u, --user print only the effective user ID\n\ +\n"), + stdout); + fputs (_("\ + -a ignore, for compatibility with other versions\n\ + -Z, --context print only the security context of 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\ + -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 separate entries by a NUL, not whitespace;\n\ + not permitted in default format\n\ "), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout); @@ -109,6 +114,7 @@ main (int argc, char **argv) int optc; int selinux_enabled = (is_selinux_enabled () > 0); bool smack_enabled = is_smack_enabled (); + bool opt_zero = false; /* If true, output the list of all group IDs. -G */ bool just_group_list = false; @@ -127,7 +133,7 @@ main (int argc, char **argv) atexit (close_stdout); - while ((optc = getopt_long (argc, argv, "agnruGZ", longopts, NULL)) != -1) + while ((optc = getopt_long (argc, argv, "agnruzGZ", longopts, NULL)) != -1) { switch (optc) { @@ -162,6 +168,9 @@ main (int argc, char **argv) case 'u': just_user = true; break; + case 'z': + opt_zero = true; + break; case 'G': just_group_list = true; break; @@ -193,6 +202,10 @@ main (int argc, char **argv) error (EXIT_FAILURE, 0, _("cannot print only names or real IDs in default format")); + if (default_format && opt_zero) + error (EXIT_FAILURE, 0, + _("option --zero not permitted in default format")); + /* If we are on a SELinux/SMACK-enabled kernel, no user is specified, and either --context is specified or none of (-u,-g,-G) is specified, and we're not in POSIXLY_CORRECT mode, get our context. Otherwise, @@ -269,7 +282,8 @@ main (int argc, char **argv) } else if (just_group_list) { - if (!print_group_list (argv[optind], ruid, rgid, egid, use_name)) + if (!print_group_list (argv[optind], ruid, rgid, egid, use_name, + opt_zero ? '\0' : ' ')) ok = false; } else if (just_context) @@ -280,7 +294,8 @@ main (int argc, char **argv) { print_full_info (argv[optind]); } - putchar ('\n'); + if (default_format || !opt_zero) + putchar ('\n'); exit (ok ? EXIT_SUCCESS : EXIT_FAILURE); } diff --git a/tests/local.mk b/tests/local.mk index b00ff59..42cca9b 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -271,6 +271,7 @@ all_tests = \ tests/misc/false-status.sh \ tests/misc/fold.pl \ tests/misc/groups-dash.sh \ + tests/misc/groups-id-zero.sh \ tests/misc/groups-version.sh \ tests/misc/head-c.sh \ tests/misc/head-pos.sh \ diff --git a/tests/misc/groups-id-zero.sh b/tests/misc/groups-id-zero.sh new file mode 100755 index 0000000..0f9a101 --- /dev/null +++ b/tests/misc/groups-id-zero.sh @@ -0,0 +1,128 @@ +#!/bin/sh +# Exercise "groups --zero" and "id --zero". + +# Copyright (C) 2013 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src +print_ver_ groups id +require_perl_ + +# +# Converting back null-separated output of id(1) / groups(1) without a USERNAME. +# Format: group1 group2 group3 +# Result: group1 group2 group3 +# Just replace all NULs by whitespace (SP) and terminate with a newline (NL). +# +cat <<\EOF > conv-basic || framework_failure_ +$_ = <>; +s/\0/ /g; +print $_ . "\n"; +EOF + +# +# Converting back null-separated output of groups(1) with USERNAME(s). +# Format: +# user1 group1 user2 group2 group3 +# Result: +# user1 : group1 user2 : group2 group3 +# Split up records by double-NUL, then +# split up the line by a single NUL into USERNAME and the list of group IDs, +# and then print each group - separated by a whitespace; +# Terminate a record with a newline. +# +cat <<\EOF > conv-w-user || framework_failure_ +foreach (split ("\0\0", <>, -1)) + { + my ($user, @groups) = split ("\0"); + print $user . " :"; + for (@groups) + { + print " " . $_; + } + print "\n"; + } +EOF + +u="$( id -nu )" +groups "$u" > exp || fail=1 + +# For the bulk test below, verify that xargs works and create a list of users. +echo "$u" | xargs groups >out 2>err \ + && compare exp out \ + && compare /dev/null err \ + && getent passwd | cut -d: -f1 > users \ + && [ $(wc -l < users) -gt 0 ] \ + && runbulk=1 \ + || runbulk=0 + +# Exercise "group -z", i.e. without a USERNAME. +groups > exp || fail=1 +groups --zero > out || fail=1 +$PERL conv-basic out > out2 || framework_failure_ +compare exp out2 || fail=1 + +# Exercise "group -z user1". +groups "$u" > exp || fail=1 +groups -z "$u" > out || fail=1 +$PERL conv-w-user out > out2 || framework_failure_ +compare exp out2 || fail=1 + +if [ "$u" != "root" ] && groups "root" >/dev/null +then + # Exercise another user name ... + groups "root" > exp || fail=1 + groups --zero "root" > out || fail=1 + $PERL conv-w-user out > out2 || framework_failure_ + compare exp out2 || fail=1 + + # ... and both together. + groups "$u" "root" > exp || fail=1 + groups --zero "$u" "root" > out || fail=1 + $PERL conv-w-user out > out2 || framework_failure_ + compare exp out2 || fail=1 +else + # Fall back to using the same user name twice. + groups "$u" "$u" > exp || fail=1 + groups --zero "$u" "$u" > out || fail=1 + $PERL conv-w-user out > out2 || framework_failure_ + compare exp out2 || fail=1 +fi + +# Exercise bulk "group -z user1 user2 ...", if possible. +if [ $runbulk = 1 ] ; then + xargs groups exp || fail=1 + xargs groups -z out || fail=1 + $PERL conv-w-user out > out2 || framework_failure_ + compare exp out2 || fail=1 +fi + +# id(1) should refuse --zero in default format. +id --zero > exp 2>err && fail=1 +grep 'option --zero not permitted in default format' err || fail=1 + +# Exercise "id -z" with various options. +for o in g gr G Gr u ur ; do + for n in "" n ; do + for a in "" $u root ; do + id -${o}${n} $a > exp || fail=1 + id -${o}${n}z $a > out || fail=1 + $PERL conv-basic out > out2 || framework_failure_ + compare exp out2 || fail=1 + done + done +done + +Exit $fail -- 1.8.3.1 --------------060703060905020405090304-- From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: [PATCH] groups,id: add -0, --null option Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 16 Sep 2013 23:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Bernhard Voelker Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.137937359428690 (code B ref 9987); Mon, 16 Sep 2013 23:20:02 +0000 Received: (at 9987) by debbugs.gnu.org; 16 Sep 2013 23:19:54 +0000 Received: from localhost ([127.0.0.1]:42148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLi5C-0007Sg-17 for submit@debbugs.gnu.org; Mon, 16 Sep 2013 19:19:54 -0400 Received: from mail2.vodafone.ie ([213.233.128.44]:23260) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLi59-0007SO-PB for 9987@debbugs.gnu.org; Mon, 16 Sep 2013 19:19:52 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApMBABGRN1JtTvrS/2dsb2JhbAANTsIbgnuBNYMZAQEBBDIBRhALDQEKCRYPCQMCAQIBRQYNAQcBAa9OkwuPcweEHgOeUo5C Received: from unknown (HELO [192.168.1.79]) ([109.78.250.210]) by mail2.vodafone.ie with ESMTP; 17 Sep 2013 00:19:45 +0100 Message-ID: <52379210.4030902@draigBrady.com> Date: Tue, 17 Sep 2013 00:19:44 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 References: <5223B306.2080500@bernhard-voelker.de> <52249AA8.8040202@draigBrady.com> <52258330.1070504@bernhard-voelker.de> <52364E54.9060508@draigBrady.com> <523699CB.3070109@bernhard-voelker.de> <5237846F.3090002@bernhard-voelker.de> In-Reply-To: <5237846F.3090002@bernhard-voelker.de> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 09/16/2013 11:21 PM, Bernhard Voelker wrote: > On 09/16/2013 07:40 AM, Bernhard Voelker wrote: >> On 09/16/2013 02:18 AM, Pádraig Brady wrote: >>> Yes please use -z, --zero for most consistency. >> >> Ok, fine, thanks. > > Here comes the new patch with {groups,id} -z,--zero. > > Have a nice day, > Berny > Very nice. I can't find any issues with that at all. thanks! Pádraig. From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: [PATCH] groups,id: add -0, --null option Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 16 Sep 2013 23:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Bernhard Voelker Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.137937436929936 (code B ref 9987); Mon, 16 Sep 2013 23:33:01 +0000 Received: (at 9987) by debbugs.gnu.org; 16 Sep 2013 23:32:49 +0000 Received: from localhost ([127.0.0.1]:42154 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLiHh-0007ml-6G for submit@debbugs.gnu.org; Mon, 16 Sep 2013 19:32:49 -0400 Received: from mail2.vodafone.ie ([213.233.128.44]:41451) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLiHf-0007mW-0O for 9987@debbugs.gnu.org; Mon, 16 Sep 2013 19:32:47 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApMBAIaUN1JtTvrS/2dsb2JhbAANTsIbgnuBNYMZAQEBBDIBRhALDQEKCRYPCQMCAQIBRQYNAQcBAa9UkwuPcweEHgOeUo5C Received: from unknown (HELO [192.168.1.79]) ([109.78.250.210]) by mail2.vodafone.ie with ESMTP; 17 Sep 2013 00:32:41 +0100 Message-ID: <52379518.5040204@draigBrady.com> Date: Tue, 17 Sep 2013 00:32:40 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 References: <5223B306.2080500@bernhard-voelker.de> <52249AA8.8040202@draigBrady.com> <52258330.1070504@bernhard-voelker.de> <52364E54.9060508@draigBrady.com> <523699CB.3070109@bernhard-voelker.de> <5237846F.3090002@bernhard-voelker.de> <52379210.4030902@draigBrady.com> In-Reply-To: <52379210.4030902@draigBrady.com> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 09/17/2013 12:19 AM, Pádraig Brady wrote: > On 09/16/2013 11:21 PM, Bernhard Voelker wrote: >> On 09/16/2013 07:40 AM, Bernhard Voelker wrote: >>> On 09/16/2013 02:18 AM, Pádraig Brady wrote: >>>> Yes please use -z, --zero for most consistency. >>> >>> Ok, fine, thanks. >> >> Here comes the new patch with {groups,id} -z,--zero. >> >> Have a nice day, >> Berny >> > > Very nice. > I can't find any issues with that at all. Actually omitting the trailing \0 could be inconsistent and problematic? uniq and basename for example always output the trailing \0 $ basename -az 1/1 2/2 | od -Ax -tx1z -v 000000 31 00 32 00 >1.2.< 000004 $ printf "1\0002" | uniq -z | od -Ax -tx1z -v 000000 31 00 32 00 >1.2.< 000004 Also handling only separated output in shell can be awkward: # This is OK: $ groups | tr ' ' '\n' | while read group; do echo $group; done | wc -l 4 # This drops the last item $ groups -z | tr '\0' '\n' | while read group; do echo $group; done | wc -l 3 cheers, Pádraig. From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: [PATCH] groups,id: add -0, --null option Resent-From: Bernhard Voelker Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 17 Sep 2013 17:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.137943861015557 (code B ref 9987); Tue, 17 Sep 2013 17:24:02 +0000 Received: (at 9987) by debbugs.gnu.org; 17 Sep 2013 17:23:30 +0000 Received: from localhost ([127.0.0.1]:44435 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLyzp-00042q-UI for submit@debbugs.gnu.org; Tue, 17 Sep 2013 13:23:30 -0400 Received: from moutng.kundenserver.de ([212.227.17.10]:60415) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLyzm-00042b-SZ for 9987@debbugs.gnu.org; Tue, 17 Sep 2013 13:23:27 -0400 Received: from [192.168.1.11] (p5499D871.dip0.t-ipconnect.de [84.153.216.113]) by mrelayeu.kundenserver.de (node=mrbap4) with ESMTP (Nemesis) id 0LuLO3-1W5sYZ0ewx-011nHJ; Tue, 17 Sep 2013 19:23:20 +0200 Message-ID: <52389007.9050605@bernhard-voelker.de> Date: Tue, 17 Sep 2013 19:23:19 +0200 From: Bernhard Voelker User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 References: <5223B306.2080500@bernhard-voelker.de> <52249AA8.8040202@draigBrady.com> <52258330.1070504@bernhard-voelker.de> <52364E54.9060508@draigBrady.com> <523699CB.3070109@bernhard-voelker.de> <5237846F.3090002@bernhard-voelker.de> <52379210.4030902@draigBrady.com> <52379518.5040204@draigBrady.com> In-Reply-To: <52379518.5040204@draigBrady.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:Q5w94ofrBe79Z86f3MVBlcGCdjBy7nPXSCjrBAlpqCW V1P51eplKLZC2rUpToM8ijvFFBc56zjWvslbjAF+/okElcnTWO zyXNO77h/q6pYYzw/OVKBzErYajkzsPxHE4teBl8jsFJLXYuNx ijbaeUq745kwiH8Lgex5T3SWYlxdJPuqEdE/F8CViyHjKGbPs9 oFJmO+cNkvKB8AoLZYTeo7zCAhQ/Zdke6c7Ah4YoH9myuxm7Z7 L7own3ebWK60lkvbHbEXJDT6xatDdBZwhTRi1WZapryTVTPIAp q5O7rdUA5YOS4+1bjWlWc4ubHzUgMPwqhekewSJfKZ6ED3jCrs kDWXO0Al3bvGPqZOah0nw80LDSz52qaULc4A1Fq48 X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) On 09/17/2013 01:32 AM, Pádraig Brady wrote: > Actually omitting the trailing \0 could be > inconsistent and problematic? > > > uniq and basename for example always output the trailing \0 > > $ basename -az 1/1 2/2 | od -Ax -tx1z -v > 000000 31 00 32 00 >1.2.< > 000004 > > $ printf "1\0002" | uniq -z | od -Ax -tx1z -v > 000000 31 00 32 00 >1.2.< > 000004 > > > Also handling only separated output in shell can be awkward: > > # This is OK: > $ groups | tr ' ' '\n' | while read group; do echo $group; done | wc -l > 4 > > # This drops the last item > $ groups -z | tr '\0' '\n' | while read group; do echo $group; done | wc -l > 3 Good point. The changes in id.c and in groups.c are quite easy and make the changes smaller there. The bigger work is in the test. To avoid double work, I'll therefore prepare the other change first, i.e. removing the "USERNAME : " prefix in the output of groups in the case where only one argument was passed). Thanks & have a nice day, Berny From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: [PATCH] groups,id: add -0, --null option Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 18 Sep 2013 09:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Bernhard Voelker Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.137949742617170 (code B ref 9987); Wed, 18 Sep 2013 09:44:02 +0000 Received: (at 9987) by debbugs.gnu.org; 18 Sep 2013 09:43:46 +0000 Received: from localhost ([127.0.0.1]:45891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMEIU-0004Ss-4R for submit@debbugs.gnu.org; Wed, 18 Sep 2013 05:43:46 -0400 Received: from mail3.vodafone.ie ([213.233.128.45]:59460) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMEIS-0004Se-52 for 9987@debbugs.gnu.org; Wed, 18 Sep 2013 05:43:45 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApQBAAF1OVJtTPaB/2dsb2JhbAANTYM/wTJKgS6DGQEBAQMBMgFGBQsLDQEKCRYPCQMCAQIBRQYNAQcBAYd5EqcJkluPZweEHgOZKoUojkI Received: from unknown (HELO [192.168.1.79]) ([109.76.246.129]) by mail3.vodafone.ie with ESMTP; 18 Sep 2013 10:43:37 +0100 Message-ID: <523975C8.3000406@draigBrady.com> Date: Wed, 18 Sep 2013 10:43:36 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 References: <5223B306.2080500@bernhard-voelker.de> <52249AA8.8040202@draigBrady.com> <52258330.1070504@bernhard-voelker.de> <52364E54.9060508@draigBrady.com> In-Reply-To: <52364E54.9060508@draigBrady.com> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) tl;dr The is about being able to get a simple list of a particular user's groups by doing `groups user`. However it's probably best to not change the existing output format of `groups` for a single argument as we can just use `id` for this functionality. On 09/16/2013 01:18 AM, Pádraig Brady wrote: > On 09/03/2013 07:35 AM, Bernhard Voelker wrote: >> On 09/02/2013 04:03 PM, Pádraig Brady wrote: >>> It would be good I think to have a separate patch though >>> that aligned with other systems and didn't output the >>> "user:" at the start of the line when only a single user is specified. >> >> Interestingly, groups(1) doesn't seem to be specified by the >> OpenGroup documents, only id(1): >> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/id.html >> Is there any other resource? >> >> But I agree, outputting the "user:" prefix for only one argument >> seems to be silly. > > If you could handle that as a separate patch it would be great. On 09/17/2013 10:12 PM, Bernhard Voelker wrote: > Hi Padraig, > > you wrote that it would be good to do this to "align with other > systems". What systems do you refer to here? Solaris and BSD at least. GNU is the outlier here. > > After thinking about it, I don't have a good feeling about it: > a) such a change would possibly break existing scripts. > Okay, groups has never been intended to be used primarily > in scripts, but hey, we're planning to add --zero for that. That's a fair point, but even such scripts might be immune. If I wanted to process a list of user groups I would: for user in 'me' 'you'; do for group in $(groups $user | sed 's/.*: //'); do echo processing $user:$group done done The sed manipulation still works with the proposed change. > b) the new behavior would not be predictable anymore > in cases like > echo "$listofusers" | xargs groups > because xargs could exec a new groups process with just > one last argument left. This is a fair point and would break scripts that did: groups 'me' 'maybe_you' | while read user _sep groups; do for group in $groups; do echo processing $user:$group done done Drats so changing output format based on the number of inputs is quite problematic. We had the same tradeoff when adjusting basename to support multiple arguments. On FreeBSD you must pass -a to get basename to process 2 args: bsd$ basename 1 2 1 bsd$ basename 1 2 3 1 2 3 bsd$ basename -a 1 2 1 2 So we didn't mimic that behavior for the same reason, and required the -a option to process all args: GNU$ basename 1 2 3 basename: extra operand ‘3’ GNU$ basename -a 1 2 3 1 2 3 So how would we best select between the two output formats? I wonder could we first look for the $USER env variable, and if not empty, use getpwnam($USER) rather than getuid() etc. So then you could select the simple output format for a specific user like: USER=whatever groups I'm worried of some cases though where USER might not be accurate, and it's probably not portable (USERNAME and LOGNAME used elsewhere). So we're probably best use an option if we're going to change this at all. If we were to do that --user would probably be best. However we already have this functionality from `id -Gn` so it's not worth change `groups` to do this. I'll send a doc patch later for the groups command to summarize to use `id -Gn` for cases like this, and in general since it's more portable and POSIX standardized. thanks! Pádraig. From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: [PATCH] groups,id: add -0, --null option Resent-From: Bernhard Voelker Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 18 Sep 2013 18:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.137952999518573 (code B ref 9987); Wed, 18 Sep 2013 18:47:01 +0000 Received: (at 9987) by debbugs.gnu.org; 18 Sep 2013 18:46:35 +0000 Received: from localhost ([127.0.0.1]:47198 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMMln-0004pU-4U for submit@debbugs.gnu.org; Wed, 18 Sep 2013 14:46:35 -0400 Received: from moutng.kundenserver.de ([212.227.126.171]:54543) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMMlk-0004pC-Ux for 9987@debbugs.gnu.org; Wed, 18 Sep 2013 14:46:34 -0400 Received: from [192.168.1.11] (p5499D871.dip0.t-ipconnect.de [84.153.216.113]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0MSTdP-1VT9Dt0zEJ-00TY5n; Wed, 18 Sep 2013 20:46:26 +0200 Message-ID: <5239F501.9000707@bernhard-voelker.de> Date: Wed, 18 Sep 2013 20:46:25 +0200 From: Bernhard Voelker User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 References: <5223B306.2080500@bernhard-voelker.de> <52249AA8.8040202@draigBrady.com> <52258330.1070504@bernhard-voelker.de> <52364E54.9060508@draigBrady.com> <523975C8.3000406@draigBrady.com> In-Reply-To: <523975C8.3000406@draigBrady.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:Mh6bZW4tLlGy4M+qUBBiUgRHTtSBq5Gjp/ZJbnnzpuz WnHl4vbhDU4icwPDGrPUeJHvxSeYmNRYHDodsJ1PKa41C0uoF9 yKrko+JoefmN3zaAztawPUPrfAdRGju6kIhdZqs9sNdBWNO8nW 3R5le7rYdcU0LlvDTeRnKoXU2W0lQQz18QDvWEm+oA51cLGyOI sZNWjSedKW0dfVwhUH9H/nnq8rPYF2ljGPF2pMzIBJqLnvLllz OK03uZP2SuORlIfcK3RAw9a6m94+mStmoo2wpXJdhtWeFAwT7m TzDF/uiATxVRsh8vDzPbc1alPmlkW8ZH4WSXv1FiLs3W/ouo2y jsWLlntzze4kNZyh+kVrwrf1seiuXyNQ9nGHcq9UT X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) On 09/18/2013 11:43 AM, Pádraig Brady wrote: > However we already have this functionality from `id -Gn` so it's not > worth change `groups` to do this. Hi Padraig, thanks for confirming this - using groups(1) is already not enough portable among platforms. Regarding the main discussion point, i.e. adding --zero option: I see the following alternatives: a) add the -z option only to id.c leaving groups(1) untouched. b) add the -z option to id.c and groups.c, but don't allow it only if no USERNAME argument is given. c) add the -z option to id.c and groups.c for all cases (including the unusual "double NUL" separator between the output for consecutive user arguments). To reduce further incompatibilities, I'd vote for b), i.e. adding it to groups(1) only for the case where it has to compatible with "id -Gn". Other opinions? Have a nice day, Berny From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: [PATCH] groups,id: add -0, --null option Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 18 Sep 2013 19:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Bernhard Voelker Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.137953417625928 (code B ref 9987); Wed, 18 Sep 2013 19:57:02 +0000 Received: (at 9987) by debbugs.gnu.org; 18 Sep 2013 19:56:16 +0000 Received: from localhost ([127.0.0.1]:47314 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMNrD-0006k7-9w for submit@debbugs.gnu.org; Wed, 18 Sep 2013 15:56:15 -0400 Received: from mail3.vodafone.ie ([213.233.128.45]:23735) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMNrA-0006jq-PT for 9987@debbugs.gnu.org; Wed, 18 Sep 2013 15:56:13 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApMBAHsEOlJtTPaB/2dsb2JhbAANSAbCQIJ9gTKDGQEBAQMBMgFGBQsLDQEKCRYPCQMCAQIBRQYNAQcBAYd5pweTBo46gS0HhB4DnlKOQg Received: from unknown (HELO [192.168.1.79]) ([109.76.246.129]) by mail3.vodafone.ie with ESMTP; 18 Sep 2013 20:56:06 +0100 Message-ID: <523A0555.6050005@draigBrady.com> Date: Wed, 18 Sep 2013 20:56:05 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 References: <5223B306.2080500@bernhard-voelker.de> <52249AA8.8040202@draigBrady.com> <52258330.1070504@bernhard-voelker.de> <52364E54.9060508@draigBrady.com> <523975C8.3000406@draigBrady.com> <5239F501.9000707@bernhard-voelker.de> In-Reply-To: <5239F501.9000707@bernhard-voelker.de> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 09/18/2013 07:46 PM, Bernhard Voelker wrote: > On 09/18/2013 11:43 AM, Pádraig Brady wrote: >> However we already have this functionality from `id -Gn` so it's not >> worth change `groups` to do this. > > Hi Padraig, > > thanks for confirming this - using groups(1) is already not enough > portable among platforms. > > Regarding the main discussion point, i.e. adding --zero option: > I see the following alternatives: > a) add the -z option only to id.c leaving groups(1) untouched. > b) add the -z option to id.c and groups.c, but don't allow it > only if no USERNAME argument is given. s/don't// > c) add the -z option to id.c and groups.c for all cases (including > the unusual "double NUL" separator between the output for > consecutive user arguments). > > To reduce further incompatibilities, I'd vote for b), i.e. adding > it to groups(1) only for the case where it has to compatible with > "id -Gn". > > Other opinions? I'd vote for a) actually. That gives more incentive for people to use the standardised id(1). groups(1) has no options at present, so I'd leave it as is. thanks, Pádraig From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: [PATCH] groups,id: add -0, --null option Resent-From: Bernhard Voelker Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 18 Sep 2013 23:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.137954666313288 (code B ref 9987); Wed, 18 Sep 2013 23:25:01 +0000 Received: (at 9987) by debbugs.gnu.org; 18 Sep 2013 23:24:23 +0000 Received: from localhost ([127.0.0.1]:47627 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMR6Z-0003SD-5g for submit@debbugs.gnu.org; Wed, 18 Sep 2013 19:24:23 -0400 Received: from moutng.kundenserver.de ([212.227.17.8]:55756) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMR6W-0003Ry-Ru for 9987@debbugs.gnu.org; Wed, 18 Sep 2013 19:24:18 -0400 Received: from [192.168.1.11] (p5499D871.dip0.t-ipconnect.de [84.153.216.113]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0MGG19-1VA0NS3yMB-00Evej; Thu, 19 Sep 2013 01:24:10 +0200 Message-ID: <523A3618.6020709@bernhard-voelker.de> Date: Thu, 19 Sep 2013 01:24:08 +0200 From: Bernhard Voelker User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 References: <5223B306.2080500@bernhard-voelker.de> <52249AA8.8040202@draigBrady.com> <52258330.1070504@bernhard-voelker.de> <52364E54.9060508@draigBrady.com> <523975C8.3000406@draigBrady.com> <5239F501.9000707@bernhard-voelker.de> <523A0555.6050005@draigBrady.com> In-Reply-To: <523A0555.6050005@draigBrady.com> Content-Type: multipart/mixed; boundary="------------010609080907070103060700" X-Provags-ID: V02:K0:Dxsif58EshKOOQ6BsXdrLNlPdAwpg7/X9VSX9ExVCf2 b0ppfvvLIhdVVTHU/9K7MqwJ8YBFuEj7LhJLpmpbyWZIalH3Yi R4TBsSq+SorIMQSXM2+K+Xpt1j8jGf6XrBDvuJGM0flClnRaxc dJXMC80argXMqmyZmEDJDo3UuGdHiCHzxrYFvyJ05er/Rhbi6G +meggVKA2f6qtJcE+TEVYzKDC/nUIZniLET4GWoYu0xw17E5rJ z8/ZmrxQ/wFTPh1Zf2/WgL7RBnrKKk/iw/ukVBLbD8/tk8R036 NLpAC3KkJqmqVioJP/KEBoubp9JOr97qP3HZDircSVYy7GO2to +euug8hrSY6EIqbq2JVq5Nf2vPWwHmU4y45R8X0bh X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) This is a multi-part message in MIME format. --------------010609080907070103060700 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit On 09/18/2013 09:56 PM, Pádraig Brady wrote: > On 09/18/2013 07:46 PM, Bernhard Voelker wrote: >> a) add the -z option only to id.c leaving groups(1) untouched. > I'd vote for a) actually. Great, that makes the change much smaller. ;-) The patch is attached. Thanks & have a nice day, Berny --------------010609080907070103060700 Content-Type: text/x-patch; name="id-zero-option.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="id-zero-option.patch" >From f8ee96fbbd577b3d6eb2e2a072936b71cac2b959 Mon Sep 17 00:00:00 2001 From: Bernhard Voelker Date: Thu, 19 Sep 2013 01:23:00 +0200 Subject: [PATCH] id: add -z, --zero option * src/group-list.h (print_group_list): Add a parameter for the separator of type char. * src/group-list.c (print_group_list): Likewise, and use it instead of a white space character to separate the group entries. * src/groups.c (main): Pass white space character to print_group_list(). * src/id.c (longopts): Add array element for the new long option. (usage): Document the new option. While at it, fix the alignment of the descriptions to match that of HELP_OPTION_DESCRIPTION. (main): Define the bool flag opt_zero indicating the use of the new option. In the getopt_long loop, handle it. Output an error diagnostic in the case the --zero option has been specified together with the default format. In the case of -gG, pass either a NUL or a white space character to print_group_list() - depending on the above new flag. Likewise change the printing of the final newline character: output a NUL instead if the --zero option has been specified. * doc/coreutils.texi (id invocation): Document the new option. While at it, move the @exitstatus macro down after the macro @primaryAndSupplementaryGroups in order to be consistent with other info pages. (groups invocation): Move @exitstatus down after the macro @primaryAndSupplementaryGroups here, too. * tests/misc/id-zero.sh: Add new test exercising the new option. * tests/local.mk (all_tests): Reference it. * NEWS (New features): Mention the new option. Fixes http://bugs.gnu.org/9987 --- NEWS | 3 +++ doc/coreutils.texi | 22 +++++++++++++++----- src/group-list.c | 6 +++--- src/group-list.h | 2 +- src/groups.c | 6 +++--- src/id.c | 36 ++++++++++++++++++++++---------- tests/local.mk | 1 + tests/misc/id-zero.sh | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 110 insertions(+), 23 deletions(-) create mode 100755 tests/misc/id-zero.sh diff --git a/NEWS b/NEWS index d26722d..5891def 100644 --- a/NEWS +++ b/NEWS @@ -44,6 +44,9 @@ GNU coreutils NEWS -*- outline -*- du accepts a new option: --inodes to show the number of inodes instead of the blocks used. + id accepts a new option: --zero (-z) to separate the output entries by + a NUL instead of a white space character. + id and ls with -Z report the SMACK security context where available. mkdir, mkfifo and mknod with -Z set the SMACK context where available. diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 21216b4..327254b 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -14516,9 +14516,20 @@ Print only the security context of the current user. If SELinux is disabled then print a warning and set the exit status to 1. -@end table +@item -z +@itemx --zero +@opindex -z +@opindex --zero +Separate output items with NUL characters. +This option is not permitted when using the default format. -@exitstatus +Example: +@example +$ id -Gn --zero +users devs +@end example + +@end table @macro primaryAndSupplementaryGroups{cmd,arg} Primary and supplementary groups for a process are normally inherited @@ -14530,6 +14541,8 @@ database to be consulted afresh, and so will give a different result. @end macro @primaryAndSupplementaryGroups{id,user argument} +@exitstatus + @node logname invocation @section @command{logname}: Print current login name @@ -14587,13 +14600,12 @@ groups [@var{username}]@dots{} The group lists are equivalent to the output of the command @samp{id -Gn}. -@primaryAndSupplementaryGroups{groups,list of users} - The only options are @option{--help} and @option{--version}. @xref{Common options}. -@exitstatus +@primaryAndSupplementaryGroups{groups,list of users} +@exitstatus @node users invocation @section @command{users}: Print login names of users currently logged in diff --git a/src/group-list.c b/src/group-list.c index 7d4995b..a76ee00 100644 --- a/src/group-list.c +++ b/src/group-list.c @@ -35,7 +35,7 @@ extern bool print_group_list (const char *username, uid_t ruid, gid_t rgid, gid_t egid, - bool use_names) + bool use_names, char separator) { bool ok = true; struct passwd *pwd = NULL; @@ -52,7 +52,7 @@ print_group_list (const char *username, if (egid != rgid) { - putchar (' '); + putchar (separator); if (!print_group (egid, use_names)) ok = false; } @@ -79,7 +79,7 @@ print_group_list (const char *username, for (i = 0; i < n_groups; i++) if (groups[i] != rgid && groups[i] != egid) { - putchar (' '); + putchar (separator); if (!print_group (groups[i], use_names)) ok = false; } diff --git a/src/group-list.h b/src/group-list.h index 3fac887..573de1d 100644 --- a/src/group-list.h +++ b/src/group-list.h @@ -16,4 +16,4 @@ along with this program. If not, see . */ bool print_group (gid_t, bool); -bool print_group_list (const char *, uid_t, gid_t, gid_t, bool); +bool print_group_list (const char *, uid_t, gid_t, gid_t, bool, char); diff --git a/src/groups.c b/src/groups.c index 53332d5..d30c9fb 100644 --- a/src/groups.c +++ b/src/groups.c @@ -114,13 +114,13 @@ main (int argc, char **argv) if (rgid == NO_GID && errno) error (EXIT_FAILURE, errno, _("cannot get real GID")); - if (!print_group_list (NULL, ruid, rgid, egid, true)) + if (!print_group_list (NULL, ruid, rgid, egid, true, ' ')) ok = false; putchar ('\n'); } else { - /* At least one argument. Divulge the details of the specified users. */ + /* At least one argument. Divulge the details of the specified users. */ while (optind < argc) { struct passwd *pwd = getpwnam (argv[optind]); @@ -130,7 +130,7 @@ main (int argc, char **argv) rgid = egid = pwd->pw_gid; printf ("%s : ", argv[optind]); - if (!print_group_list (argv[optind++], ruid, rgid, egid, true)) + if (!print_group_list (argv[optind++], ruid, rgid, egid, true, ' ')) ok = false; putchar ('\n'); } diff --git a/src/id.c b/src/id.c index 3e7016f..587dd3b 100644 --- a/src/id.c +++ b/src/id.c @@ -61,6 +61,7 @@ static security_context_t context = NULL; static struct option const longopts[] = { + {"zero", no_argument, NULL, 'z'}, {"context", no_argument, NULL, 'Z'}, {"group", no_argument, NULL, 'g'}, {"groups", no_argument, NULL, 'G'}, @@ -83,14 +84,18 @@ usage (int status) fputs (_("\ Print user and group information for the specified USERNAME,\n\ or (when USERNAME omitted) for the current user.\n\ -\n\ - -a ignore, for compatibility with other versions\n\ - -Z, --context print only the security context of 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\ - -r, --real print the real ID instead of the effective ID, with -ugG\n\ - -u, --user print only the effective user ID\n\ +\n"), + stdout); + fputs (_("\ + -a ignore, for compatibility with other versions\n\ + -Z, --context print only the security context of 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\ + -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 separate entries by a NUL, not whitespace;\n\ + not permitted in default format\n\ "), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout); @@ -109,6 +114,7 @@ main (int argc, char **argv) int optc; int selinux_enabled = (is_selinux_enabled () > 0); bool smack_enabled = is_smack_enabled (); + bool opt_zero = false; /* If true, output the list of all group IDs. -G */ bool just_group_list = false; @@ -127,7 +133,7 @@ main (int argc, char **argv) atexit (close_stdout); - while ((optc = getopt_long (argc, argv, "agnruGZ", longopts, NULL)) != -1) + while ((optc = getopt_long (argc, argv, "agnruzGZ", longopts, NULL)) != -1) { switch (optc) { @@ -162,6 +168,9 @@ main (int argc, char **argv) case 'u': just_user = true; break; + case 'z': + opt_zero = true; + break; case 'G': just_group_list = true; break; @@ -193,6 +202,10 @@ main (int argc, char **argv) error (EXIT_FAILURE, 0, _("cannot print only names or real IDs in default format")); + if (default_format && opt_zero) + error (EXIT_FAILURE, 0, + _("option --zero not permitted in default format")); + /* If we are on a SELinux/SMACK-enabled kernel, no user is specified, and either --context is specified or none of (-u,-g,-G) is specified, and we're not in POSIXLY_CORRECT mode, get our context. Otherwise, @@ -269,7 +282,8 @@ main (int argc, char **argv) } else if (just_group_list) { - if (!print_group_list (argv[optind], ruid, rgid, egid, use_name)) + if (!print_group_list (argv[optind], ruid, rgid, egid, use_name, + opt_zero ? '\0' : ' ')) ok = false; } else if (just_context) @@ -280,7 +294,7 @@ main (int argc, char **argv) { print_full_info (argv[optind]); } - putchar ('\n'); + putchar (opt_zero ? '\0' : '\n'); exit (ok ? EXIT_SUCCESS : EXIT_FAILURE); } diff --git a/tests/local.mk b/tests/local.mk index b00ff59..8f76b23 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -277,6 +277,7 @@ all_tests = \ tests/misc/id-context.sh \ tests/misc/id-groups.sh \ tests/misc/id-setgid.sh \ + tests/misc/id-zero.sh \ tests/misc/md5sum.pl \ tests/misc/md5sum-bsd.sh \ tests/misc/md5sum-newline.pl \ diff --git a/tests/misc/id-zero.sh b/tests/misc/id-zero.sh new file mode 100755 index 0000000..15f6a53 --- /dev/null +++ b/tests/misc/id-zero.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# Exercise "id --zero". + +# Copyright (C) 2013 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src +print_ver_ id + +u="$( id -nu )" +id || fail=1 +id "$u" || fail=1 +id root || fail=1 + +# Create a nice list of users (ignoring errors) ... +getent passwd | head -n 100 | cut -d: -f1 > users +# ... and ensure it contains at least 'root', "$u", and an +# empty line for the tests without a user argument below. +printf "%s\n" root "$u" '' >> users || framework_failure_ + +# id(1) should refuse --zero in default format. +id --zero > out 2>err && fail=1 +compare /dev/null out || fail=1 +grep 'option --zero not permitted in default format' err || fail=1 + +# Exercise "id -z" with various options. +printf "\n" > exp || framework_failure_ +cp /dev/null out || framework_failure_ + +while read u ; do + for o in g gr G Gr u ur ; do + for n in "" n ; do + printf "%s: " "id -${o}${n}[z] $u" >> exp || framework_failure_ + printf "\n%s: " "id -${o}${n}[z] $u" >> out || framework_failure_ + id -${o}${n} $u >> exp || fail=1 + id -${o}${n}z $u > tmp || fail=1 + head -c-1 < tmp | tr '\0' ' ' >> out || framework_failure_ + done + done +done < users + +printf "\n" >> out || framework_failure_ +compare exp out || fail=1 + +Exit $fail -- 1.8.3.1 --------------010609080907070103060700-- From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: [PATCH] groups,id: add -0, --null option Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 19 Sep 2013 01:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Bernhard Voelker Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.137955429025238 (code B ref 9987); Thu, 19 Sep 2013 01:32:01 +0000 Received: (at 9987) by debbugs.gnu.org; 19 Sep 2013 01:31:30 +0000 Received: from localhost ([127.0.0.1]:47824 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMT5d-0006Yz-Qu for submit@debbugs.gnu.org; Wed, 18 Sep 2013 21:31:30 -0400 Received: from mail3.vodafone.ie ([213.233.128.45]:41957) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMT5a-0006Yi-Id for 9987@debbugs.gnu.org; Wed, 18 Sep 2013 21:31:27 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApMBAD5TOlJtTPaB/2dsb2JhbAANToM/wgCBOIMZAQEBAwEyAUYFCwsNAQoJFBEPAkYGDQEHAQEWh2OnNZMXj2cHhB4DnlKOQg Received: from unknown (HELO [192.168.1.79]) ([109.76.246.129]) by mail3.vodafone.ie with ESMTP; 19 Sep 2013 02:31:19 +0100 Message-ID: <523A53E6.40200@draigBrady.com> Date: Thu, 19 Sep 2013 02:31:18 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 References: <5223B306.2080500@bernhard-voelker.de> <52249AA8.8040202@draigBrady.com> <52258330.1070504@bernhard-voelker.de> <52364E54.9060508@draigBrady.com> <523975C8.3000406@draigBrady.com> <5239F501.9000707@bernhard-voelker.de> <523A0555.6050005@draigBrady.com> <523A3618.6020709@bernhard-voelker.de> In-Reply-To: <523A3618.6020709@bernhard-voelker.de> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 09/19/2013 12:24 AM, Bernhard Voelker wrote: > On 09/18/2013 09:56 PM, Pádraig Brady wrote: >> > On 09/18/2013 07:46 PM, Bernhard Voelker wrote: >>> >> a) add the -z option only to id.c leaving groups(1) untouched. >> > I'd vote for a) actually. > Great, that makes the change much smaller. ;-) > > The patch is attached. > diff --git a/NEWS b/NEWS > index d26722d..5891def 100644 > --- a/NEWS > +++ b/NEWS > @@ -44,6 +44,9 @@ GNU coreutils NEWS -*- outline -*- > du accepts a new option: --inodes to show the number of inodes instead > of the blocks used. > > + id accepts a new option: --zero (-z) to separate the output entries by > + a NUL instead of a white space character. s/separate/delimit/ > id and ls with -Z report the SMACK security context where available. > mkdir, mkfifo and mknod with -Z set the SMACK context where available. > > diff --git a/doc/coreutils.texi b/doc/coreutils.texi > index 21216b4..327254b 100644 > --- a/doc/coreutils.texi > +++ b/doc/coreutils.texi > @@ -14516,9 +14516,20 @@ Print only the security context of the current user. > If SELinux is disabled then print a warning and > set the exit status to 1. > > -@end table > +@item -z > +@itemx --zero > +@opindex -z > +@opindex --zero > +Separate output items with NUL characters. s/Separate/Delimit/ > +This option is not permitted when using the default format. > > -@exitstatus > +Example: > +@example > +$ id -Gn --zero > +users devs users devs > diff --git a/tests/misc/id-zero.sh b/tests/misc/id-zero.sh > +id root || fail=1 Is 'root' a guaranteed name? misc/chroot-credentials.sh since v7.4-16-gc45c51f assumes so. I'm still not convinced (and will look at addressing that separately). Do we even need to treat root specially. Can we just drop explicit root entry? > +# Create a nice list of users (ignoring errors) ... > +getent passwd | head -n 100 | cut -d: -f1 > users test -s users || skip_ 'Failed to read the passwd database with getent' Also why so many (100). The test is a bit slow and you would get the same coverage from a couple of entries? > +# ... and ensure it contains at least 'root', "$u", and an > +# empty line for the tests without a user argument below. > +printf "%s\n" root "$u" '' >> users || framework_failure_ > + > +# id(1) should refuse --zero in default format. > +id --zero > out 2>err && fail=1 > +compare /dev/null out || fail=1 > +grep 'option --zero not permitted in default format' err || fail=1 Better to: echo 'option ...' > exp-err compare exp-err err || fail=1 > + > +# Exercise "id -z" with various options. > +printf "\n" > exp || framework_failure_ Minor point, but it's better to use '' quotes when not interpolating, here and throughout the test. > +cp /dev/null out || framework_failure_ :> out thanks! Pádraig. From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: [PATCH] groups,id: add -0, --null option Resent-From: Bernhard Voelker Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 19 Sep 2013 07:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 9987@debbugs.gnu.org Reply-To: Bernhard Voelker Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.137957742029845 (code B ref 9987); Thu, 19 Sep 2013 07:57:01 +0000 Received: (at 9987) by debbugs.gnu.org; 19 Sep 2013 07:57:00 +0000 Received: from localhost ([127.0.0.1]:48239 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMZ6h-0007lI-0G for submit@debbugs.gnu.org; Thu, 19 Sep 2013 03:56:59 -0400 Received: from moutng.kundenserver.de ([212.227.17.10]:50503) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMZ6d-0007l2-6v for 9987@debbugs.gnu.org; Thu, 19 Sep 2013 03:56:56 -0400 Received: from oxbaltgw08.schlund.de (oxbaltgw08.schlund.de [172.19.246.14]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0MK3ZF-1VNw9N0yKz-00223f; Thu, 19 Sep 2013 09:56:48 +0200 Date: Thu, 19 Sep 2013 09:56:48 +0200 (CEST) From: Bernhard Voelker Message-ID: <1757849545.57259.1379577408394.open-xchange@email.1und1.de> In-Reply-To: <523A53E6.40200@draigBrady.com> References: <5223B306.2080500@bernhard-voelker.de> <52249AA8.8040202@draigBrady.com> <52258330.1070504@bernhard-voelker.de> <52364E54.9060508@draigBrady.com> <523975C8.3000406@draigBrady.com> <5239F501.9000707@bernhard-voelker.de> <523A0555.6050005@draigBrady.com> <523A3618.6020709@bernhard-voelker.de> <523A53E6.40200@draigBrady.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v7.2.2-Rev20 X-Provags-ID: V02:K0:b2umcDmqNsHAVlFYaaRlbVuIgAlxWe6+DFfPoqOgUvN MnH7bRoKKC/aDNoFH8QthNXDQ7ijq06QfXz7/ibqm2iKpLVstR gbY5e7QTbF8vSE9xXp0CGVtNcQcII2olgJY3sa8GW5Mi1ff4pV BZhP5iQOcL4G8JplutmfWSmimybYcqI+D6jCQQ/L/JqSjLX9uX VZ/HdxH0tJwTYFesi42GOHbSRQwLTBnx5ihMqzKj5bKUNVafc7 JwNkFwVhr98mfdDIqVXfuiljGJodIfYhwldT95NzFORaic8xH7 /k+rR3wlmvlzZfklF1KNoe7wUUFG4oVJcvopEet0YSNjxsUgxQ E+wLLHenTn3/ncHbUPhztjeXPSjqbBgSGg+SxYL8LdRWE0rsLj 0kbkfj2A3fu2UGYO+NoKnis9wZ2acHcORI= X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) >=C2=A0On=C2=A0September=C2=A019,=C2=A02013=C2=A0at=C2=A03:31=C2=A0AM=C2=A0= P=C3=A1draig=C2=A0Brady=C2=A0=C2=A0wrote: >=C2=A0 >=C2=A0On=C2=A009/19/2013=C2=A012:24=C2=A0AM,=C2=A0Bernhard=C2=A0Voelker=C2= =A0wrote: >=C2=A0>=C2=A0diff=C2=A0--git=C2=A0a/NEWS=C2=A0b/NEWS >=C2=A0>=C2=A0+=C2=A0=C2=A0id=C2=A0accepts=C2=A0a=C2=A0new=C2=A0option:=C2= =A0--zero=C2=A0(-z)=C2=A0to=C2=A0separate=C2=A0the=C2=A0output=C2=A0entries= =C2=A0by >=C2=A0>=C2=A0+=C2=A0=C2=A0a=C2=A0NUL=C2=A0instead=C2=A0of=C2=A0a=C2=A0whit= e=C2=A0space=C2=A0character. >=C2=A0 >=C2=A0s/separate/delimit/ done. >=C2=A0>=C2=A0diff=C2=A0--git=C2=A0a/doc/coreutils.texi=C2=A0b/doc/coreutil= s.texi >=C2=A0>=C2=A0+@item=C2=A0-z >=C2=A0>=C2=A0+@itemx=C2=A0--zero >=C2=A0>=C2=A0+@opindex=C2=A0-z >=C2=A0>=C2=A0+@opindex=C2=A0--zero >=C2=A0>=C2=A0+Separate=C2=A0output=C2=A0items=C2=A0with=C2=A0NUL=C2=A0char= acters. >=C2=A0 >=C2=A0s/Separate/Delimit/ Actually I copied that sentence from other sections. I guess it's wrong there, too.=C2=A0 And probaby it makes sense to replace it by a macro. >=C2=A0>=C2=A0+@example >=C2=A0>=C2=A0+$=C2=A0id=C2=A0-Gn=C2=A0--zero >=C2=A0>=C2=A0+users=C2=A0=C2=A0devs >=C2=A0 >=C2=A0users=C2=A0=C2=A0devs=C2=A0 Good point! =C2=A0 >=C2=A0>=C2=A0diff=C2=A0--git=C2=A0a/tests/misc/id-zero.sh=C2=A0b/tests/mis= c/id-zero.sh >=C2=A0 >=C2=A0>=C2=A0+id=C2=A0root=C2=A0||=C2=A0fail=3D1 >=C2=A0 >=C2=A0Is=C2=A0'root'=C2=A0a=C2=A0guaranteed=C2=A0name? >=C2=A0misc/chroot-credentials.sh=C2=A0since=C2=A0v7.4-16-gc45c51f=C2=A0ass= umes=C2=A0so. >=C2=A0I'm=C2=A0still=C2=A0not=C2=A0convinced=C2=A0(and=C2=A0will=C2=A0look= =C2=A0at=C2=A0addressing=C2=A0that=C2=A0separately). Cygwin lacks a 'root' entry - but it also lacks getent ... >=C2=A0>=C2=A0+#=C2=A0Create=C2=A0a=C2=A0nice=C2=A0list=C2=A0of=C2=A0users= =C2=A0(ignoring=C2=A0errors)=C2=A0... >=C2=A0>=C2=A0+getent=C2=A0passwd=C2=A0|=C2=A0head=C2=A0-n=C2=A0100=C2=A0|= =C2=A0cut=C2=A0-d:=C2=A0-f1=C2=A0>=C2=A0users >=C2=A0 >=C2=A0test=C2=A0-s=C2=A0users=C2=A0||=C2=A0skip_=C2=A0'Failed=C2=A0to=C2= =A0read=C2=A0the=C2=A0passwd=C2=A0database=C2=A0with=C2=A0getent' ... so this test is good; added. >=C2=A0Also=C2=A0why=C2=A0so=C2=A0many=C2=A0(100).=C2=A0The=C2=A0test=C2=A0= is=C2=A0a=C2=A0bit=C2=A0slow=C2=A0and=C2=A0you=C2=A0would=C2=A0get >=C2=A0the=C2=A0same=C2=A0coverage=C2=A0from=C2=A0a=C2=A0couple=C2=A0of=C2= =A0entries? Actually that was to protect against "very-expensive" behavior on bigger NIS installation. On normal installations, I haven't seen much more than 30-40 users yet anyway. The point was to get an entry with only 1 and with 2 or more groups. I wouldn't go that far and add require_membership_in_two_groups_, so maybe finding such entries with something like this would be better (btw: can we rely on xargs to be there)? =C2=A0 getent passwd | head -n50 | cut -d: -f1 \ =C2=A0 =C2=A0 | xargs groups \ =C2=A0 =C2=A0 | awk '{ x[NF] =3D $1; } =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0END { for (u in x) print x[u]; }' Anyway, I moved the tr(1) out of the loop, so we're saving a few pipe creations. >=C2=A0>=C2=A0+#=C2=A0id(1)=C2=A0should=C2=A0refuse=C2=A0--zero=C2=A0in=C2= =A0default=C2=A0format. >=C2=A0>=C2=A0+id=C2=A0--zero=C2=A0>=C2=A0out=C2=A02>err=C2=A0&&=C2=A0fail= =3D1 >=C2=A0>=C2=A0+compare=C2=A0/dev/null=C2=A0out=C2=A0||=C2=A0fail=3D1 >=C2=A0 >=C2=A0>=C2=A0+grep=C2=A0'option=C2=A0--zero=C2=A0not=C2=A0permitted=C2=A0i= n=C2=A0default=C2=A0format'=C2=A0err=C2=A0||=C2=A0fail=3D1 >=C2=A0 >=C2=A0Better=C2=A0to: >=C2=A0echo=C2=A0'option=C2=A0...'=C2=A0>=C2=A0exp-err >=C2=A0compare=C2=A0exp-err=C2=A0err=C2=A0||=C2=A0fail=3D1 true, changed. =C2=A0 >=C2=A0>=C2=A0+printf=C2=A0"\n"=C2=A0>=C2=A0exp=C2=A0||=C2=A0framework_fail= ure_ >=C2=A0 >=C2=A0Minor=C2=A0point,=C2=A0but=C2=A0it's=C2=A0better=C2=A0to=C2=A0use=C2= =A0''=C2=A0quotes=C2=A0when=C2=A0not=C2=A0interpolating, >=C2=A0here=C2=A0and=C2=A0throughout=C2=A0the=C2=A0test. true, thanks. >=C2=A0>=C2=A0+cp=C2=A0/dev/null=C2=A0=C2=A0out=C2=A0||=C2=A0framework_fail= ure_ >=C2=A0 >=C2=A0:>=C2=A0out yep, done. Thanks for the review. I'll provide a new version of the patch later (or tomorrow). Have a nice day, Berny From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: [PATCH] groups,id: add -0, --null option Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 19 Sep 2013 09:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Bernhard Voelker Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.13795844068501 (code B ref 9987); Thu, 19 Sep 2013 09:54:01 +0000 Received: (at 9987) by debbugs.gnu.org; 19 Sep 2013 09:53:26 +0000 Received: from localhost ([127.0.0.1]:48392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMavN-0002D3-OG for submit@debbugs.gnu.org; Thu, 19 Sep 2013 05:53:26 -0400 Received: from mail2.vodafone.ie ([213.233.128.44]:65185) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMavL-0002Cl-2o for 9987@debbugs.gnu.org; Thu, 19 Sep 2013 05:53:24 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApQBABfJOlJtTHqR/2dsb2JhbAANToc6vgSBOIMZAQEBAwEjDwFGBQsLDQEKAgIFFgsCAgkDAgECAUUGDQEFAgEBh3mmfHSSJIEpjj4HgmmBNQOeVI5C Received: from unknown (HELO [192.168.1.79]) ([109.76.122.145]) by mail2.vodafone.ie with ESMTP; 19 Sep 2013 10:53:16 +0100 Message-ID: <523AC98B.4080906@draigBrady.com> Date: Thu, 19 Sep 2013 10:53:15 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 References: <5223B306.2080500@bernhard-voelker.de> <52249AA8.8040202@draigBrady.com> <52258330.1070504@bernhard-voelker.de> <52364E54.9060508@draigBrady.com> <523975C8.3000406@draigBrady.com> <5239F501.9000707@bernhard-voelker.de> <523A0555.6050005@draigBrady.com> <523A3618.6020709@bernhard-voelker.de> <523A53E6.40200@draigBrady.com> <1757849545.57259.1379577408394.open-xchange@email.1und1.de> In-Reply-To: <1757849545.57259.1379577408394.open-xchange@email.1und1.de> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 09/19/2013 08:56 AM, Bernhard Voelker wrote: >> On September 19, 2013 at 3:31 AM Pádraig Brady wrote: >> Also why so many (100). The test is a bit slow and you would get >> the same coverage from a couple of entries? > > Actually that was to protect against "very-expensive" behavior on > bigger NIS installation. On normal installations, I haven't seen much > more than 30-40 users yet anyway. Yep that's still noticeable here. > The point was to get an entry with only 1 and with 2 or more groups. > I wouldn't go that far and add require_membership_in_two_groups_, > so maybe finding such entries with something like this would be better Oh I see. That need for 'root' definitely wasn't obvious and needs a comment. With tests we have greater flexibility in that the common case can cater for the coverage, while we can gracefully degrade the test on outliers. So I'd avoid getent entirely and do: # Add $USER to ensure we have at least one explicit entry users="$u" # Add 'root' to test multiple groups (as is usually the case) id root >/dev/null 2>/dev/null && users="$USERS root" # Add 'nobody' to test single group (as is usually the case) id nobody >/dev/null 2>/dev/null && users="$USERS nobody" # Add $users and '' (implicit $USER) to list to process printf '%s\n' $users '' >> users || framework_failure_ > (btw: can we rely on xargs to be there)? I see that xargs has been used since 2004 without issue. thanks, Pádraig. From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: [PATCH] groups,id: add -0, --null option Resent-From: Bernhard Voelker Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sat, 21 Sep 2013 10:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.137975852413704 (code B ref 9987); Sat, 21 Sep 2013 10:16:01 +0000 Received: (at 9987) by debbugs.gnu.org; 21 Sep 2013 10:15:24 +0000 Received: from localhost ([127.0.0.1]:52862 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNKDi-0003Yw-Si for submit@debbugs.gnu.org; Sat, 21 Sep 2013 06:15:23 -0400 Received: from moutng.kundenserver.de ([212.227.17.8]:55315) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNKDf-0003Yf-9m for 9987@debbugs.gnu.org; Sat, 21 Sep 2013 06:15:21 -0400 Received: from [192.168.1.11] (p5499D871.dip0.t-ipconnect.de [84.153.216.113]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0Me5OA-1VXhhG1RnS-00PMdb; Sat, 21 Sep 2013 12:15:12 +0200 Message-ID: <523D71AF.7040601@bernhard-voelker.de> Date: Sat, 21 Sep 2013 12:15:11 +0200 From: Bernhard Voelker User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 References: <5223B306.2080500@bernhard-voelker.de> <52249AA8.8040202@draigBrady.com> <52258330.1070504@bernhard-voelker.de> <52364E54.9060508@draigBrady.com> <523975C8.3000406@draigBrady.com> <5239F501.9000707@bernhard-voelker.de> <523A0555.6050005@draigBrady.com> <523A3618.6020709@bernhard-voelker.de> <523A53E6.40200@draigBrady.com> <1757849545.57259.1379577408394.open-xchange@email.1und1.de> <523AC98B.4080906@draigBrady.com> In-Reply-To: <523AC98B.4080906@draigBrady.com> Content-Type: multipart/mixed; boundary="------------070409090201050206070702" X-Provags-ID: V02:K0:KepHbj3CbUz02IPd4c9zfCNjRfKrFvhGv6uX8d7eGBR SM5v9T136rSZu5eAGrzHILy+hCwNpZ+TWxrKYLp1VhW/3wLbFK XVr/MpTeAAB/3kISkDL2//pC7XhZ4tXPurGEVA6hiwsZtirhR/ x0e9q92PWE0DdXOwnTnXwHEmQyQR+5F3mJLp7UJYRmth+U7pMh KP0MfON+Iunr0Lreq5zo/nBfOnYkiOKvQZCRcUskbdy5QTxsa7 iqIPURutpxT0EXnx2dOH5jffUWALEdjyLdYPBAnBdSPi3xetQi /htCya+CV9coP/SgMPX2XbFyChsHPNRg9OY/1f8/SYEYW5Ioog VG+oW6jcsWcjIH0v1NrcplUEBDbmWx2B1Iba7/Edi X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) This is a multi-part message in MIME format. --------------070409090201050206070702 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 09/19/2013 11:53 AM, Pádraig Brady wrote: > So I'd avoid getent entirely and do: Good idea. > # Add $USER to ensure we have at least one explicit entry > users="$u" > # Add 'root' to test multiple groups (as is usually the case) > id root >/dev/null 2>/dev/null && users="$USERS root" > # Add 'nobody' to test single group (as is usually the case) > id nobody >/dev/null 2>/dev/null && users="$USERS nobody" > # Add $users and '' (implicit $USER) to list to process > printf '%s\n' $users '' >> users || framework_failure_ Interestingly, the situation is different here (openSUSE): root is only in group root, and nobody is in the groups nobody and nogroup. However, I've added some users which seem to be typical for being member of one or more groups. for u in root man postfix sshd nobody ; do id $u >/dev/null 2>&1 && users="$users $u" done New patch attached. Thanks! Have a nice day, Berny --------------070409090201050206070702 Content-Type: text/x-patch; name="id-zero-option-v2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="id-zero-option-v2.patch" >From f8906040e42ca762be498fd58f474fad1f68f145 Mon Sep 17 00:00:00 2001 From: Bernhard Voelker Date: Sat, 21 Sep 2013 12:08:55 +0200 Subject: [PATCH] id: add -z, --zero option * src/group-list.h (print_group_list): Add a parameter for the delimiter of type char. * src/group-list.c (print_group_list): Likewise, and use it instead of a white space character to delimit the group entries. * src/groups.c (main): Pass white space character to print_group_list(). * src/id.c (longopts): Add array element for the new long option. (usage): Document the new option. While at it, fix the alignment of the descriptions to match that of HELP_OPTION_DESCRIPTION. (main): Define the bool flag opt_zero indicating the use of the new option. In the getopt_long loop, handle it. Output an error diagnostic in the case the --zero option has been specified together with the default format. In the case of -gG, pass either a NUL or a white space character to print_group_list() - depending on the above new flag. Likewise change the printing of the final newline character: output a NUL instead if the --zero option has been specified. * doc/coreutils.texi (id invocation): Document the new option. While at it, move the @exitstatus macro down after the macro @primaryAndSupplementaryGroups in order to be consistent with other texinfo documents. (groups invocation): Move @exitstatus down after the macro @primaryAndSupplementaryGroups here, too. * tests/misc/id-zero.sh: Add new test exercising the new option. * tests/local.mk (all_tests): Reference it. * NEWS (New features): Mention the new option. Fixes http://bugs.gnu.org/9987 --- NEWS | 3 +++ doc/coreutils.texi | 22 ++++++++++++++---- src/group-list.c | 6 ++--- src/group-list.h | 2 +- src/groups.c | 6 ++--- src/id.c | 36 ++++++++++++++++++++--------- tests/local.mk | 1 + tests/misc/id-zero.sh | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 116 insertions(+), 23 deletions(-) create mode 100755 tests/misc/id-zero.sh diff --git a/NEWS b/NEWS index d26722d..23c7b54 100644 --- a/NEWS +++ b/NEWS @@ -44,6 +44,9 @@ GNU coreutils NEWS -*- outline -*- du accepts a new option: --inodes to show the number of inodes instead of the blocks used. + id accepts a new option: --zero (-z) to delimit the output entries by + a NUL instead of a white space character. + id and ls with -Z report the SMACK security context where available. mkdir, mkfifo and mknod with -Z set the SMACK context where available. diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 21216b4..d022c45 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -14516,9 +14516,20 @@ Print only the security context of the current user. If SELinux is disabled then print a warning and set the exit status to 1. -@end table +@item -z +@itemx --zero +@opindex -z +@opindex --zero +Delimit output items with NUL characters. +This option is not permitted when using the default format. -@exitstatus +Example: +@example +$ id -Gn --zero +users devs +@end example + +@end table @macro primaryAndSupplementaryGroups{cmd,arg} Primary and supplementary groups for a process are normally inherited @@ -14530,6 +14541,8 @@ database to be consulted afresh, and so will give a different result. @end macro @primaryAndSupplementaryGroups{id,user argument} +@exitstatus + @node logname invocation @section @command{logname}: Print current login name @@ -14587,13 +14600,12 @@ groups [@var{username}]@dots{} The group lists are equivalent to the output of the command @samp{id -Gn}. -@primaryAndSupplementaryGroups{groups,list of users} - The only options are @option{--help} and @option{--version}. @xref{Common options}. -@exitstatus +@primaryAndSupplementaryGroups{groups,list of users} +@exitstatus @node users invocation @section @command{users}: Print login names of users currently logged in diff --git a/src/group-list.c b/src/group-list.c index 7d4995b..d54b057 100644 --- a/src/group-list.c +++ b/src/group-list.c @@ -35,7 +35,7 @@ extern bool print_group_list (const char *username, uid_t ruid, gid_t rgid, gid_t egid, - bool use_names) + bool use_names, char delim) { bool ok = true; struct passwd *pwd = NULL; @@ -52,7 +52,7 @@ print_group_list (const char *username, if (egid != rgid) { - putchar (' '); + putchar (delim); if (!print_group (egid, use_names)) ok = false; } @@ -79,7 +79,7 @@ print_group_list (const char *username, for (i = 0; i < n_groups; i++) if (groups[i] != rgid && groups[i] != egid) { - putchar (' '); + putchar (delim); if (!print_group (groups[i], use_names)) ok = false; } diff --git a/src/group-list.h b/src/group-list.h index 3fac887..573de1d 100644 --- a/src/group-list.h +++ b/src/group-list.h @@ -16,4 +16,4 @@ along with this program. If not, see . */ bool print_group (gid_t, bool); -bool print_group_list (const char *, uid_t, gid_t, gid_t, bool); +bool print_group_list (const char *, uid_t, gid_t, gid_t, bool, char); diff --git a/src/groups.c b/src/groups.c index 53332d5..d30c9fb 100644 --- a/src/groups.c +++ b/src/groups.c @@ -114,13 +114,13 @@ main (int argc, char **argv) if (rgid == NO_GID && errno) error (EXIT_FAILURE, errno, _("cannot get real GID")); - if (!print_group_list (NULL, ruid, rgid, egid, true)) + if (!print_group_list (NULL, ruid, rgid, egid, true, ' ')) ok = false; putchar ('\n'); } else { - /* At least one argument. Divulge the details of the specified users. */ + /* At least one argument. Divulge the details of the specified users. */ while (optind < argc) { struct passwd *pwd = getpwnam (argv[optind]); @@ -130,7 +130,7 @@ main (int argc, char **argv) rgid = egid = pwd->pw_gid; printf ("%s : ", argv[optind]); - if (!print_group_list (argv[optind++], ruid, rgid, egid, true)) + if (!print_group_list (argv[optind++], ruid, rgid, egid, true, ' ')) ok = false; putchar ('\n'); } diff --git a/src/id.c b/src/id.c index 3e7016f..a0334ba 100644 --- a/src/id.c +++ b/src/id.c @@ -67,6 +67,7 @@ static struct option const longopts[] = {"name", no_argument, NULL, 'n'}, {"real", no_argument, NULL, 'r'}, {"user", no_argument, NULL, 'u'}, + {"zero", no_argument, NULL, 'z'}, {GETOPT_HELP_OPTION_DECL}, {GETOPT_VERSION_OPTION_DECL}, {NULL, 0, NULL, 0} @@ -83,14 +84,18 @@ usage (int status) fputs (_("\ Print user and group information for the specified USERNAME,\n\ or (when USERNAME omitted) for the current user.\n\ -\n\ - -a ignore, for compatibility with other versions\n\ - -Z, --context print only the security context of 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\ - -r, --real print the real ID instead of the effective ID, with -ugG\n\ - -u, --user print only the effective user ID\n\ +\n"), + stdout); + fputs (_("\ + -a ignore, for compatibility with other versions\n\ + -Z, --context print only the security context of 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\ + -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\ + not permitted in default format\n\ "), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout); @@ -109,6 +114,7 @@ main (int argc, char **argv) int optc; int selinux_enabled = (is_selinux_enabled () > 0); bool smack_enabled = is_smack_enabled (); + bool opt_zero = false; /* If true, output the list of all group IDs. -G */ bool just_group_list = false; @@ -127,7 +133,7 @@ main (int argc, char **argv) atexit (close_stdout); - while ((optc = getopt_long (argc, argv, "agnruGZ", longopts, NULL)) != -1) + while ((optc = getopt_long (argc, argv, "agnruzGZ", longopts, NULL)) != -1) { switch (optc) { @@ -162,6 +168,9 @@ main (int argc, char **argv) case 'u': just_user = true; break; + case 'z': + opt_zero = true; + break; case 'G': just_group_list = true; break; @@ -193,6 +202,10 @@ main (int argc, char **argv) error (EXIT_FAILURE, 0, _("cannot print only names or real IDs in default format")); + if (default_format && opt_zero) + error (EXIT_FAILURE, 0, + _("option --zero not permitted in default format")); + /* If we are on a SELinux/SMACK-enabled kernel, no user is specified, and either --context is specified or none of (-u,-g,-G) is specified, and we're not in POSIXLY_CORRECT mode, get our context. Otherwise, @@ -269,7 +282,8 @@ main (int argc, char **argv) } else if (just_group_list) { - if (!print_group_list (argv[optind], ruid, rgid, egid, use_name)) + if (!print_group_list (argv[optind], ruid, rgid, egid, use_name, + opt_zero ? '\0' : ' ')) ok = false; } else if (just_context) @@ -280,7 +294,7 @@ main (int argc, char **argv) { print_full_info (argv[optind]); } - putchar ('\n'); + putchar (opt_zero ? '\0' : '\n'); exit (ok ? EXIT_SUCCESS : EXIT_FAILURE); } diff --git a/tests/local.mk b/tests/local.mk index b00ff59..8f76b23 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -277,6 +277,7 @@ all_tests = \ tests/misc/id-context.sh \ tests/misc/id-groups.sh \ tests/misc/id-setgid.sh \ + tests/misc/id-zero.sh \ tests/misc/md5sum.pl \ tests/misc/md5sum-bsd.sh \ tests/misc/md5sum-newline.pl \ diff --git a/tests/misc/id-zero.sh b/tests/misc/id-zero.sh new file mode 100755 index 0000000..b0e3887 --- /dev/null +++ b/tests/misc/id-zero.sh @@ -0,0 +1,63 @@ +#!/bin/sh +# Exercise "id --zero". + +# Copyright (C) 2013 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src +print_ver_ id + +u="$( id -nu )" +id || fail=1 +id "$u" || fail=1 +id root || fail=1 + +# id(1) should refuse --zero in default format. +echo 'id: option --zero not permitted in default format' > err-exp \ + || framework_failure_ +id --zero > out 2>err && fail=1 +compare /dev/null out || fail=1 +compare err-exp err || fail=1 + +# Create a nice list of users. +# Add $USER to ensure we have at least one explicit entry. +users="$u" +# Add a few typical users to test single group and multiple groups. +for u in root man postfix sshd nobody ; do + id $u >/dev/null 2>&1 && users="$users $u" +done +# Add $users and '' (implicit $USER) to list to process. +printf '%s\n' $users '' >> users || framework_failure_ + +# Exercise "id -z" with various options. +printf '\n' > exp || framework_failure_ +:> out || framework_failure_ + +while read u ; do + for o in g gr G Gr u ur ; do + for n in '' n ; do + printf '%s: ' "id -${o}${n}[z] $u" >> exp || framework_failure_ + printf '\n%s: ' "id -${o}${n}[z] $u" >> out || framework_failure_ + id -${o}${n} $u >> exp || fail=1 + id -${o}${n}z $u > tmp || fail=1 + head -c-1 < tmp >> out || framework_failure_ + done + done +done < users +printf '\n' >> out || framework_failure_ +tr '\0' ' ' < out > out2 || framework_failure_ +compare exp out2 || fail=1 + +Exit $fail -- 1.8.3.1 --------------070409090201050206070702-- From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: [PATCH] groups,id: add -0, --null option Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sat, 21 Sep 2013 10:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Bernhard Voelker Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.137975992616146 (code B ref 9987); Sat, 21 Sep 2013 10:39:02 +0000 Received: (at 9987) by debbugs.gnu.org; 21 Sep 2013 10:38:46 +0000 Received: from localhost ([127.0.0.1]:52904 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNKaM-0004CL-9x for submit@debbugs.gnu.org; Sat, 21 Sep 2013 06:38:46 -0400 Received: from mail2.vodafone.ie ([213.233.128.44]:42171) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNKaJ-0004C6-Fa for 9987@debbugs.gnu.org; Sat, 21 Sep 2013 06:38:44 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApQBANN2PVJtTISP/2dsb2JhbAANTYM/g3u+NYExgxkBAQEEIw8BRhALDQEKAgIFFgsCAgkDAgECAUUGDQEHAQGvfHSSFYEpjjwHgmmBNQOeVY5D Received: from unknown (HELO [192.168.1.79]) ([109.76.132.143]) by mail2.vodafone.ie with ESMTP; 21 Sep 2013 11:38:37 +0100 Message-ID: <523D772D.5050908@draigBrady.com> Date: Sat, 21 Sep 2013 11:38:37 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 References: <5223B306.2080500@bernhard-voelker.de> <52249AA8.8040202@draigBrady.com> <52258330.1070504@bernhard-voelker.de> <52364E54.9060508@draigBrady.com> <523975C8.3000406@draigBrady.com> <5239F501.9000707@bernhard-voelker.de> <523A0555.6050005@draigBrady.com> <523A3618.6020709@bernhard-voelker.de> <523A53E6.40200@draigBrady.com> <1757849545.57259.1379577408394.open-xchange@email.1und1.de> <523AC98B.4080906@draigBrady.com> <523D71AF.7040601@bernhard-voelker.de> In-Reply-To: <523D71AF.7040601@bernhard-voelker.de> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 09/21/2013 11:15 AM, Bernhard Voelker wrote: > diff --git a/tests/misc/id-zero.sh b/tests/misc/id-zero.sh > +id root || fail=1 The 'root' name is guaranteed to be present, so I'd avoid that line TBH. Otherwise looks good. Please Push. thanks! Pádraig. From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: [PATCH] groups,id: add -0, --null option Resent-From: Eric Blake Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sat, 21 Sep 2013 12:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 9987@debbugs.gnu.org, Bernhard Voelker Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.137976554428536 (code B ref 9987); Sat, 21 Sep 2013 12:13:02 +0000 Received: (at 9987) by debbugs.gnu.org; 21 Sep 2013 12:12:24 +0000 Received: from localhost ([127.0.0.1]:53076 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNM2y-0007QB-1G for submit@debbugs.gnu.org; Sat, 21 Sep 2013 08:12:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53820) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNM2v-0007Px-7V for 9987@debbugs.gnu.org; Sat, 21 Sep 2013 08:12:22 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8LCCCGJ002367 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 21 Sep 2013 08:12:12 -0400 Received: from [10.3.113.10] ([10.3.113.10]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r8LCCBMj019525; Sat, 21 Sep 2013 08:12:11 -0400 Message-ID: <523D8D1B.8050709@redhat.com> Date: Sat, 21 Sep 2013 06:12:11 -0600 From: Eric Blake Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 MIME-Version: 1.0 References: <5223B306.2080500@bernhard-voelker.de> <52249AA8.8040202@draigBrady.com> <52258330.1070504@bernhard-voelker.de> <52364E54.9060508@draigBrady.com> <523975C8.3000406@draigBrady.com> <5239F501.9000707@bernhard-voelker.de> <523A0555.6050005@draigBrady.com> <523A3618.6020709@bernhard-voelker.de> <523A53E6.40200@draigBrady.com> <1757849545.57259.1379577408394.open-xchange@email.1und1.de> <523AC98B.4080906@draigBrady.com> <523D71AF.7040601@bernhard-voelker.de> <523D772D.5050908@draigBrady.com> In-Reply-To: <523D772D.5050908@draigBrady.com> X-Enigmail-Version: 1.5.2 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="97qSH5l4LE7E0rkhs9MsUNCu6ouvHrwXQ" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Spam-Score: -5.7 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.7 (-----) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --97qSH5l4LE7E0rkhs9MsUNCu6ouvHrwXQ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 09/21/2013 04:38 AM, P=C3=A1draig Brady wrote: > On 09/21/2013 11:15 AM, Bernhard Voelker wrote: >> diff --git a/tests/misc/id-zero.sh b/tests/misc/id-zero.sh >=20 >> +id root || fail=3D1 >=20 > The 'root' name is guaranteed to be present, Not on Cygwin. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --97qSH5l4LE7E0rkhs9MsUNCu6ouvHrwXQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSPY0bAAoJEKeha0olJ0NqthMH/R/hkj+q3tKxyYUe2xi1L4XU ecD3J+MeqB9eeLuv1Y1mLU6iLtkPOY6uYOyeKyTG5xgm0N3EsIECkKDBCb7aqDuo BRjkL2McWBEgmXJQzfHPBlWyU1vvvXfXdPQutRj+sHZteNExr/AENU14iMjm8bSg Dnojkm/b0ZKR6DIj9svYLKFbTNY5fHMfI6XB4YsBPmn7317iSdjVs1QXj/0VVMkt RHqTS8DlWpckxMXrxceOf+qDOUmcZyc70SOtfrU+Z3vKFtzOA4evGy8Wbzy1b4cH lMgGhNN6HwrT5HUQcg/Qn5tjONa/E5RiTLehd+lrslDI6xc+Twbp7w9a8hbNyuQ= =L8OH -----END PGP SIGNATURE----- --97qSH5l4LE7E0rkhs9MsUNCu6ouvHrwXQ-- From unknown Tue Aug 12 04:07:03 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Linda Walsh Subject: bug#9987: closed (Re: bug#9987: [PATCH] groups,id: add -0, --null option) Message-ID: References: <523D8EC5.30705@bernhard-voelker.de> <4EB85B66.70508@tlinx.org> X-Gnu-PR-Message: they-closed 9987 X-Gnu-PR-Package: coreutils Reply-To: 9987@debbugs.gnu.org Date: Sat, 21 Sep 2013 12:20:04 +0000 Content-Type: multipart/mixed; boundary="----------=_1379766004-29233-1" This is a multi-part message in MIME format... ------------=_1379766004-29233-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #9987: RFE: 'groups' command ADD command switches "-0", and "-1" which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 9987@debbugs.gnu.org. --=20 9987: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D9987 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1379766004-29233-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 9987-done) by debbugs.gnu.org; 21 Sep 2013 12:19:27 +0000 Received: from localhost ([127.0.0.1]:53105 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNM9m-0007ab-VJ for submit@debbugs.gnu.org; Sat, 21 Sep 2013 08:19:27 -0400 Received: from moutng.kundenserver.de ([212.227.17.8]:57909) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNM9k-0007aJ-Mk for 9987-done@debbugs.gnu.org; Sat, 21 Sep 2013 08:19:25 -0400 Received: from [192.168.1.11] (p5499D871.dip0.t-ipconnect.de [84.153.216.113]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0LlrOO-1VwPrC0GPo-00ZcCp; Sat, 21 Sep 2013 14:19:18 +0200 Message-ID: <523D8EC5.30705@bernhard-voelker.de> Date: Sat, 21 Sep 2013 14:19:17 +0200 From: Bernhard Voelker User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: Eric Blake Subject: Re: bug#9987: [PATCH] groups,id: add -0, --null option References: <5223B306.2080500@bernhard-voelker.de> <52249AA8.8040202@draigBrady.com> <52258330.1070504@bernhard-voelker.de> <52364E54.9060508@draigBrady.com> <523975C8.3000406@draigBrady.com> <5239F501.9000707@bernhard-voelker.de> <523A0555.6050005@draigBrady.com> <523A3618.6020709@bernhard-voelker.de> <523A53E6.40200@draigBrady.com> <1757849545.57259.1379577408394.open-xchange@email.1und1.de> <523AC98B.4080906@draigBrady.com> <523D71AF.7040601@bernhard-voelker.de> <523D772D.5050908@draigBrady.com> <523D8D1B.8050709@redhat.com> In-Reply-To: <523D8D1B.8050709@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:lFWFztpDD0963ZD1gZHbJ7LFi4lBYygLztWHdvgFlYX rNx8OnfsSMpW/Pk8GziW4QsXvAn5Re3aU8VvZuCg53LSivgazP 4A/+JvnLOHtJlkVNsGrgpnPcFohjQu+xYZtkS/PhCLWGmWp53y blgynIwL/FIwvSGGgjbT+V9F3ZraIMyHdNIR0cWeNr3BuWWzfZ oeJcNwSliX1D7Fhty3bfWIKdFZyVYu7MPuPO5Xam3xcM2SaRvP 3dmc74kRF5KJIPPAU1TJuWpfPhSSyV47MveNAU/J5CoKRj1oBu e9rV8YW2PfdencS5annzllSOB80FjvoTePdMxr4MkFd6inGq3n aT311bLa0pKI79osJ6SHVd16luLY86JJQ30jPJoPc X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 9987-done Cc: 9987-done@debbugs.gnu.org, =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) On 09/21/2013 02:12 PM, Eric Blake wrote: > On 09/21/2013 04:38 AM, Pádraig Brady wrote: >> On 09/21/2013 11:15 AM, Bernhard Voelker wrote: >>> diff --git a/tests/misc/id-zero.sh b/tests/misc/id-zero.sh >> >>> +id root || fail=1 >> >> The 'root' name is guaranteed to be present, > > Not on Cygwin. > Okay, pushed with that change. http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=2a0d241f Marking this bug as done. Thanks & have a nice day, Berny ------------=_1379766004-29233-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 Nov 2011 22:30:56 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RNXiS-0003bu-7T for submit@debbugs.gnu.org; Mon, 07 Nov 2011 17:30:56 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RNXiP-0003bn-H8 for submit@debbugs.gnu.org; Mon, 07 Nov 2011 17:30:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RNXfa-0008OJ-LC for submit@debbugs.gnu.org; Mon, 07 Nov 2011 17:27:59 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:34511) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNXfa-0008OB-9H for submit@debbugs.gnu.org; Mon, 07 Nov 2011 17:27:58 -0500 Received: from eggs.gnu.org ([140.186.70.92]:43703) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNXfZ-0003LE-Cs for bug-coreutils@gnu.org; Mon, 07 Nov 2011 17:27:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RNXfY-0008NG-Bm for bug-coreutils@gnu.org; Mon, 07 Nov 2011 17:27:57 -0500 Received: from ishtar.tlinx.org ([173.164.175.65]:41376 helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNXfY-0008LQ-2e for bug-coreutils@gnu.org; Mon, 07 Nov 2011 17:27:56 -0500 Received: from [192.168.3.12] (Athenae [192.168.3.12]) by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id pA7MRpgh011215 for ; Mon, 7 Nov 2011 14:27:53 -0800 Message-ID: <4EB85B66.70508@tlinx.org> Date: Mon, 07 Nov 2011 14:27:50 -0800 From: Linda Walsh User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666 MIME-Version: 1.0 To: bug-coreutils@gnu.org Subject: RFE: 'groups' command ADD command switches "-0", and "-1" Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.8 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.0 (-----) I'd like to request an RFE for the groups command to add 2 switches: -1 - print groups in 1 column (cf. ls -1) -0 - print groups followed by null (cf. find et al) reasons: have groups with spaces in them. provide ultimate safety/futureproof with -0 ?? reasonable? ------------=_1379766004-29233-1-- From unknown Tue Aug 12 04:07:03 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Linda Walsh Subject: bug#12083: closed (Re: bug#9987: [PATCH] groups,id: add -0, --null option) Message-ID: References: <523D8EC5.30705@bernhard-voelker.de> <50159BFC.5080309@tlinx.org> X-Gnu-PR-Message: they-closed 12083 X-Gnu-PR-Package: coreutils Reply-To: 12083@debbugs.gnu.org Date: Sat, 21 Sep 2013 12:20:06 +0000 Content-Type: multipart/mixed; boundary="----------=_1379766006-29233-3" This is a multi-part message in MIME format... ------------=_1379766006-29233-3 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #9987: bug in groups command -- doesn't quote usage of group-separator in g= roupnames which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 12083@debbugs.gnu.org. --=20 9987: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D9987 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1379766006-29233-3 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 9987-done) by debbugs.gnu.org; 21 Sep 2013 12:19:27 +0000 Received: from localhost ([127.0.0.1]:53105 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNM9m-0007ab-VJ for submit@debbugs.gnu.org; Sat, 21 Sep 2013 08:19:27 -0400 Received: from moutng.kundenserver.de ([212.227.17.8]:57909) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNM9k-0007aJ-Mk for 9987-done@debbugs.gnu.org; Sat, 21 Sep 2013 08:19:25 -0400 Received: from [192.168.1.11] (p5499D871.dip0.t-ipconnect.de [84.153.216.113]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0LlrOO-1VwPrC0GPo-00ZcCp; Sat, 21 Sep 2013 14:19:18 +0200 Message-ID: <523D8EC5.30705@bernhard-voelker.de> Date: Sat, 21 Sep 2013 14:19:17 +0200 From: Bernhard Voelker User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: Eric Blake Subject: Re: bug#9987: [PATCH] groups,id: add -0, --null option References: <5223B306.2080500@bernhard-voelker.de> <52249AA8.8040202@draigBrady.com> <52258330.1070504@bernhard-voelker.de> <52364E54.9060508@draigBrady.com> <523975C8.3000406@draigBrady.com> <5239F501.9000707@bernhard-voelker.de> <523A0555.6050005@draigBrady.com> <523A3618.6020709@bernhard-voelker.de> <523A53E6.40200@draigBrady.com> <1757849545.57259.1379577408394.open-xchange@email.1und1.de> <523AC98B.4080906@draigBrady.com> <523D71AF.7040601@bernhard-voelker.de> <523D772D.5050908@draigBrady.com> <523D8D1B.8050709@redhat.com> In-Reply-To: <523D8D1B.8050709@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:lFWFztpDD0963ZD1gZHbJ7LFi4lBYygLztWHdvgFlYX rNx8OnfsSMpW/Pk8GziW4QsXvAn5Re3aU8VvZuCg53LSivgazP 4A/+JvnLOHtJlkVNsGrgpnPcFohjQu+xYZtkS/PhCLWGmWp53y blgynIwL/FIwvSGGgjbT+V9F3ZraIMyHdNIR0cWeNr3BuWWzfZ oeJcNwSliX1D7Fhty3bfWIKdFZyVYu7MPuPO5Xam3xcM2SaRvP 3dmc74kRF5KJIPPAU1TJuWpfPhSSyV47MveNAU/J5CoKRj1oBu e9rV8YW2PfdencS5annzllSOB80FjvoTePdMxr4MkFd6inGq3n aT311bLa0pKI79osJ6SHVd16luLY86JJQ30jPJoPc X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 9987-done Cc: 9987-done@debbugs.gnu.org, =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) On 09/21/2013 02:12 PM, Eric Blake wrote: > On 09/21/2013 04:38 AM, Pádraig Brady wrote: >> On 09/21/2013 11:15 AM, Bernhard Voelker wrote: >>> diff --git a/tests/misc/id-zero.sh b/tests/misc/id-zero.sh >> >>> +id root || fail=1 >> >> The 'root' name is guaranteed to be present, > > Not on Cygwin. > Okay, pushed with that change. http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=2a0d241f Marking this bug as done. Thanks & have a nice day, Berny ------------=_1379766006-29233-3 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 29 Jul 2012 20:31:47 +0000 Received: from localhost ([127.0.0.1]:49257 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sva9S-0004Z3-Ve for submit@debbugs.gnu.org; Sun, 29 Jul 2012 16:31:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49382) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sva9R-0004Yx-Gk for submit@debbugs.gnu.org; Sun, 29 Jul 2012 16:31:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sva2V-0005AQ-9g for submit@debbugs.gnu.org; Sun, 29 Jul 2012 16:24:36 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:34830) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sva2V-0005AM-6e for submit@debbugs.gnu.org; Sun, 29 Jul 2012 16:24:35 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sva2U-0005dC-B5 for bug-coreutils@gnu.org; Sun, 29 Jul 2012 16:24:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sva2T-0005AA-Ba for bug-coreutils@gnu.org; Sun, 29 Jul 2012 16:24:34 -0400 Received: from ishtar.tlinx.org ([173.164.175.65]:59040 helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sva2S-00059s-VY for bug-coreutils@gnu.org; Sun, 29 Jul 2012 16:24:33 -0400 Received: from [192.168.3.12] (Athenae [192.168.3.12]) by Ishtar.sc.tlinx.org (8.14.5/8.14.4/SuSE Linux 0.8) with ESMTP id q6TKOSC9014735 for ; Sun, 29 Jul 2012 13:24:30 -0700 Message-ID: <50159BFC.5080309@tlinx.org> Date: Sun, 29 Jul 2012 13:24:28 -0700 From: Linda Walsh User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666 MIME-Version: 1.0 To: bug-coreutils@gnu.org Subject: bug in groups command -- doesn't quote usage of group-separator in groupnames Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) the 'groups' only prints out a bunch of words, but it doesn't tell me which of those are groups and which of those are not groups. It uses unquoted , space separated group name -- which has been known to be problematic for years (cf. find's -print0, or xargs -0, et al.). If this was only a default, and it could optionally print them 1/line or a backslash before non-separator spaces in groupnames, or even with a null like find, it might be workable, but the default, as it is 100% likely to not print out Windows groupnames that it might be serving. Even if it could use a TAB separator, that would still count as white space, but be 99% less likely (maybe 100%) to conflict with existing group names. Fixable? As it doesn't follow standards now, if one uses a space as a group separator, as what is listed, is incorrect (i.e. interpreting the list as a space separated group list will result in faulty results). Thanks, :-) ------------=_1379766006-29233-3-- From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: [PATCH] groups,id: add -0, --null option Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sat, 21 Sep 2013 13:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 9987@debbugs.gnu.org, mail@bernhard-voelker.de, coreutils@tlinx.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.13797706913766 (code B ref 9987); Sat, 21 Sep 2013 13:39:02 +0000 Received: (at 9987) by debbugs.gnu.org; 21 Sep 2013 13:38:11 +0000 Received: from localhost ([127.0.0.1]:53259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNNNx-0000ye-Sl for submit@debbugs.gnu.org; Sat, 21 Sep 2013 09:38:10 -0400 Received: from mail2.vodafone.ie ([213.233.128.44]:61476) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNNNo-0000yC-NO for 9987@debbugs.gnu.org; Sat, 21 Sep 2013 09:38:01 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApQBAOefPVJtTISP/2dsb2JhbAANTYM/g3u+N4EwgxkBAQEDASMPAUsLCw0LAgIFFgsCAgkDAgECAUUHDAgBAYd7EqgAdJILgSmOQ4JpgTUDnlWOQw Received: from unknown (HELO [192.168.1.79]) ([109.76.132.143]) by mail2.vodafone.ie with ESMTP; 21 Sep 2013 14:37:54 +0100 Message-ID: <523DA131.1020304@draigBrady.com> Date: Sat, 21 Sep 2013 14:37:53 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 References: <5223B306.2080500@bernhard-voelker.de> <52249AA8.8040202@draigBrady.com> <52258330.1070504@bernhard-voelker.de> <52364E54.9060508@draigBrady.com> <523975C8.3000406@draigBrady.com> <5239F501.9000707@bernhard-voelker.de> <523A0555.6050005@draigBrady.com> <523A3618.6020709@bernhard-voelker.de> <523A53E6.40200@draigBrady.com> <1757849545.57259.1379577408394.open-xchange@email.1und1.de> <523AC98B.4080906@draigBrady.com> <523D71AF.7040601@bernhard-voelker.de> <523D772D.5050908@draigBrady.com> <523D8D1B.8050709@redhat.com> <523D8EC5.30705@bernhard-voelker.de> In-Reply-To: <523D8EC5.30705@bernhard-voelker.de> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 09/21/2013 01:19 PM, Bernhard Voelker wrote: > On 09/21/2013 02:12 PM, Eric Blake wrote: >> On 09/21/2013 04:38 AM, Pádraig Brady wrote: >>> On 09/21/2013 11:15 AM, Bernhard Voelker wrote: >>>> diff --git a/tests/misc/id-zero.sh b/tests/misc/id-zero.sh >>> >>>> +id root || fail=1 >>> >>> The 'root' name is guaranteed to be present, s/is/is not/ >> Not on Cygwin. Not anywhere in general, since 'root' is a arbitrary name. > Okay, pushed with that change. > http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=2a0d241f > > Marking this bug as done. excellent. thanks again, Pádraig. From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: closed (Re: bug#9987: [PATCH] groups, id: add -0, --null option) Resent-From: Linda Walsh Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 22 Sep 2013 02:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.13798157275665 (code B ref 9987); Sun, 22 Sep 2013 02:09:02 +0000 Received: (at 9987) by debbugs.gnu.org; 22 Sep 2013 02:08:47 +0000 Received: from localhost ([127.0.0.1]:54580 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNZ6N-0001TJ-CY for submit@debbugs.gnu.org; Sat, 21 Sep 2013 22:08:47 -0400 Received: from ishtar.tlinx.org ([173.164.175.65]:44889) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNZ6K-0001T1-KO for 9987@debbugs.gnu.org; Sat, 21 Sep 2013 22:08:45 -0400 Received: from [192.168.4.12] (Athenae [192.168.4.12]) by Ishtar.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id r8M28V2r024479 for <9987@debbugs.gnu.org>; Sat, 21 Sep 2013 19:08:34 -0700 Message-ID: <523E511F.1000709@tlinx.org> Date: Sat, 21 Sep 2013 19:08:31 -0700 From: Linda Walsh User-Agent: Thunderbird MIME-Version: 1.0 References: <523D8EC5.30705@bernhard-voelker.de> <4EB85B66.70508@tlinx.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) GNU bug Tracking System wrote: > Your bug report > > #9987: RFE: 'groups' command ADD command switches "-0", and "-1" > > which was filed against the coreutils package, has been closed. > > The explanation is attached below, along with your original report. > If you require more details, please reply to 9987@debbugs.gnu.org. ---- + id accepts a new option: --zero (-z) to delimit the output entries by + a NUL instead of a white space character. ---- Curious: how many commands use "-z" to emit output with "0" termination vs. something commands that have switches with "0" in them? From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: closed (Re: bug#9987: [PATCH] groups, id: add -0, --null option) Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 22 Sep 2013 02:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Linda Walsh Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.13798165506871 (code B ref 9987); Sun, 22 Sep 2013 02:23:01 +0000 Received: (at 9987) by debbugs.gnu.org; 22 Sep 2013 02:22:30 +0000 Received: from localhost ([127.0.0.1]:54600 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNZJd-0001mk-R2 for submit@debbugs.gnu.org; Sat, 21 Sep 2013 22:22:30 -0400 Received: from mail2.vodafone.ie ([213.233.128.44]:37943) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNZJb-0001mR-7g for 9987@debbugs.gnu.org; Sat, 21 Sep 2013 22:22:27 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApMBAKFTPlJtTISP/2dsb2JhbAANTYc6vgaBMIMZAQEBBCNWEAsNAQoCAgUWCwICCQMCAQIBNBEGDQEFAgEBr0l0kXGBKY4JMweCaYE1A55VjkM Received: from unknown (HELO [192.168.1.79]) ([109.76.132.143]) by mail2.vodafone.ie with ESMTP; 22 Sep 2013 03:22:20 +0100 Message-ID: <523E545B.6070100@draigBrady.com> Date: Sun, 22 Sep 2013 03:22:19 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 References: <523D8EC5.30705@bernhard-voelker.de> <4EB85B66.70508@tlinx.org> <523E511F.1000709@tlinx.org> In-Reply-To: <523E511F.1000709@tlinx.org> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 09/22/2013 03:08 AM, Linda Walsh wrote: > > > GNU bug Tracking System wrote: >> Your bug report >> >> #9987: RFE: 'groups' command ADD command switches "-0", and "-1" >> >> which was filed against the coreutils package, has been closed. >> >> The explanation is attached below, along with your original report. >> If you require more details, please reply to 9987@debbugs.gnu.org. > ---- > + id accepts a new option: --zero (-z) to delimit the output entries by > + a NUL instead of a white space character. > ---- > > Curious: how many commands use "-z" to emit output with "0" > termination vs. something commands that have switches with "0" in them? === -0 === du (since v5.1.0) (POSIX doesn't mention -0) env (since v8.0) printenv (since v8.0) === -z === basename dirname id join readlink realpath shuf sort uniq sed grep From unknown Tue Aug 12 04:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9987: closed (Re: bug#9987: [PATCH] groups, id: add -0, --null option) Resent-From: Linda Walsh Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 22 Sep 2013 04:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9987 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: "PC!draig Brady" Cc: 9987@debbugs.gnu.org Received: via spool by 9987-submit@debbugs.gnu.org id=B9987.137982317317402 (code B ref 9987); Sun, 22 Sep 2013 04:13:02 +0000 Received: (at 9987) by debbugs.gnu.org; 22 Sep 2013 04:12:53 +0000 Received: from localhost ([127.0.0.1]:54724 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNb2T-0004Wc-0T for submit@debbugs.gnu.org; Sun, 22 Sep 2013 00:12:53 -0400 Received: from ishtar.tlinx.org ([173.164.175.65]:48994) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNb2Q-0004WS-Rr for 9987@debbugs.gnu.org; Sun, 22 Sep 2013 00:12:51 -0400 Received: from [192.168.4.12] (Athenae [192.168.4.12]) by Ishtar.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id r8M4Cinr040915; Sat, 21 Sep 2013 21:12:46 -0700 Message-ID: <523E6E3C.6040602@tlinx.org> Date: Sat, 21 Sep 2013 21:12:44 -0700 From: Linda Walsh User-Agent: Thunderbird MIME-Version: 1.0 References: <523D8EC5.30705@bernhard-voelker.de> <4EB85B66.70508@tlinx.org> <523E511F.1000709@tlinx.org> <523E545B.6070100@draigBrady.com> In-Reply-To: <523E545B.6070100@draigBrady.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) PC!draig Brady wrote: > On 09/22/2013 03:08 AM, Linda Walsh wrote: >> >> GNU bug Tracking System wrote: >>> Your bug report >>> >>> #9987: RFE: 'groups' command ADD command switches "-0", and "-1" >>> >>> which was filed against the coreutils package, has been closed. >>> >>> The explanation is attached below, along with your original report. >>> If you require more details, please reply to 9987@debbugs.gnu.org. >> ---- >> + id accepts a new option: --zero (-z) to delimit the output entries by >> + a NUL instead of a white space character. >> ---- >> >> Curious: how many commands use "-z" to emit output with "0" >> termination vs. something commands that have switches with "0" in them? > > === -0 === > du (since v5.1.0) (POSIX doesn't mention -0) > env (since v8.0) > printenv (since v8.0) > > === -z === > basename > dirname > id > join > readlink > realpath > shuf > sort > uniq > > sed > grep ---- Some of those are fairly new. At least id & join aren't even in my manpages yet. The others using -z are fairly new. and the use of -z w/sed and grep is suspect given their long options both refer to "null", You left out find & xargs -- which ARE core utilities even if they are not part of coreutils ;-). It seems like -0 was the standard in the initial utils -- probably because the word 'zero' in 17 out of hundreds of words for '0' in other languages, but the arabic number system is used in almost all (if not all) countries/languages. It seems like someone, in the past few years, didn't follow the pre-existing standard for such functionality. Since "-z" is only a recent addition compared to the non-locale-specific, "-0", wouldn't it make sense to try to use "-0" where it doesn't conflict, since -z can't be used in tools like grep as it indicates that input files are null terminated and uses -Z for output. I thought -0 might conflict somewhere, but it seems it wouldn't conflict in any of the utilities. Wouldn't it be a better choice -- especially considering it is international? Or... was there some reason why -z was chosen, as it makes the switches less consistent and more confusing...(especially given the age of the switches and that -Z has other meanings)...