[Haskell-cafe] readFile problem

Stefan Aeschbacher haskell at aeschbacher.ch
Mon Jan 8 05:04:50 EST 2007


I am writing a network server in haskell. Lately I seem to have
introduced a new bug. On Linux, when a client closes the connection to
the server, the server dumps core. On Windows, the error message there
is way different from the core dump on Linux. It says:

application.exe: config.xml: openFile: does not exist (No such file or

I use readFile to read the config file. I tried to print out the
config file after it is read to make sure that it is completely read.
I only load this config file exactly once during program
initialization. The config is used long before the crash. I printed
the current working dir in the exception handler and there is
something interesting. Instead of the path to the application, it is

There are many things i do not understand. Why the different behaviour
on Linux and Windows? Shouldn't an exception be thrown on Linux
instead of a core dump? I don't use any unsafePerformIO or foreign
calls. Why the changed path? I never change working directory in my
code. Why is a function (-> reading the config file) re-evaluated at a
later point in time?

How can I debug such a problem?

My environement is ghc 6.6 on Ubuntu or Windows XP.

thanks for any ideas


More information about the Haskell-Cafe mailing list