
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
http://www.opengroup.org/onlinepubs/9699919799/functions/getgrgid.html
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! Cheers, Simon