It is well-known that if I add myself to a new group, that change will not be reflected until I log out and back in:
$ sudo adduser me newgroup $ groups me sudo $ groups me me sudo newgroup $
This odd behavior is because
groups is interpreted by the shell and new group membership is not shown. But
groups me actually references
/etc/group and therefore the new membership is shown.
But what I find curious is that a new shell doesn't notice the change:
$ bash $ groups me sudo
The ways I know of to reflect the new group membership are (1)
su, (2) log out and back in.
bash must be passing the group list to its child somehow. It's not in the environment (I tried
printenv) and it's not in the kernel's task_struct (that has only gid, egid, sgid, and fsgid).
I can't figure how.