Final bikeshedding call: Fixing Control.Exception.bracket

Merijn Verstraaten merijn at inconsistent.nl
Thu Nov 13 03:53:35 UTC 2014


> On 12 Nov 2014, at 19:47, Eric Mertens <emertens at gmail.com> wrote:
> 
> It's not vulnerable to the same issue because hClose can't block (as far as I know) because it can't be in use at the time that clean up is running.

Ah, you're right, but that's just because in this case it was possible to redesign the code not to expose the Handle. However, the fact that this happens to be possible in this small test program, doesn't guarantee all programs can be restructured this way (me and Eyal have both run into situations where we couldn't).

Additionally, the only reason you know this is safe is because you've inspected (or assumed) the code dealing with handles and hClose and have checked that it isn't somehow sharing the Handle behind your back. Unless you propose every person always makes this analysis for any IO allocation operations they use (I hope not!), this remains an issue. 

Cheers,
Merijn


More information about the Libraries mailing list