This patch seems to fix this issue. Turns out that the code didn't take into consideration the case when the directory we want to copy is itself a symlink.