CMS reported that a magic symlink (includes expandable environment variables) in their repository mysteriously became empty. Recreating the symlink's content worked fine and fixed the problem.
Further investigation shows that the symlink must have been corrupted when it's parent directory was moved into a nested catalog. When a nested catalog is created from an existing directory structure, it needs to retain all this existing directory entry information. Unfortunately the sync routine tries to expand the magic symlink and thus corrupts it due to missing environment variables.
This needs one or two regression tests (magic symlink handling in general and in connection with nested catalog mangling) and a proper fix.