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

choco new generates uninstall template with wrong use of registry key variable #1304

Closed
AdmiringWorm opened this issue May 20, 2017 · 1 comment
Assignees
Milestone

Comments

@AdmiringWorm
Copy link
Member

AdmiringWorm commented May 20, 2017

What You Are Seeing?

In the last elseif statement of the generated chocolateyuninstall.ps1 script it generates the following:

} elseif ($key.Count -gt 1) {
  Write-Warning "$key.Count matches found!"
  Write-Warning "To prevent accidental data loss, no programs will be uninstalled."
  Write-Warning "Please alert package maintainer the following keys were matched:"
  $key | % {Write-Warning "- $_.DisplayName"}
}

Which will output the the full keys and append .Count/.DisplayName instead of outputting the Count, or the display name of the key.
This can be seen from the following appveyor build:
https://ci.appveyor.com/project/chocolatey/chocolatey-coreteampackages/build/1778-yqtgkmnh#L197

What is Expected?

Expected the template to be generated with wrapping the calls to $key.Count and $_.DisplayName within parenthesis like this:

} elseif ($key.Count -gt 1) {
  Write-Warning "$($key.Count) matches found!"
  Write-Warning "To prevent accidental data loss, no programs will be uninstalled."
  Write-Warning "Please alert package maintainer the following keys were matched:"
  $key | % {Write-Warning "- $($_.DisplayName)"}
}

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

Run choco new temporary and look inside the chocolateyuninstall.ps1 file.

Output Log

No log available for this.

@ferventcoder ferventcoder added this to the 0.10.6 milestone May 24, 2017
ferventcoder added a commit that referenced this issue May 30, 2017
* pr1305:
  (GH-1304) Wrapping HashTable calls inside parenthesis
ferventcoder added a commit that referenced this issue May 30, 2017
* stable:
  (GH-1304) Wrapping HashTable calls inside parenthesis
@ferventcoder ferventcoder self-assigned this May 30, 2017
@ferventcoder
Copy link
Member

This will be in 0.10.6

@ferventcoder ferventcoder changed the title choco new generates uninstall template with wrong use of a variables choco new generates uninstall template with wrong use of registry key variable May 30, 2017
@gep13 gep13 changed the title choco new generates uninstall template with wrong use of registry key variable choco new generates uninstall template with wrong use of registry key variable Apr 25, 2023
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

3 participants