Ticket #1655 (closed bug: fixed)
System.Posix.User.getGroupEntryForName incorrect error for non-existent group
|Reported by:||Eelis||Owned by:||igloo|
|Operating System:||Linux||Architecture:||x86_64 (amd64)|
|Type of failure:||Difficulty:||Easy (less than 1 hour)|
|Test Case:||getGroupEntryForName||Blocked By:|
The following program:
import System.Posix.User main :: IO () main = getGroupEntryForName "monkeys" >> return ()
gives the following output (on a system without a "monkeys" group):
*** Exception: getGroupEntryForName: failed (Success)
The "(Success)" part is obviously wrong.
The problem is that the getGroupEntryForName implementation throws errno if getgrnam_r wrote NULL to the pointer pointed to by its last parameter, while the getgrnam_r specification makes no guarantees about errno being set in that case.