
#11836: Hello World Bug - silent stdout errors -------------------------------------+------------------------------------- Reporter: bit | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #11180 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by siddhanathan): The first case is interesting. The following should fail as intended: {{{#!hs import System.IO main = do hSetBuffering stdout (BlockBuffering (Just 14)) putStrLn "Hello, World!" }}} {{{ $ ghc hello.hs [1 of 1] Compiling Main ( hello.hs, hello.o ) Linking hello ... $ ./hello > /dev/full ; echo $? hello: <stdout>: commitBuffer: resource exhausted (No space left on device) 1 }}} But one small change can make it silently succeed: {{{#!hs import System.IO main = do hSetBuffering stdout (BlockBuffering (Just 15)) putStrLn "Hello, World!" }}} {{{ $ ghc hello.hs [1 of 1] Compiling Main ( hello.hs, hello.o ) Linking hello ... $ ./hello > /dev/full ; echo $? 0 }}} In the absence of an explicit statement for setting the buffering mode, the code might be similar to this: {{{#!hs import System.IO main = do hSetBuffering stdout (BlockBuffering Nothing) putStrLn "Hello, World!" }}} in which case, GHC may resort to using a fairly large number like `dEFAULT_CHAR_BUFFER_SIZE`. To verify that this is the case, you could try the following: {{{#!hs main = putStrLn $ replicate (1024*8) '.' }}} and now things are consistent again: {{{ $ ghc hello.hs [1 of 1] Compiling Main ( hello.hs, hello.o ) Linking hello ... $ ./hello > /dev/full ; echo $? hello: <stdout>: commitBuffer: resource exhausted (No space left on device) 1 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11836#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler