dbus-launch fails if user in too many groups OS X 10.5
Submitted by Glen Whitney
Assigned to D-Bus Maintainers
Created attachment 21522 proposed patch to handle >17 groups on Mac OS X 10.5
As of release 1.2.10, on Mac OS X 10.5, if a user attempting to execute dbus_launch is in more than 17 groups, dbus-launch will always fail with the message:
Failed to get groups for user
<username> primary GID
<gid>: Unknown error 0
The cause to the problem appears to be the fact that under 10.5, getgrouplist() fails to update buf_count to the true number of groups when the buffer has too few slots to fit them all.
There is a detailed account of how this exact bug affected some GIMP users on gimper.net: http://gimper.net/viewtopic.php?f=18&t=3185&st=0&sk=t&sd=a&sid=a679a167e0a62ffbd984d06ac0be982f&start=0 Obviously a developer there ("skl") was able to work around the issue, but as far as I can tell s/he never posted the patches nor opened a DBus ticket. Since the bug also hit me (in getting Gnucash to work via macports) I thought I should open a ticket. I have attached the patch I used to correct the issue in my installation. The patch includes a long comment with further technical details.
Thanks for looking into whether this patch or a similar fix can be incorporated into a future release of DBus. Yours, Glen
Patch 21522, "proposed patch to handle >17 groups on Mac OS X 10.5":