id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
4993,getDirectoryContents goes into an infinite loop,bos,,"This is a really peculiar bug. Prepare for some fun!

I'm using a tool called boxgrinder to create a virtual machine image for running in Amazon's EC2 compute environment. The virtual machine is intended to contain GHC and a few libraries. I'm running boxgrinder itself in an EC2 virtual machine.

boxgrinder works fine on a 64-bit virtual machine, when creating a 64-bit virtual machine, but gets stuck forever when I try to run it in a 32-bit VM to create a 32-bit image.

The reason for boxgrinder hanging is that when installing {{{GHC}}}, {{{ghc-pkg}}} is going into an infinite loop. I've got a super simple reproduction:

{{{
import System.Directory

main = getDirectoryContents ""."" >>= print
}}}

If compiled, the above command runs fine in the regular 32-bit system image, but not in the {{{chroot}}} filesystem created by boxgrinder. In there, it goes into an infinite loop right after reading some of the directory contents:

{{{
... everything looks normal ...
open(""."", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
getdents64(3, /* 25 entries */, 32768)  = 640
getdents64(3, /* 0 entries */, 32768)   = 0
--- SIGVTALRM (Virtual timer expired) @ 0 (0) ---
sigreturn()                             = ? (mask now [])
--- SIGVTALRM (Virtual timer expired) @ 0 (0) ---
sigreturn()                             = ? (mask now [])
--- SIGVTALRM (Virtual timer expired) @ 0 (0) ---
sigreturn()                             = ? (mask now [])
... and no more life! ...
}}}

I have verified that this infinite loop occurs both with 6.12.3 and 7.0.2 RC2. Investigating further at the moment.",bug,closed,normal,,libraries/directory,7.0.1,invalid,,,Linux,x86,Runtime crash,,,,,
