patch applied (cabal-install): Allow cabal-install to re-install itself on Windows

Duncan Coutts duncan.coutts at
Tue Aug 12 18:16:55 EDT 2008

Tue Aug 12 14:51:38 PDT 2008  Duncan Coutts <duncan at>
  * Allow cabal-install to re-install itself on Windows
  This is a fairly heavyweight solution, but then it's quite
  a nasty problem. What we do is when we notice that we're
  about to install something in place of our own .exe file,
  we move our exe file out of the way (but in the same dir).
  Then after we've installed the new exe we call it and ask
  it to delete the old file (so we do not litter the bin dir
  with lots of old versions). That requires synchronising
  between the old and new programs and for the new program
  to understand a command to do the syncing and deleting of
  the old program. Lots of Win32 FFI imports. :-(
  On the plus side it seems to work and is transparent to
  the user and the rest of cabal-install. In particular the
  actual file-installation code (which is burried deep
  within Cabal) does not need to know about the special case
  of installing over our own exe file.

    M ./Distribution/Client/Install.hs -10 +55
    A ./Distribution/Client/Win32SelfUpgrade.hs
    M ./Main.hs -2 +16
    M ./cabal-install.cabal +1

View patch online:

More information about the cabal-devel mailing list