chocolateypackages icon indicating copy to clipboard operation
chocolateypackages copied to clipboard

Uninstall-ChocolateyPackage doesn't handle double-quotes

Open AnthonyMastrean opened this issue 8 years ago • 0 comments

There's something fishy between Uninstall-ChocolateyPackage and the extension Get-UninstallRegistryKey. I think the problem is on the Chocolatey helper side. It's not using an "uninstall string" with quotes embedded in the string value properly.

For example:

PS C:\vagrant> choco uninstall -y cheatengine
Chocolatey v0.9.10-beta1-385-g8127955
Uninstalling the following packages:
cheatengine

cheatengine v6.5.1.20160609
Uninstalling cheatengine...
ERROR: Exception calling "GetFullPath" with "1" argument(s): "Illegal characters in path."
cheatengine uninstall not successful.
Error while running 'C:\ProgramData\chocolatey\lib\cheatengine\tools\chocolateyUninstall.ps1'.
 See log for details.
cheatengine not uninstalled. An error occurred during uninstall:
 cheatengine uninstall not successful.

Chocolatey uninstalled 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Failures
 - cheatengine (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\cheatengine\tools\chocolateyUninstall.ps
1'.
 See log for details.

And the registry key looks like this:

PS C:\vagrant> (Get-UninstallRegistryKey 'Cheat Engine 6.5.1').UninstallString
"C:\Program Files (x86)\Cheat Engine 6.5.1\unins000.exe"

I have to trim the quotes off...

Uninstall-ChocolateyPackage `
  -PackageName 'cheatengine' `
  -FileType 'EXE' `
  -Silent '/VERYSILENT /NORESTART' `
  -File (Get-UninstallRegistryKey -SoftwareName 'Cheat Engine 6.5.1').UninstallString.Trim('"')

AnthonyMastrean avatar Jun 09 '16 23:06 AnthonyMastrean