[GHC] #11180: A program writing to a read-only stdout should not succeed

GHC ghc-devs at haskell.org
Tue Dec 8 22:13:37 UTC 2015


#11180: A program writing to a read-only stdout should not succeed
-------------------------------------+-------------------------------------
        Reporter:  thomie            |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by thomie):

 Or don't do any automatic flushing of handles on exit. Teach people to
 always flush/close handles manually, as they have to do already with other
 handles but stdout/stderr, as noted in commit message
 47f3a578a22ed5942ed44ddc81dfd362060e78b4:

 {{{
 Author: simonmar <unknown>
 Date:   Fri Jan 21 16:02:48 2005 +0000

     [project @ 2005-01-21 16:02:47 by simonmar]
     Don't try to run finalizers at program exit.  This turned out to be
     hard if not impossible to do in general, so now we don't attempt it at
     all.

     The Main.main wrapper, previously called runIO and now called
     runMainIO, flushes stdout and stderr before exiting.  This should
     catch most cases where programs rely on Handles being flushed at
     program exit, but note that now if you simply drop a Handle in your
     program, there's no guarantee it'll be flushed on exit.  If the
     punters complain enough, I suppose we could implement a global
     Handle table and flush them all at exit... I'd rather not do this if
     possible, though.  Better to teach people to close their Handles
     properly.

 }}}

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


More information about the ghc-tickets mailing list