Fix canonical path vs symlink comparison #731
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes the macOS tests, which were broken by pull request #726 . The issue occurs because on macOS, /var and /tmp are symbolic links to /private/var and /private/tmp. When calling
abspath
on a relative path or filename, we get the canonical (real) path. However, theTemporaryDirectory()
function used in the tests returns a symbolic link that is already an absolute path (starting with /var), so callingabspath
on it does nothing.I also replaced the
abspath
call when processing the ignored directories withrealpath
to avoid a mismatch between a symlink and the canonical path of the same directory.Everything seems to be working now, but I'm still a bit worried that there might be another comparison between symlink paths and real paths elsewhere in the code, since
abspath
is used in multiple places. A more comprehensive solution might be to replace allabspath
calls withrealpath
, but I didn't want to make such an intrusive change to the codebase.