fosskers/aura — pull request #121 by nc6 (2013-06-28 13:31:05+00:00)
Title: Fix moving files across drives

A couple of changes here. The first just fixes a typo in `moveToSourcePath`. The second may be a bit more contentious - aura's 'mv' command can fail when trying to move across drives, since it delegates to 'renameFile'. Usually this isn't a problem, since it's unlikely that different parts of the '/var/cache/aura' subtree will be mounted in separate places - this was the solution pursued in issue #8. Unfortunately, I ran across it when trying to share a package source cache '/var/cache/aura/src' over multiple linux containers through a bind mount. In this case, the move fails and crashes aura.

This fix attempts to rename the file, and if that fails due to an unsupported operation, resorts to copying the file and removing the old one instead. All other failures continue to be thrown as usual, so this should only affect the multiple mounts scenario. Unfortunately, this particular error is GHC specific, so I've introduced a GHC dependency. The aura package has a dependency on GHC, so hopefully this is okay. If not, it would be possible to catch a more general class of errors and avoid the GHC dependency.