Revert "Revert "use realpath of root.""

This reverts commit 0c4f582b1aa883de3ae39367ddb2b2820dd16835.