Just to clarify, there are no symlinks around. Only simple directories, so the canonical name is correct.
The same 'test-canonical-name' works perfect for "../dir4", where dir4 exists. But it fails for