Fix test-at-point path for a symlinked project root - #2183
Merged
Conversation
`projectile-compilation-dir` resolves symlinks and `buffer-file-name` does not, so when a project is reached through a symlinked path the two disagree about where the root is and the relative name climbs out of the project: go test -run '^TestApplyDiscount$' ./../../../../../tmp/checkout/pricing directory /tmp/checkout/pricing outside main module Every rule gets the same relative name, so this was not Go-specific. Anything under /tmp on macOS hits it, as does a symlinked ~/src. The name is still taken as spelled first, which is what keeps a file under a symlinked subdirectory working - resolving that one is what would send it out of the project. Only when the spelled name escapes do both sides get resolved, and that result is used only if it stays inside.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
projectile-compilation-dirresolves symlinks andbuffer-file-namedoesn't, so a project reached through a symlinked path made the two disagree about where the root is. The relative name then climbed out of the project and the test runner rejected it:Every rule builds its file argument the same way, so this isn't Go-specific. Anything under
/tmpon macOS hits it, as does a symlinked~/src.The name is still taken as spelled first. That's what keeps a file under a symlinked subdirectory working, since resolving that one is what would send it out of the project. Only when the spelled name escapes are both sides resolved, and that result is used only if it stays inside.
eldev test)M-x checkdocwarnings