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

Add path to scratch key #15

Merged
merged 4 commits into from
May 13, 2022
Merged

Conversation

fonsp
Copy link
Contributor

@fonsp fonsp commented Mar 5, 2022

I have a package that uses RelocatableFolders. Currently, (I suspect that) if I run two versions of the package (say, a release, and then a local clone from Pkg.develop) with the same (hash of the) contents of the relocatable folder, then both versions will point to the same folder, in the first version that ran. This is because we the key to get_scratch! is just the content hash.

Besides a wrong stacktrace, this is not really a problem in most cases (because the two folders have the same contents), but it does cause a problem when the contents of the local clone change (e.g. when switching branches) after the package was loaded.

This came up here: fonsp/Pluto.jl#1965 (comment) , where I suspect this happened, although we did not test it. I think that the result from @path in the local clone points to the path in the release (because at load time, their contents were equal).

The solution in this PR is based on /~https://github.com/JuliaPackaging/Scratch.jl/tree/v1.1.0#can-i-create-a-scratch-space-that-is-not-shared-across-versions-of-my-package . (Which surprised me, I assumed this was the default.) The path is hashed to avoid illegal characters in the key.

@codecov
Copy link

codecov bot commented Mar 5, 2022

Codecov Report

Merging #15 (39574f5) into main (a6d8190) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #15   +/-   ##
=======================================
  Coverage   92.85%   92.85%           
=======================================
  Files           1        1           
  Lines          56       56           
=======================================
  Hits           52       52           
  Misses          4        4           
Impacted Files Coverage Δ
src/RelocatableFolders.jl 92.85% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df7ee42...39574f5. Read the comment docs.

@MichaelHatherly MichaelHatherly merged commit 30f00f2 into JuliaPackaging:main May 13, 2022
@MichaelHatherly
Copy link
Collaborator

Sorry that took so long to get in @fonsp! It is in a newly tagged 0.3.0 now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants