-
Notifications
You must be signed in to change notification settings - Fork 384
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
(chocolatey-core.extension) breaks Get-PackageParameters function if paramater contains spaces #950
Comments
As with any other tool, you must wrap spaces in
|
BTW, internal choco helper function is semi-compatible with core function, so it was a poor choice to name it the same IMO. The differences are subtle but they exist as some packages failed just by removing core extension. Also, on choco help you have example with long names: Example 4
|
The syntax is different depending on whether the Extensions are install or not, which is bad, as you cannot assume the Extensions are installed if a package DOES NOT require them. So with the extension installed, the following syntax works:
But without the extension, the same syntax fails:
|
I tried both variants on my computer and both work for me. You should provide repeatable example using only chocolatey Powershell modules. In any case, even if so, the question doesn't belong here as there is nothing wrong with chocolatey-core extension in this manner.
Why not using extension anyway and be done with it ? |
Actually the very essence of items in core.extension is that they should ultimately end up in Chocolatey, so I'm perplexed a bit at this statement. |
This is correct - This is a bug:
If you are not following the prescribed https://chocolatey.org/docs/commands-reference#how-to-pass-options-switches, you are fracturing the community and the documentation. So you have a bug on your hands. Please fix it. |
If this is true, why haven't there been more bug reports over at https://github.com/chocolatey/choco? Things between the two methods should be compatible. Here's one we've fixed: chocolatey/choco#1459 (Urls). The original implementation in 0.10.8 wasn't quite good enough, so we've flipped over to a regex - https://github.com/chocolatey/choco/blob/516c6cc673ebe90cc97eaa3e4d307ad88ab12752/src/chocolatey.resources/helpers/functions/Get-PackageParameters.ps1#L147 (and yes, every bit of that is required). This likely fixes the issue of incompatibility reported here, however I don't think it would remove the We also support by default |
Okay, I adjusted that functionality for 0.10.9, it will remove the |
I found out why I thought the native and core funcs are not the same. Its a bug in remembering parameters:
|
It's a known issue. The trick is discovering why it occurs. The time from when the actual bug occurs to when you notice is quite far apart. That bug is noted at chocolatey/choco#1443 |
chocolatey/choco#1490 for the incompatibilities addressed in this issue. |
I don't think there is anything more to add here so I will close this. |
Expected Behavior
Get-PackageParameters function supports parameters with spaces:
For example `-Parameters "/ITEM1:value /ITEM2:value with spaces"
https://chocolatey.org/docs/helpers-get-package-parameters
Current Behavior
Get-PackageParameters function supports parameters with spaces:
For example `-Parameters "/ITEM1:value /ITEM2:value with spaces"
https://chocolatey.org/docs/helpers-get-package-parameters
Possible Solution
Should Get-PackageParameters.ps1 be removed from the chocolatey-core.extension package? since it is already a function in chocolatey base package
Steps to Reproduce (for bugs)
===========================================
Install package without Extensions package:
chocolatey 0.10.8
example:
choco install nabtrade-securities-wiki --params="'/SEINSTALL:D:\ccviews\Program Files\securitease_test1'" -y
Parameters with spaces work as expected:
2018-01-18 14:15:53,850 12728 [INFO ] - Chocolatey v0.10.8
2018-01-18 14:15:53,859 12728 [DEBUG] - Chocolatey is running on Windows v 6.1.7601.65536
2018-01-18 14:15:53,862 12728 [DEBUG] - Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old".
2018-01-18 14:15:53,864 12728 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\choco.exe.old".
2018-01-18 14:15:53,874 12728 [DEBUG] - Command line: "C:\ProgramData\chocolatey\choco.exe" install nabtrade-securities-wiki --params="'/SEINSTALL:D:\ccviews\Program Files\securitease_test1'" -y
2018-01-18 14:15:53,875 12728 [DEBUG] - Received arguments: install nabtrade-securities-wiki --params='/SEINSTALL:D:\ccviews\Program Files\securitease_test1' -y
...
PackageParameters='/SEINSTALL:D:\ccviews\Program Files\securitease_test1'|
...
2018-01-18 14:16:35,474 12728 [DEBUG] - Calling built-in PowerShell host with ['[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'C:\ProgramData\chocolatey_test1\helpers\chocolateyInstaller.psm1'; & 'C:\ProgramData\chocolatey_test1\helpers\chocolateyScriptRunner.ps1' -packageScript 'C:\ProgramData\chocolatey_test1\lib\nabtrade-securities-wiki\tools\chocolateyInstall.ps1' -installArguments '' -packageParameters '/SEINSTALL:D:\ccviews\Program Files\securitease_test1'']
...
2018-01-18 14:16:38,082 12728 [DEBUG] - Running 'ChocolateyScriptRunner' for nabtrade-securities-wiki v05.26.00.00 with packageScript 'C:\ProgramData\chocolatey_test1\lib\nabtrade-securities-wiki\tools\chocolateyInstall.ps1', packageFolder:'C:\ProgramData\chocolatey_test1\lib\nabtrade-securities-wiki', installArguments: '', packageParameters: '/SEINSTALL:D:\ccviews\Program Files\securitease_test1',
...
2018-01-18 14:16:38,116 12728 [INFO ] - ================================================================================
2018-01-18 14:16:38,123 12728 [INFO ] - * Getting parameters...
2018-01-18 14:16:38,152 12728 [DEBUG] - Running Get-PackageParameters
2018-01-18 14:16:38,165 12728 [DEBUG] - Parsing $env:ChocolateyPackageParameters and $env:ChocolateyPackageParametersSensitive for parameters
2018-01-18 14:16:38,180 12728 [DEBUG] - Adding package param 'SEINSTALL'='D:\ccviews\Program Files\securitease_test1'
2018-01-18 14:16:38,215 12728 [INFO ] - -> SEINSTALL parameter = D:\ccviews\Program Files\securitease_test1
2018-01-18 14:16:38,221 12728 [INFO ] - ================================================================================
========================================
Install package with Extensions package:
chocolatey 0.10.8
chocolatey-core.extension 1.3.3
example:
choco install nabtrade-securities-wiki --params="'/SEINSTALL:D:\ccviews\Program Files\securitease_test1'" -y
Parameters with spaces no longer work:
2018-01-18 14:23:06,289 13400 [INFO ] - Chocolatey v0.10.8
2018-01-18 14:23:06,298 13400 [DEBUG] - Chocolatey is running on Windows v 6.1.7601.65536
2018-01-18 14:23:06,301 13400 [DEBUG] - Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old".
2018-01-18 14:23:06,302 13400 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\choco.exe.old".
2018-01-18 14:23:06,310 13400 [DEBUG] - Command line: "C:\ProgramData\chocolatey\choco.exe" install nabtrade-securities-wiki --params="'/SEINSTALL:D:\ccviews\Program Files\securitease_test1'" -y
2018-01-18 14:23:06,312 13400 [DEBUG] - Received arguments: install nabtrade-securities-wiki --params='/SEINSTALL:D:\ccviews\Program Files\securitease_test1' -y
...
PackageParameters='/SEINSTALL:D:\ccviews\Program Files\securitease_test1'|
...
2018-01-18 14:23:45,378 13400 [DEBUG] - Calling built-in PowerShell host with ['[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'C:\ProgramData\chocolatey_test1\helpers\chocolateyInstaller.psm1'; & 'C:\ProgramData\chocolatey_test1\helpers\chocolateyScriptRunner.ps1' -packageScript 'C:\ProgramData\chocolatey_test1\lib\nabtrade-securities-wiki\tools\chocolateyInstall.ps1' -installArguments '' -packageParameters '/SEINSTALL:D:\ccviews\Program Files\securitease_test1'']
...
2018-01-18 14:23:48,253 13400 [DEBUG] - Running 'ChocolateyScriptRunner' for nabtrade-securities-wiki v05.26.00.00 with packageScript 'C:\ProgramData\chocolatey_test1\lib\nabtrade-securities-wiki\tools\chocolateyInstall.ps1', packageFolder:'C:\ProgramData\chocolatey_test1\lib\nabtrade-securities-wiki', installArguments: '', packageParameters: '/SEINSTALL:D:\ccviews\Program Files\securitease_test1',
...
2018-01-18 14:23:48,280 13400 [INFO ] - ================================================================================
2018-01-18 14:23:48,288 13400 [INFO ] - * Getting parameters...
2018-01-18 14:23:48,428 13400 [INFO ] - -> SEINSTALL parameter = D:\ccviews\Program
2018-01-18 14:23:48,442 13400 [INFO ] - ================================================================================
after.choco.summary.log
after.chocolatey.log
before.choco.summary.log
before.chocolatey.log
chocolateyInstall.zip
Context
Unable to use parameters with spaces after chocolatey-core.extension is installed, so is a show stopper
Your Environment
The text was updated successfully, but these errors were encountered: