[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] id: add feature to accept multiple usernames

From: Pádraig Brady
Subject: Re: [PATCH] id: add feature to accept multiple usernames
Date: Sun, 15 Jul 2018 11:15:55 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 15/07/18 00:10, Achilles Gaikwad wrote:
> Hello Pádraig,
>> I've not reviewed it yet, but things to consider.
>> - Add tests/docs
> Yes, I wanted to understand if this feature is ok to work on.
> I will work on the tests and updating the man page and relevant documentation.
>> - Ensure we process all arguments. I.E. don't die() early
> I shall follow the code paths once more and test possibilities where
> we might do this.
> One such occurrence was if the user didn't exist we would exit.
> ~~~
> if (pwd == NULL)
>         die (EXIT_FAILURE, 0, _("%s: no such user"), quote (spec));
> ~~~
> I'll checkout other possibilities and get back with a v2 of this patch.
>> - Do we need double \0\0 with -z to delimit each record?
> I am sorry, I do not understand this. If we delimit each record with
> two nulls, we would still have a following input.
> ~~~
> $  id root nobody -uz
> 099
> ~~~
> This could be :
> ~~~
> 0 99
> ~~~
> I would like to know your recommendations on if
> A] we should have only the last record null terminated?
> ~~~
> 0' '99'\0'
> ~~~
> a space between the first few records and only the last record which
> would be null.
> This defeats the purpose of `-z`  since we add a space.
> B] we should not enable `-z` for more than one user
> C] any other solutions that we can discuss?
>> thanks for the patch,
> Pleasure!

For the -z issue I was thinking of when there are multiple items per user.
Like with:

  id -Gz

How would one output that for multiple users?
One non ambiguous scheme at least is:

  if (opt_zero && just_group_list && multiple_users)

An alternative would be to output '\n' in that case
which wouldn't be as general, but would be easier to parse
with existing tools.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]