GNU bug report logs - #9987
RFE: 'groups' command ADD command switches "-0", and "-1"

Previous Next

Package: coreutils;

Reported by: Linda Walsh <coreutils <at> tlinx.org>

Date: Mon, 7 Nov 2011 22:31:01 UTC

Severity: normal

Merged with 12083

Done: Bernhard Voelker <mail <at> bernhard-voelker.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Pádraig Brady <P <at> draigBrady.com>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: 9987 <at> debbugs.gnu.org
Subject: bug#9987: [PATCH] groups,id: add -0, --null option
Date: Tue, 17 Sep 2013 00:32:40 +0100
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.




This bug report was last modified 11 years and 299 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.