Here is another bug report from Havoc. Please take a look at it. Please CC [EMAIL PROTECTED] on replies (note that the number is different from the bug report I forwarded yesterday). I believe you already know the reasons ;-) - ajk ----- Forwarded message from Havoc Pennington <[EMAIL PROTECTED]> ----- Subject: Bug#45581: openFile has questionable error handling Reply-To: Havoc Pennington <[EMAIL PROTECTED]>, [EMAIL PROTECTED] Date: Mon, 20 Sep 1999 09:45:33 -0400 (EDT) From: Havoc Pennington <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Package: hugs Version: 98.199905-4 Hi, This may be a wishlist item, but here goes. Using the same program from bug 45546 to test: $ ./replace.lhs foo bar baz "Failed to open file foo: Illegal operation" $ This should be "No such file or directory"; I get the same thing opening a file for writing when the error should be "Permission denied." Looking at the source code for Hugs, it appears that it always returns the same vague error in iomonad.c, fopenPrim(). A little switch on errno would allow Hugs to return the errors given in the Haskell Report (such as isDoesNotExistError or isPermissionError) and would save users a lot of time wondering what's going on. A secondary problem: Hugs seems to have a hard-coded limit of 40 open file handles in storage.c, openHandle() which is also used by the openFile function; since Linux allows over 1000 open files, this is a bit limiting. Also, if you exceed the limit the openHandle function aborts, while for "real world" programs you should have a chance to recover (errno == ENFILE). Suggested fix is to check errno and return a sensible error if the actual number of descriptors is exceeded. It looks like it will also be necessary to dynamically size the "handles" table in storage.c. Thanks, Havoc ----- End forwarded message ----- -- %%% Antti-Juhani Kaijanaho % [EMAIL PROTECTED] % http://www.iki.fi/gaia/ %%% "" (John Cage)
[[email protected]: Bug#45581: openFile has questionable error handling]
Antti-Juhani Kaijanaho Tue, 21 Sep 1999 12:55:34 +0200 (MET DST)
