Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure tmpdir usage internally is always the realpath #870

Merged
merged 1 commit into from
Jun 23, 2021

Conversation

stefanpenner
Copy link
Collaborator

As it turns out os.tmpdir can point to a symlink, which can introduce path ambiguity. Some of our algorithms are sensitive to path equality, and introducing a path with indirection via a symlink can confuse the system. For example shared-internal’s explicit-relative algorithm fails to create the expected relative paths for externals as it attempts to compare /private/var/folders/… with /var/folders/…

The algorithms in question are currently not coupled to the state of the filesystem, and most likely should remain decoupled, this then implies the inputs should be carefully considered and we should not introduce spurious ambiguity where the state enters the system. Given that, ensuring a stable + realpath’d tmpdir is appropriate.

@stefanpenner stefanpenner requested a review from ef4 June 23, 2021 19:14
As it turns out os.tmpdir can point to a symlink, which can introduce path ambiguity. Some of our algorithms are sensitive to path equality, and introducing a path with indirection via a symlink can confuse the system. For example shared-internal’s explicit-relative algorithm fails to create the expected relative paths for externals as it attempts to compare /private/var/folders/… with /var/folders/…

The algorithms in question are currently not coupled to the state of the filesystem, and most likely should remain decoupled, this then implies the inputs should be carefully considered and we should not introduce spurious ambiguity where the state enters the system. Given that, ensuring a stable + realpath’d tmpdir is appropriate.
@ef4 ef4 merged commit b525bd5 into master Jun 23, 2021
@ef4 ef4 deleted the tmpdir-real-path-fun branch June 23, 2021 19:55
@rwjblue rwjblue added the bug Something isn't working label Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants