Package: ghc6
Version: 6.6.1-2
Severity: normal

If a program is printing a lot of strings rapidly, and is run with
runghc, sometimes ctrl-c won't interrupt it. If ctrl-c is then hit a
second time, it says this and hangs:

<interactive>: exception :: GhcException

strace shows:

waitpid(23028,  <unfinished ...>

Example program to reproduce the problem follows. (Have pity, it's my
first haskell code.) If main is changed to use faststarAt instead of
starAt, the bug is much less likely to appear. I see it about 50% of the
time using starAt, and have never seen it yet using faststarAt. (If I
compile either version, it works fine.)

x s n = take n (repeat s)

putStrs = putStr.unlines

isStarAt a b char
        | a == b || a == b-1    = '*'
        | otherwise             = char

starAt pos s = [ isStarAt pos i (s !! (i-1)) | i <- [1..length(s)] ]
faststarAt pos s = (take (pos-1) s) ++ "**" ++ (drop (pos+1)  s)

plot i = 40 + 38 * sin(i / 9)

name = unwords $ "JOEY HESS" `x` 8

main = putStrs $ [ starAt (truncate $ plot i) name | i <- [1..]]

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-3-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages ghc6 depends on:
ii  gcc                       4:4.2.2-1      The GNU C compiler
ii  haskell-utils             1.9            Utilities used by the Debian Haske
ii  libc6                     2.7-5          GNU C Library: Shared libraries
ii  libgmp3-dev               2:4.2.2+dfsg-1 Multiprecision arithmetic library 
ii  libgmp3c2                 2:4.2.2+dfsg-1 Multiprecision arithmetic library
ii  libncurses5               5.6+20071215-1 Shared libraries for terminal hand
ii  libreadline5              5.2-3          GNU readline and history libraries
ii  libreadline5-dev          5.2-3          GNU readline and history libraries
ii  perl [perl5]              5.8.8-12       Larry Wall's Practical Extraction 

ghc6 recommends no packages.

-- no debconf information

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature

Reply via email to