FS#9419 - GHC's setResourceLimits fails on archlinux

Attached to Project: Arch Linux
Opened by Johannes Schaub (litb) - Thursday, 31 January 2008, 21:26 GMT
Last edited by Vesa Kaihlavirta (vegai) - Wednesday, 07 January 2009, 10:06 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Vesa Kaihlavirta (vegai)
Architecture i686
Severity High
Priority Normal
Reported Version 2007.08-2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
GHC does execute calls to setResourceLimits correctly on Archlinux , but does on other distributions. see the following samples:

-- snip
import System.Posix

kibi, mebi :: Integral a => a
kibi = 1024
mebi = kibi * kibi

main = do
setResourceLimit ResourceOpenFiles $
ResourceLimits (ResourceLimit 60)
(ResourceLimit 60)
-- snap
-- output snip:
a.out: setResourceLimit: invalid argument (Invalid argument)
-- snap

see this C program and note how it doesn't fail:

/* snip */
#include <sys/time.h>
#include <sys/resource.h>
#include <stdio.h>
#include <stdlib.h>

int main() {
struct rlimit rl = { 60, 60 };
if( setrlimit (RLIMIT_NOFILE, &rl) == -1) {
perror ("Error setting limit");
exit (-1);
}
return 0;
}
/* snap */


Additional info:
* package version(s)
i am using ghc 6.8.2

Steps to reproduce:
copy the code above (the first snipped) into a file pwns.hs and do:
# snip
runhaskell pwns.hs
# snap
see how it fails

Have a nice day, greez litb
This task depends upon

Closed by  Vesa Kaihlavirta (vegai)
Wednesday, 07 January 2009, 10:06 GMT
Reason for closing:  Upstream
Comment by Johannes Schaub (litb) - Thursday, 31 January 2008, 21:29 GMT
i'm sorry, it seems to kill the indentation of haskell code. here is one that works:

import System.Posix
main = do setResourceLimit ResourceOpenFiles $ ResourceLimits (ResourceLimit 60) (ResourceLimit 60)
Comment by Johannes Schaub (litb) - Thursday, 31 January 2008, 21:31 GMT
i'm sorry again guys, but of course i mean "GHC doesn't execute calls to setResourceLimits correctly on Archlinux" .
Comment by Simo Leone (neotuli) - Saturday, 16 February 2008, 03:40 GMT
i don't speak haskell per se, but are you sure the other distro's you tried are runnng the latest version of ghc?
Comment by Johannes Schaub (litb) - Saturday, 16 February 2008, 13:05 GMT
The bug came up in #geordi in irc.freenode.net , where other archusers told that they have problems. I tried it and i got that bug too. Other users, regardless whether they use the same version or a later one, don't encounter that bug.
Comment by Johannes Schaub (litb) - Saturday, 16 February 2008, 13:05 GMT
i mean "Other users with other distributions" of course. sorry for those silly typos
Comment by Roman Kyrylych (Romashka) - Sunday, 17 February 2008, 15:56 GMT
this may be related to our kernel configuration somehow.
Comment by Johannes Schaub (litb) - Sunday, 02 March 2008, 19:03 GMT
i suspect it has something to do with argument passing using the registers or something like this. i have debugged it, and seen that one argument was passed on a register (don't remember anymore which one). tho only a wild guess, but the only one i can think about.
Comment by Vesa Kaihlavirta (vegai) - Monday, 21 July 2008, 20:09 GMT
(Just commenting this one as ghc was assigned to me recently)

Seems to be a known upstream bug, to be fixed in the next major release: http://hackage.haskell.org/trac/ghc/ticket/2038

Loading...