System.Posix.User: make get{Group,User}EntryFor* more portable

Simon Marlow marlowsd at
Fri Apr 3 06:30:42 EDT 2009

Matthias Kilian wrote:
> Hi,
> some oddities let the user001 test of the unix package fail on
> getGroupEntryFor*. One reason is that sysconf(_SC_GETGR_R_SIZE_MAX)
> returns 1024 on OpenBSD, while getgr*_r(3) actually need a buffer
> of 1024 + 200 * sizeof(char*) bytes.
> Note that the grBufSize = 2048 workaround in User.hsc did not work
> on 64 bit machines with OpenBSD, even before the _SC_GETGR_R_SIZE_MAX
> sysconf had been introduced.
> Instead of fiddling with stupid numbers again, I just implemented the
> try / enlarge / try harder scheme mentioned for example at
> And I did so for all four functions, just in case there are existing
> problems with other unices (OpenBSD only needs the getGroupEntryFor*
> fixes).
> My Haskell sucks badly, so if someone has a cleaner solution: feel
> free use it instead of my patch ;-)

Looks ok to me.  I'll validate and commit.  Thanks for the patch!


More information about the Libraries mailing list