chocolatey / choco

Chocolatey - the package manager for Windows
https://chocolatey.org
Other
10.29k stars 902 forks source link

Uninstall throws error on path not found if the id nuspec file in lib folder and inside downloaded nupkg is different case #1040

Open AdmiringWorm opened 7 years ago

AdmiringWorm commented 7 years ago

What You Are Seeing?

When uninstalling a package where the id in lib\packageName.nuspec and the nuspec file inside lib\packageName.nupkg have different casing, the uninstallation process throws an error reporting that the lib\PackageName path was not found.

It does not matter if the uninstall script is run, or if it is skipped.

What is Expected?

No error even if the casing is different

How Did You Get This To Happen? (Steps to Reproduce)

I'll give an example with the InnoSetup package. The casing on the website uses upper case I and S, while when I pushed the package with all lowercase. When that package is then installed, the casing of the id element in the nuspec file inside the downloaded nupkg file and the nuspec file in the lib folder are different causing the error of a path not found.

Output Log

https://gist.github.com/AdmiringWorm/bac515b64b3d4e22f5eba385b07efb5c

Tested with choco versions

choco 0.10.3 (Error occurred) choco 0.10.2 (Error occurred) choco 0.10.1 (No Error)

ferventcoder commented 7 years ago

added this to next release.

ferventcoder commented 7 years ago

I ran this with the latest beta and was not able to get it to occur. I am going to move this to next release and mark it back for triage.

AdmiringWorm commented 7 years ago

@ferventcoder I don't suppose it would be possible to provide a beta release of choco? I'm thinking this could have been solved in a previous commit, as I couldn't get it to occur either when building from the master branch previously (although I had to reuse my locally installed nuget cli, as I couldn't get the provided one to work correctly with restoring dev dependencies).

ferventcoder commented 7 years ago

@AdmiringWorm there is a beta out now. However it is incompatible with the licensed edition. Something to keep in mind. Working on a fix for the incompatibility and will provide notice to all customers related to that.

AdmiringWorm commented 7 years ago

I just tried with the latest available beta, and it is still happening for me. I tested with version 5.5.9.20160928 of innosetup.

AdmiringWorm commented 7 years ago

I can't seem to replicate the issue when debugging through visual studio though.

johnypony3 commented 7 years ago

i just ran into this issue with v0.10.5 (latest currently) my nuspec excerpt:

<id>paket</id> <title>Paket</title>

the error on uninstall:

Failures

  • paket (exited 1) - paket not uninstalled. An error occurred during uninstall: Unable to find package 'Paket'.
AdmiringWorm commented 7 years ago

@ferventcoder have there been any update on this on what is causing this error? Personally I'm still unable to reproduce when running choco through visual studio, but still happening when installing packages where current casing differ from original casing (only when the package have been installed from a remote source though).

ferventcoder commented 7 years ago

@johnypony3 Can you post a gist of your full log output (you can find it in the chocolatey.log file or one of the numbered files)? Since this is quite difficult to recreate, it would be helpful.

@AdmiringWorm did you happen to notice this right before the error from your gist? C:\ProgramData\chocolatey\lib\InnoSetup\tools\chocolateyUninstall.ps1.5.5.9.20160928

https://gist.github.com/AdmiringWorm/bac515b64b3d4e22f5eba385b07efb5c#file-chocouninstall-log-L316-L318

If the folder it is looking for the package in has changed to something like the above, that explains why it would not find the package.

AdmiringWorm commented 7 years ago

@ferventcoder that certainly is odd (IMO). Unless choco changed the folder, the folder shouldn't have changed. That uninstall log is from a pure install then uninstall on the choco-environment (without doing anything in between),

johnypony3 commented 7 years ago

oh geez :) i thought this was related to the paket package, i'm unable to help with this today

flcdrg commented 7 years ago

I've seen this happen for a package that was originally created on Chocolatey.org with the id 'SqlToolbelt'. When I took over maintaining the package, I wrote my own nuspec with 'sqltoolbelt'. This caused uninstall fails like this - https://gist.github.com/choco-bot/711c5e276e9293c9069af01e916ccb86

Updating my nuspec to revert to the original casing caused the uninstall to pass - https://gist.github.com/choco-bot/9cac09aaaf23d8f649f7034398b0cea7)

bcurran3 commented 7 years ago

I just ran into this bug yesterday with Chocolatey v0.10.7 Professional.

An easy way to duplicate this problem is with the current GNU Wget 1.19.1 package since it's small and fast to install/uninstall.

ferventcoder commented 7 years ago

Starting to wonder if this is in the nuget.core codebase instead.

ferventcoder commented 7 years ago

I think the trick here is to start by installing a package with one case, then change case of the package and have an upgrade of that. Then upgrade. Then attempt uninstall.