libroot_build: make path normalization more robust

In case we don't have read permission for an ancestor directory, we try
to guess the path from the CWD.