JuliaLang / juliaup

Julia installer and version multiplexer
MIT License
982 stars 83 forks source link

Prevent downgrading on old version in mirror #889

Open ghyatzo opened 5 months ago

ghyatzo commented 5 months ago

should fix #250

ghyatzo commented 5 months ago

I completely missed that possibility, sorry. I tried to reason about it in terms of detecting a channel change, but as far as I could tell there is no way currently to do it. Instead I opted for simplifying it, and just warn and ask the user for input when we detect a downgrade.

I have ready an incomplete patch for it, but there is another issue. What should be the default behaviour when the self update is run non interactlively. Should we default to not downgrade at all? Or install whatever it is found on the channel?

I'd be more towards ignoring any downgrades, to avoid surprises.

for now an example of interaction is the following:

$ juliaup self update
Checking for self-updates on channel: release
You are trying to install version: release-1.14.7, but the currently installed version is newer (or the same).
Do you want to continue? yes
Found new version 1.14.7 on channel release.
Updated Juliaup to version 1.14.7.

Other possible behaviour to consider: if the version is the same, just update normally.

EDIT: I'll push the changes made, with the caveat that they are still incomplete and need the non-interactive scenario to be addressed.

ghyatzo commented 5 months ago

I just opted for pushing a complete working version, so that if you agree it's ready. Namely: