[GHC] #9266: getDirectoryContents blow its stack in a huge directory

GHC ghc-devs at haskell.org
Fri Jul 4 21:30:45 UTC 2014


#9266: getDirectoryContents blow its stack in a huge directory
-------------------------------------+-------------------------------------
        Reporter:  joeyhess          |            Owner:
            Type:  bug               |           Status:  new
        Priority:  normal            |        Milestone:
       Component:                    |          Version:  7.8.2
  libraries/directory                |         Keywords:
      Resolution:                    |     Architecture:  Unknown/Multiple
Operating System:  Linux             |       Difficulty:  Easy (less than 1
 Type of failure:  None/Unknown      |  hour)
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+-------------------------------------

Comment (by joeyhess):

 I've gotten it to work with unsafePerformIO. I can provide a patch, but I
 don't think you'l find this approach acceptable. The problem is that any
 errors would be deferred until the list is consumed, ie the readFile
 problem all over again.

 With that said, it does work; the test program now uses only 1776kb, and a
 variant that gets the length of the list behaves similarly well.

 I wonder if it would be better to add a overDirectoryContents :: FilePath
 -> (FilePath -> IO ()) -> IO () or something like that? This would work in
 my particular use case, at least.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9266#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list