uucore: fix order of group IDs return from entries::get_groups()#2371
uucore: fix order of group IDs return from entries::get_groups()#2371tertsdiepraam merged 1 commit intouutils:masterfrom
Conversation
tertsdiepraam
left a comment
There was a problem hiding this comment.
Nice! Were you able to confirm that this solves the issue? Code-wise, I just have some small nits. Also there's this section from the libc manpages:
It is unspecified whether the effective group ID of the calling process is included in the returned list. (Thus, an application should also call getegid(2) and add or remove the resulting value.)
So I think the egid should always be added, even when it's not in the list? Would that be the desired behaviour?
On my local hosts, yes. So far some CI tests don't look happy, I have to investigate that further.
I also came across that note in the man pages, but wasn't too sure what to make of it. |
|
Alright, then we should probably just keep it like this |
|
Locally, I also get this: Which I think happens because my |
|
Maybe this helps. The OpenBSD implementation does this to construct the list of groups: https://github.com/openbsd/src/blob/fdf1c64914f5ad56fb382b8fd0e46398bc71a4cf/usr.bin/id/id.c#L305-L311 |
Thanks. That's BSD licensed right? I'll take a look if I can't figure this out otherwise. |
|
Yeah, I think we can look at it because it's BSD licensed |
a45439d to
e5428f8
Compare
I implemented this:
Everything looks good now :) |
tertsdiepraam
left a comment
There was a problem hiding this comment.
Nice! Just some small nits and questions
As discussed here: uutils#2361 the group IDs returned for GNU's 'group' and GNU's 'id --groups' starts with the effective group ID. This implements a wrapper for `entris::get_groups()` which mimics GNU's behaviour. * add tests for `id` * add tests for `groups` * fix `id --groups --real` to no longer ignore `--real`
|
Actually, I have one more request (sorry). Would you mind changing that call to GNU [1]: https://www.gnu.org/software/coreutils/manual/html_node/groups-invocation.html#groups-invocation |
I think if you want to tinker with |
|
Right, yeah I see that's non-trivial. Since it's just my machine I'll make a separate PR. You don't have to change this one |
As discussed here: #2361
the group IDs returned for GNU's 'group' and GNU's 'id --groups'
starts with the effective group ID.
This implements a wrapper for
entris::get_groups()which mimicsGNU's behaviour.
idgroupsid --groups --realto no longer ignore--real