hello, while looking at the program henk posted a few days ago, i run into a rather weird bug in hugs, where it seems to be mixing IO handles. the problem seems to happen with versions of hugs as early as Nov 2002. it occurs on linux (Mandrake 9.1 and Redhat 9.0). this is how one can reproduce the problem: 1. place the three attahced files in a directory 2. runhugs ReadALot.hs hugs is supposed to read files names from a file (dir.dat) and then read each of these files. at some point it gets confused between the contents of "dir.dat" and the file it just read. another way to get the problem is like this: 1. hugs ReadALot.hs 2. Main> main the same thing happens. however if "main" is evaluated again, the problem does not seem to occur. yet another variation on the probelm occurs, if one of the lines in "dir.dat" is deleted (at the moment it has 41 line, but try it with 40). then "strace" reveals that hugs seems to be trying to read from stdin. bye iavor -- ================================================== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU | | http://www.cse.ogi.edu/~diatchki | ================================================== main = print . map length =<< mapM readFile . lines =<< readFile "dir.dat" bad test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test
On Fri, Oct 10, 2003 at 01:36:20PM -0700, Iavor Diatchki wrote:
while looking at the program henk posted a few days ago, i run into a rather weird bug in hugs, where it seems to be mixing IO handles. the problem seems to happen with versions of hugs as early as Nov 2002. it occurs on linux (Mandrake 9.1 and Redhat 9.0).
The handle table was being clobbered after it was resized to fit the 41st handle. Now fixed in CVS.
The handle table was being clobbered after it was resized to fit the 41st handle. Now fixed in CVS.
It seems like it is overly hard to test this kind of thing - you pretty much have to know there is a bug before you'll write a test case that opens that many handles. Would it be worthwhile reducing the initial size of all these resizable tables so that normal programs would test the resizing code? Fail early, fail often! -- Alastair
On Mon, Oct 13, 2003 at 05:54:20PM +0100, Alastair Reid wrote:
The handle table was being clobbered after it was resized to fit the 41st handle. Now fixed in CVS.
It seems like it is overly hard to test this kind of thing - you pretty much have to know there is a bug before you'll write a test case that opens that many handles.
Would it be worthwhile reducing the initial size of all these resizable tables so that normal programs would test the resizing code?
Fail early, fail often!
There are four such tables, and the other three already start small.
participants (3)
-
Alastair Reid -
Iavor Diatchki -
Ross Paterson