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

When updating, download & verify new package before uninstalling #2220

Closed
spongbros opened this issue Apr 24, 2018 · 9 comments
Closed

When updating, download & verify new package before uninstalling #2220

spongbros opened this issue Apr 24, 2018 · 9 comments

Comments

@spongbros
Copy link
Contributor

Currently, performing an upgrade of a package runs an uninstallation before downloading the updated files. It is possible for the download to fail or for the checksum to not match, leaving no copy of the package installed and, potentially, no way to reinstall it. Ideally, the update package should be downloaded and verified before the uninstallation process begins.

@quincunx
Copy link
Contributor

quincunx commented May 7, 2018

The current behaviour is unfortunate but an old version is not remove at all.

E.g. I've vim installed - which gets an update every 1-2 days. Every single installed/updated version is still on my system, see the directory %USERPROFILE%\scoop\apps\vim:

8.0.1765
8.0.1766
8.0.1772
8.0.1774
8.0.1780
8.0.1787
8.0.1789
8.0.1795
current

current is a link to the latest installed version (8.0.1795).

So all it would need is to detect a failed update and act accordingly. Maybe uninstalling (of shims) and removing the current link is not required at all - as it will be overwritten by the new version (if it's successful).

https://github.com/lukesampson/scoop/wiki/The-'Current'-Version-Alias

@r15ch13
Copy link
Member

r15ch13 commented May 7, 2018

When a download or hash check fails it will leave an empty directory behind. If we remove it and simply run scoop reset <app> it should be fixed.

@gitolicious
Copy link
Contributor

Maybe reset could check if current links to an empty folder and fix it automatically.
Also, are post_install steps performed and are all shims put back in place with the reset command? Otherwise the app will end up in a messed up state.

@r15ch13
Copy link
Member

r15ch13 commented Jun 28, 2018

@gitolicious no, reset doesn't run post_intall, it's only for fixing shortcuts, shims, and environment variables. See scoop-reset.ps1

@gitolicious
Copy link
Contributor

Well, then unfortunately your suggestion is only valid for very basic manifests. I see two solutions here:

  1. Perform download to cache before uninstallation -> should prevent most internet connection related problems
  2. Perform self-healing by re-installing the old version after a failed update -> brings the user back to a usable state
    Probably both can solutions can be put in place in parallel.

@gitolicious
Copy link
Contributor

PR for solution 1 in #2343

@r15ch13
Copy link
Member

r15ch13 commented Jun 28, 2018

reset is mostly for switching between package versions like python and python27, which have the same executables. Running post_install is not suited for this command.

@ghost
Copy link

ghost commented Sep 25, 2018

Just experienced this in ScoopInstaller/Extras#1269 but it is not the first time. Considering how many issues come up when you search for is:issue "hash check fail" on the main scoop repo, not to mention the buckets, this would be VERY nice to have.

@ghost
Copy link

ghost commented Sep 25, 2018

Coming back to the number of issues raised. I think a lot less "hash check fail" issues would be raised if the app wasn't left in an uninstalled state, saving time fixing hashes.

r15ch13 pushed a commit that referenced this issue Mar 7, 2019
This is temporary solution for #2220 until whole install.ps1 refactor is done to make this tweak easily, in the best way one-liner.

- One step closer to #3149
- Closes #2220
- Closes #2343
- Closes #1605
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants