git-annex/doc/install
Joey Hess 345ee4f37c Switch to MonadCatchIO-transformers for better handling of state while catching exceptions.
As seen in this bug report, the lifted exception handling using the StateT
monad throws away state changes when an action throws an exception.
http://git-annex.branchable.com/bugs/git_annex_fork_bombs_on_gpg_file/
  .. Which can result in cached values being redundantly calculated, or other
     possibly worse bugs when the annex state gets out of sync with reality.

This switches from a StateT AnnexState to a ReaderT (MVar AnnexState).
All changes to the state go via the MVar. So when an Annex action is
running inside an exception handler, and it makes some changes, they
immediately go into affect in the MVar. If it then throws an exception
(or even crashes its thread!), the state changes are still in effect.

The MonadCatchIO-transformers change is actually only incidental.
I could have kept on using lifted-base for the exception handling.
However, I'd have needed to write a new instance of MonadBaseControl
for the new monad.. and I didn't write the old instance.. I begged Bas
and he kindly sent it to me. Happily, MonadCatchIO-transformers is
able to derive a MonadCatchIO instance for my monad.

This is a deep level change. It passes the test suite! What could it break?

Well.. The most likely breakage would be to code that runs an Annex action
in an exception handler, and *wants* state changes to be thrown away.
Perhaps the state changes leaves the state inconsistent, or wrong. Since
there are relatively few places in git-annex that catch exceptions in the
Annex monad, and the AnnexState is generally just used to cache calculated
data, this is unlikely to be a problem.

Oh yeah, this change also makes Assistant.Types.ThreadedMonad a bit
redundant. It's now entirely possible to run concurrent Annex actions in
different threads, all sharing access to the same state! The ThreadedMonad
just adds some extra work on top of that, with its own MVar, and avoids
such actions possibly stepping on one-another's toes. I have not gotten
rid of it, but might try that later. Being able to run concurrent Annex
actions would simplify parts of the Assistant code.
2013-05-19 14:16:36 -04:00
..
ArchLinux reorg OSX bugs 2012-11-26 13:35:43 -04:00
cabal reorg 2013-05-13 13:40:41 -04:00
Debian Added a comment 2012-11-23 21:38:29 +00:00
OSX Added a comment 2013-04-18 02:05:34 +00:00
Android.mdwn last few fixes to install-haskell-packages 2013-05-08 22:33:30 -04:00
ArchLinux.mdwn add manual cabal instuctions, I'm told the AUR may have dependency issues 2012-05-27 20:37:14 -04:00
cabal.mdwn reorg 2013-05-13 13:40:41 -04:00
Debian.mdwn update 2013-04-27 11:21:58 -04:00
Fedora.mdwn Added instructions on using cabal to install git-annex on Fedora 18 2013-04-02 15:22:44 +00:00
FreeBSD.mdwn update url 2011-11-22 22:13:11 -04:00
fromscratch.mdwn Switch to MonadCatchIO-transformers for better handling of state while catching exceptions. 2013-05-19 14:16:36 -04:00
Gentoo.mdwn format 2012-05-26 23:47:55 -04:00
Linux_standalone.mdwn fix link 2013-04-06 16:55:07 -04:00
NixOS.mdwn move 2012-05-02 13:17:51 -04:00
openSUSE.mdwn update openSUSE install info 2013-03-23 01:16:51 +00:00
OSX.mdwn reorganize osx app, so it can be put in PATH 2013-03-20 14:01:05 -04:00
ScientificLinux5.mdwn Now uses the Haskell Glob library, rather than pcre-light, avoiding the need to install libpcre. Currently done only for Cabal or when the Makefile is made to use -DWITH_GLOB 2013-02-11 11:47:53 -04:00
Ubuntu.mdwn update, add fmarier PPA 2013-04-27 11:21:48 -04:00
Windows.mdwn fix link 2013-05-17 14:36:16 -04:00