cvmfs/cvmfs — pull request #374 by reneme (2014-01-31 14:25:24+00:00)
Title: FIX: Replace File or Symlink by Directory Lead to Publish Crash

This fixes the following error condition:
We have a regular file or a symlink 'foo' in a CVMFS revision. In the following transaction we replace 'foo' by a directory.

Internally the publishing process determines what to do by comparing readonly and scratch dir. When it finds an opaque directory in the scratch dir and the readonly dir contains a dirent with the same name, it tries to replace this directory. I.e. calling `RemoveRecursively()` on the old dirent and `Add()` on the new directory.

The problem arises, when the old dirent actually was no directory but a symlink or a regular file. `RemoveRecursively()` will try to `opendir()` a regular file and die.

This fixes the issue by determining the required 'delete'-action in `Replace()` on the overwritten dirent not on the overwriting one.

Additionally it adds a regression test.