logo       

Illegal instruction in getgrnam_r (): msg#00060

lang.haskell.glasgow.bugs

Subject: Illegal instruction in getgrnam_r ()

Hey.

Here is a little program that produces some interesting results
on at least 2 platforms. Both systems were using 6.0.1.

This (silly) program works on x86-linux. It produces an illegal
instruction SIGILL on a sparc, and there is some OS-related
problem on FreeBSD and OpenBSD (which is my issue, I know). The
sparc problem is the more interesting of the two:

$ uname -msr
SunOS 5.6 sun4u

$ ghc -package unix bug.hs
$ ./a.out
zsh: illegal hardware instruction (core dumped) ./a.out

$ gdb a.out
GNU gdb 5.0
[..]
This GDB was configured as "sparc-sun-solaris2.6"...
(gdb) run
Starting program: /tmp_amd/pill0/import/1/dons/a.out

Program received signal SIGILL, Illegal instruction.
0x12050 in getgrnam_r ()


And on FreeBSD:

$ uname -msr
FreeBSD 5.0-RELEASE i386

$ ghc -package unix bug.hs
$ ./a.out

Fail: System.Posix.User.getGroupEntryForName: not supported


And on OpenBSD:

$ uname -msr
OpenBSD 3.4 i386

$ ghc -package unix bug.hs
$ ./a.out

Fail: unsupported operation
Action: getGroupEntryForName
Reason: Result too large


This last entry doesn't produce anything interesting in a quick
gdb run. I don't have time to debug this today, but thought it
useful to record this data point. Perhaps there should be a
testsuite case for getgrnam_r() (I don't recall seeing one) ?

Ciao,
Don


The program:
------------------------------------------------------------------------

module Main(main) where

import System.IO
import System.Posix.User
import System.Posix.Files

main = do
let file = "/tmp/f"
writeFile file "abc"
chgrp "nobody" file

chgrp :: String -> String -> IO ()
chgrp group file = do
user <- getRealUserID
(GroupEntry _ gid _ ) <- getGroupEntryForName group
setOwnerAndGroup file user gid


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise