choco icon indicating copy to clipboard operation
choco copied to clipboard

Add ability to correctly re-install packages without using the `--force` argument

Open AdmiringWorm opened this issue 2 years ago • 4 comments

Is Your Feature Request Related To A Problem? Please describe.

There are times where there is a need to reinstall packages, during these times many use the argument --force to make this happen.

Instead, there should be a separate argument or command to allow this happen, where the package will first be uninstall and secondly the package will installed again with the same version that was already installed. Due to the nature of this command, it should not do the normal cleanup af the cacheLocation where many binaries are cached initially during installation, and to honor the files still located in this place. There nupkg file itself should however still be downloaded. As with the upgrade command, reinstalling packages should also honor the previous arguments that was used.

Describe The Solution. Why is it needed?

As there is no normal re-install functionality in Chocolatey CLI, there are users that instead uses the argument --force to make this happen. Using --force may have side effects that may be undesirable to users (it is not a re-install, but rather a replacement. It ignores the existing files in the cache directory, and subverts other smart checks in the codebase).

Additional Context.

If implemented, there will be a need to scan the codebase for places where --force is mentioned to use for reinstalls.

Related Issues

  • Issue #2277
  • Comment https://github.com/chocolatey/choco/issues/227#issuecomment-557963699
  • Issue #2088

AdmiringWorm avatar May 19 '22 10:05 AdmiringWorm

Also, if implemented, it's a good idea to scan the docs for the same.

For instance, at https://docs.chocolatey.org/en-us/faqs it states "you could force the reinstall of that same version of the package.", but as mentioned force/--force isn't a reinstall per se.

There are likely more areas of the docs/faqs with similar references.

slycordinator avatar May 25 '22 06:05 slycordinator

What is your definition of 'reinstall'?

pauby avatar May 26 '22 19:05 pauby

What is your definition of 'reinstall'?

"to install something again"

With that definition in mind, it seems like a "reinstall" action should behave similarly to "install" with respect to the smart checks referenced above.

And since --force ignores those, using it to perform a reinstall really causes choco to install the package differently from before and replace the original resulting contents.

slycordinator avatar May 27 '22 06:05 slycordinator

Agreed, the lack of ability to quickly reinstall is annoying. Sometimes you have to uninstall a package first, then uninstall a dependency that is basically (install) version of the package. And lastly install again. Quite confusing. I assume it happens because the installer itself checks for registry entries, I'm not sure if it's also a mistake on the side of the package scripts not uninstalling the dependency, but a shortcut to uninstall and install or even run "reinstall" option that some installers have would be nice regardless.

Destroy666x avatar Jul 21 '22 06:07 Destroy666x