[Haskell-cafe] Windows: openFile gives permission denied when file in use

Chris Wong chrisyco+haskell-cafe at gmail.com
Thu Dec 29 04:10:03 CET 2011


On Thu, Dec 29, 2011 at 2:45 PM, Antoine Latter <aslatter at gmail.com> wrote:
> [...]
>
> When GHC opens files for reading, it asks windows to disallow write
> access to the file. I'm guessing that Framemaker has the file open for
> writing, so GHC can't get that permission.

In fact, this is required behavior according to the Haskell Report:

> Implementations should enforce as far as possible, at least locally to the Haskell process, multiple-reader single-writer locking on files. That is, there may either be many handles on the same file which manage input, or just one handle on the file which manages output.

I guess on Windows, "as far as possible" means locking it across the
whole system.

(See http://www.haskell.org/onlinereport/haskell2010/haskellch41.html#x49-32800041.3.4
for the gory details)

-- Chris



More information about the Haskell-Cafe mailing list