Normalize all paths after reading settings file

readlink is now replaced by the internal function realpath, which both
fixes osx incompatibility and the unintentional symlink dereference of
$SYMLINK_PATH.
This also fixes removal of the lock file after a hook has changed the CWD
because the lock file path is now made absolute immediately after reading
the settings file.