TEST: create intermediate catalog between legacy ones
remove read_only_ from catalog (polymorphism)
FIX: cosmetical things
FIX: nested catalog cache (encapsulation violated)
improve debug logging for AddEntry
create_big_file() for test_functions
TEST: improve regression test 547 and add 548
FIX: integration test case 546
return const ref of nested catalog cache
consume const ref instead of copying
Merge pull request #412 from reneme/fix-create_intermediate_nested

FIX: Create Intermediate Nested Catalogs

This fixes a severe problem in the Catalog respectively WritableCatalog classes that prevented the successful creation of nested catalogs between two already present nested catalogs. See CVM-608.

The problem was, that the result of Catalog::ListNestedCatalogs() was cached inside Catalog. A pointer directly to that cache was returned and used in the WritableCatalogManager. Creating intermediate nested catalogs caused an update of the internal cache in Catalog while the exact same data structure was iterated in the WritableCatalogManager. This lead to corrupted data due to an undefined memory state. Fortunately the bug only shows up on the server side, since read-only catalogs in the client fill their cache once but never update it. You shall never violate encapsulation in your classes!

I changed the caching logic in a way, that it always returns a copy of the cached list. Since we are caching a database query here, the small efficiency penalty shouldn't be a big deal. However some user code needed to be adapted to the new signature of Catalog::ListNestedCatalogs().

Additionally this contains two regression tests that reproduced the error.