[Hackage] #473: Cabal-1.6 does not work on Windows with ghc-6.6.x
#473: Cabal-1.6 does not work on Windows with ghc-6.6.x ----------------------------------+----------------------------------------- Reporter: duncan | Owner: Type: defect | Status: new Priority: normal | Milestone: Cabal-1.6 Component: Cabal library | Version: 1.6.0.1 Severity: normal | Keywords: Difficulty: very easy (<1 hour) | Ghcversion: 6.6.1 Platform: Windows | ----------------------------------+----------------------------------------- http://haskell.org/pipermail/cabal-devel/2009-January/004622.html The problem is the `writeFileAtomic` function calls the compat version of `openNewBinaryFile` and that fails on Windows with ghc-6.6. Specifically it is the `fdToHandle` that throws the exception. The crux is: {{{ fd <- withCString filepath $ \ f -> c_open f oflags 0o666 h <- fdToHandle (fromIntegral fd) }}} However `fdToHandle` fails with the exception {{{ fdGetMode: invalid argument }}} This is because in ghc-6.6.x, the `fdToHandle` calls `fdGetMode` and passes the result to `openFd`: {{{ fdToHandle :: FD -> IO Handle fdToHandle fd = do mode <- fdGetMode fd let fd_str = "<file descriptor: " ++ show fd ++ ">" openFd fd Nothing False{-XXX!-} fd_str mode True{-bin mode-} }}} However `fdGetMode` is described thusly: {{{ fdGetMode fd = do #if defined(mingw32_HOST_OS) || defined(__MINGW32__) -- XXX: this code is *BROKEN*, _setmode only deals with O_TEXT/O_BINARY }}} Note that the `openBinaryTempFile` function does not call `fdToHandle`, instead it bypasses it and calls `openFd` directly. The `openFd` function is exported from `GHC.Handle` so we could use it in `Distribution.Compat.TempFile` -- Ticket URL: <http://hackage.haskell.org/trac/hackage/ticket/473> Hackage <http://haskell.org/cabal/> Hackage: Cabal and related projects
#473: Cabal-1.6 does not work on Windows with ghc-6.6.x ----------------------------+----------------------------------------------- Reporter: duncan | Owner: Type: defect | Status: closed Priority: normal | Milestone: Cabal-1.6 Component: Cabal library | Version: 1.6.0.1 Severity: normal | Resolution: fixed Keywords: | Difficulty: very easy (<1 hour) Ghcversion: 6.6.1 | Platform: Windows ----------------------------+----------------------------------------------- Changes (by duncan): * status: new => closed * resolution: => fixed Comment: {{{ Thu Jan 22 17:21:00 GMT 2009 Duncan Coutts <duncan@haskell.org> * Fix openNewBinaryFile on Windows with ghc-6.6 fdToHandle calls fdGetMode which does not work with ghc-6.6 on windows, the workaround is not to call fdToHandle, but call openFd directly. Bug reported by Alistair Bayley, ticket #473. }}} This still needs to be pushed to the 1.6 branch. -- Ticket URL: <http://hackage.haskell.org/trac/hackage/ticket/473#comment:1> Hackage <http://haskell.org/cabal/> Hackage: Cabal and related projects
participants (1)
-
Hackage