[GHC] #9266: getDirectoryContents blow its stack in a huge directory
GHC
ghc-devs at haskell.org
Fri Jul 4 20:37:47 UTC 2014
#9266: getDirectoryContents blow its stack in a huge directory
-------------------------------------------+-------------------------------
Reporter: joeyhess | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: libraries/directory | Version: 7.8.2
Keywords: | Operating System: Linux
Architecture: Unknown/Multiple | Type of failure:
Difficulty: Easy (less than 1 hour) | None/Unknown
Blocked By: | Test Case:
Related Tickets: | Blocking:
-------------------------------------------+-------------------------------
Once a directory has around 2 million files in it, a lack of an
accumulator in getDirectoryContents (unix version only; windows already
has an acc) causes it to blow the stack:
{{{
joey at darkstar:‾/src/git-annex>cat test.hs
import System.Directory
main = do
l <- getDirectoryContents "/tmp/big"
print (null l)
joey at darkstar:‾/src/git-annex>ghc --make -O2 test
[1 of 1] Compiling Main ( test.hs, test.o )
Linking test ...
joey at darkstar:‾/src/git-annex>./test
Stack space overflow: current size 8388608 bytes.
Use `+RTS -Ksize -RTS' to increase it.
}}}
I suggest the attached patch.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9266>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list