-
Notifications
You must be signed in to change notification settings - Fork 905
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
Uninstall template fails when encountering "bad" registry keys #739
Comments
What is the proposed solution to this issue? I do think making the template more bulletproof would be helpful. |
This is what I came up with chocolatey-community/chocolatey-packages@f7fe281#diff-1213b3569e3787f648fc1ae040fd00d4 I was thinking of distributing the fix as an extension to keep chocolateyUninstall.ps1 files less complicated as noted at chocolatey-community/chocolatey-packages#214 |
So these lines in the template would be replaced with
And the package would also have to include in the nuspec:
|
Templates are set to use the chocolatey-uninstall.extension helper by default. The helper includes a catch for invalid registry keys. Using the catch is a requirement as blindly enumerating will fail every time if even one invalid key exists.
I am looking at adding
Thoughts? Are there any clear guidelines or recommendations of when helpers should be extensions or internal helpers? Is the compromise of adding a dependency to the chocolatey package a horrible idea for a reason I overlooked? |
…ve registry key Templates are set to use the chocolatey-uninstall.extension helper by default. The helper includes a catch for invalid registry keys. Using the catch is a requirement as blindly enumerating will fail every time if even one invalid key exists.
Chocolatey has no dependencies, it would just include the helper as part of its framework. |
Right, I was imagining if you ignore everything a "dependency" is for a sec :), it would allow distributing the extension without including it as an internal helper for management outside of chocolatey codebase. Which might be better(?) When should a helper be external or internal? |
@dtgm I tend to think of it as a both argument - you load up the extension and only make it live if the built-in function isn't there (or if it is a known broken version). |
And we are starting to get into the reasons I have been hesitant to document the extensions feature. It's super powerful, but also makes it extremely easy to cut yourself with. |
I'm thinking more of the performance impact of including it in many packages as a dep and the many redundant checks for an updated version. How significant is that? |
Included without a version dependency, there is no check IIRC. Please check for sure though. It would just upgrade as part of cup all (or specific upgrade). |
I could be totally wrong about versionless dependencies |
As a basepoint, installing an empty package working from Summary |
test-pkg uninstalled between tests. Times didn't deviate much between tests. |
Also subject to issues with chocolatey-community/chocolatey-packages#222 |
Add Get-UninstallRegistryKey function to provide a means of getting uninstaller registry keys that does not fail with incorrectly encoded keys and values. Update the code documentation to link update the function with other similar functions and generate updated documentation Add the function to the uninstall template and nuspec with instructions to use the chocolatey-uninstall.extension package when supporting 0.9.9.x and below as the new function will only be available in 0.9.10 and above. The helper includes a trycatch for invalid registry keys. Using the catch is a requirement as blindly enumerating will fail every time if even one invalid key exists.
* pr743: (maint) Convert function to UTF-8 (GH-739) Get-UninstallRegistryKey / update templates
* stable: (maint) Convert function to UTF-8 (GH-739) Get-UninstallRegistryKey / update templates (maint) update logo location for nuspecs
Merged into stable at 91db949 |
Needs a small fixup, but 👍 |
choco/src/chocolatey/infrastructure.app/templates/ChocolateyUninstallTemplate.cs
Lines 61 to 63 in 7ef16d6
This code will fail if a registry key exists that was written with binary data and incorrectly typed.
[array]$key
does not resolve issue as Get-ItemProperty will fail before set to variable.For more details, see dtgm/chocolatey-packages#92 (comment)
The text was updated successfully, but these errors were encountered: