On FreeBSD using ghc 4.04, long running commands executed with
System.system are being interrupted by virtual alarms leading to 
errors such as:

o Fail: interrupted
  Action: system
  Reason: system command interrupted rm -f xxx yyy
  
o Virtual timer expired
  
o gcc: Internal compiler error: program cpp got fatal signal 26
  
(Depending on which command was interrupted.)


After looking at ghc 4.02's libraries for a while (it's all I had
around), it looks as though ghc-4.02/ghc/lib/std/cbits/system.c should
mask the SIGVTALRM signal after executing fork and before executing
exec*.  (Obviously it should also mask any other signals not set by
the users code.) 

[Incidentally, I'm not sure why this SIGVTALRM is enabled though since
the online documentation for -C says that context switches happen on
heap checks not on timeouts.]


A workaround for now is to use this:

  System.system ("trap '' 26; " ++ xs)

instead of 

  System.system xs

though you could be really unlucky and get a signal before the trap
is disabled.

--
Alastair Reid

ps I'm guessing that problem has been in the code ever since it was
   written - wonder why it's never hit anyone before?

Reply via email to