Skip to content

Prune versions not referenced in juliaup.json with --prune-orphans #1146

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

Closed
wants to merge 3 commits into from

Conversation

christiangnrd
Copy link
Contributor

@christiangnrd christiangnrd commented Jan 17, 2025

I took a look at #1129 and it seems like if a direct download channel was deleted and the .juliaup folder was not, it would forever be ignored by the gc command. I attempt to address it by adding a --prune-orphans flag similar to the --prune-linked flag that will remove any folder that starts with "julia-" that is not referenced by the "juliaup.json" config file.

Name is definitely open for suggestions, and I'd love suggestions to make my code more idiomatic. At the moment it feels clunky.

If this approach is accepted, I'll write a test.

I also added some clarifying comments to the SystemChannel code to make it easier to understand.

@ghyatzo
Copy link
Contributor

ghyatzo commented Apr 25, 2025

#1153 could be related to this.
There seems to be some path normalization shenanigans going on. Have you ever encountered this?

Edit: It seems that removing a julia version that is currently open fails (understandably), but what happens is that even if the cleanup failed, the julia version is removed from the configuration file, making it orphan: See #1153 (comment)

Not sure if this should be a PR on its own or can be incorporated into this one, since we're touching the same code. Ideally we'd intercept the failed remove and other than printing an error, we also avoid deleting the version from the config, so that after calling juliaup gc like suggested actually does something.

And the error message could incorporate the hint that maybe there is that julia version open somewhere.

@christiangnrd
Copy link
Contributor Author

christiangnrd commented Apr 27, 2025

Now that you mention it, I do remember noticing that while writing this PR, but with how busy the maintainers are, I try (emphasis on try) to make my PRs as easy to merge and with the least back and forth as possible.

I do think that’s a good idea though. If you tackle this yourself, maybe base it off this branch? Or feel free to open a new PR that replaces this one since I don’t know if this would be needed if old versions naturally get cleaned up from a regular juliaup gc invocation.

This is to remove julia folders in the juliaup folder whose path is not referenced in juliaup.json

This will typically clean up direct download version that were somehow not removed.
@christiangnrd
Copy link
Contributor Author

christiangnrd commented Jul 21, 2025

Closing because #1205 was merged!

@christiangnrd christiangnrd deleted the gcimprove branch July 21, 2025 18:15
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