-
Notifications
You must be signed in to change notification settings - Fork 903
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
Error when installing package: "Collection is read-only" #659
Comments
Whoa... wtf Powershell?! |
Turns out this doesn't repro with the latest Insider Preview build of Windows. I'll let you know if that changes. |
@Tom999Hall this |
Looks like the same - this is on the latest insider Preview - Win10 x64, Build 14291 |
I created an issue on this to get Microsoft's feedback - https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/13028523-lastest-windows-insider-builds-collection-is-rea |
@scowalt @Tom999Hall if you upgrade to the latest beta of 0.9.10, are you still seeing this error? |
@Tom999Hall I just thought of that yeah. You try to use https://chocolatey.org/installabsolutelatest.ps1 and run the installer to get the beta. |
Installed/upgraded to 0.9.10 beta Ok, but still getting |
Can you try isolating this for me? Call: |
Add the error log or an image back here after you run this |
Contents of the file? |
Two things. Contents of the file and can you tell me the specific encoding of the file? (Notepad++ can provide this information easily). I'm looking for UTF-8 with or without BOM. |
Actually, line 1 - we specify parameters in a script. |
I just looked and the file for me is UTF w/BOM. So is the chocolateyInstaller.psm1 file. |
DO me a huge favor. Create these two files: TestWithParams.ps1: param (
[string]$TestVariable
)
$invocation = $MyInvocation
$argumentsPassed = $invocation.UnboundArguments -Join ' '
Write-Output "Received [$($invocation.InvocationName) $argumentsPassed]" TestNoParams.ps1: $invocation = $MyInvocation
$argumentsPassed = $invocation.UnboundArguments -Join ' '
Write-Output "Received [$($invocation.InvocationName) $argumentsPassed]" Now run both as
|
This was my output: Posh v2PS C:\> & C:\code\temp\powershellparams\TestNoParams.ps1 -TestVariable 'Hi' -OtherArgument 'yep'
Received [& -TestVariable Hi -OtherArgument yep]
PS C:\> & C:\code\temp\powershellparams\TestWithParams.ps1 -TestVariable 'Hi' -OtherArgument 'yep'
Received [& -OtherArgument yep]
PS C:\> $host.version
Major Minor Build Revision
----- ----- ----- --------
2 0 -1 -1 Posh v3PS C:\> & C:\code\temp\powershellparams\TestNoParams.ps1 -TestVariable 'Hi' -OtherArgument 'yep'
Received [& -TestVariable Hi -OtherArgument yep]
PS C:\> & C:\code\temp\powershellparams\TestWithParams.ps1 -TestVariable 'Hi' -OtherArgument 'yep'
Received [& -OtherArgument yep]
PS C:\> $host.version
Major Minor Build Revision
----- ----- ----- --------
3 0 -1 -1 Posh v4PS C:\> & C:\code\temp\powershellparams\TestNoParams.ps1 -TestVariable 'Hi' -OtherArgument 'yep'
Received [& -TestVariable Hi -OtherArgument yep]
PS C:\> & C:\code\temp\powershellparams\TestWithParams.ps1 -TestVariable 'Hi' -OtherArgument 'yep'
Received [& -OtherArgument yep]
PS C:\> $host.version
Major Minor Build Revision
----- ----- ----- --------
4 0 -1 -1 Posh v 5.0.10240.16384 (the default version shipping in Windows 10)PS C:\> & C:\code\temp\powershellparams\TestNoParams.ps1 -TestVariable 'Hi' -OtherArgument 'yep'
Received [& -TestVariable Hi -OtherArgument yep]
PS C:\> & C:\code\temp\powershellparams\TestWithParams.ps1 -TestVariable 'Hi' -OtherArgument 'yep'
Received [& -OtherArgument yep]
PS C:\> $host.version
Major Minor Build Revision
------- ------- ------- -----------
5 0 10240 16384 Posh v 5.0.10514.6 (WMF 5 Final) |
Well that validates it is not params. Okay, let's incrementally add parts of the chocolateyScriptRunner.ps1 into TestWithParams.ps1 one until we find the culprit. Can you do that for me? |
Unfortunately, I’ve got to go out for a couple of hours |
No worries, it will be here when you get back. |
https://github.com/chocolatey/choco/blob/0.9.9.11/src/chocolatey.resources/helpers/chocolateyScriptRunner.ps1 - If I had to guess, I'd believe it is $RunNote = "DarkCyan"
$Warning = "Magenta"
$ErrorColor = "Red"
$Note = "Green" |
Yes, bug in PowerShell in the latest insider build. Will get it fixed, in the meanwhile you can fix the issue on your side by changing (in file choco/src/chocolatey.resources/helpers/chocolateyScriptRunner.ps1) From: To: |
Ah! Thanks @HemantMahawar! |
This bug in PowerShell is in the recent Windows Insider Build regarding adding multiple aliases separately. You can specify the alias parameter once and it will work with multiple values. This is a better way of going about it anyway.
This bug in PowerShell is in the recent Windows Insider Build regarding adding multiple aliases separately. You can specify the alias parameter once and it will work with multiple values. This is a better way of going about it anyway.
* 0.9.9.x: (version) 0.9.9.12 (chocolateyGH-659) Fix: PowerShell Collection is read-only # Conflicts: # .uppercut # CHANGELOG.md # nuget/chocolatey/chocolatey.nuspec
* stable: (version) 0.9.9.12 (chocolateyGH-659) Fix: PowerShell Collection is read-only (chocolateyGH-659) Fix: PowerShell Collection is read-only
* 0.9.9.x: (GH-659) correct missing parentheses
* stable: (GH-659) correct missing parentheses
This has been released in 0.9.9.12 and today's beta release for 0.9.10. |
Thanks for addressing this so quickly @ferventcoder ! |
No worries. I didn't want to put out a 0.9.9.12 but this is a pretty gating issue for Choco, so I created the branch from the last tag and we'll have a short-lived 0.9.9.x branch. As an aside, git is awesome. 👍 |
(also, friendly reminder to update install.ps1 on the website 😄) |
Thanks, forgot that was changed to be hardcoded! |
Done. |
Quick note to anyone else pasting the fix from @HemantMahawar - the quotes are smart quotes (which is why your text search is failing). Thanks for the fix! |
Fixed. Thanks for noting that @GeorgeHahn! |
fix powershell issue chocolatey/choco#659
What You Are Seeing?
"Collection is read-only" error in newer (insider) Windows builds. This happens when installing any package.
What is Expected?
Package installs and doesn't error.
How Did You Get This To Happen? (Steps to Reproduce)
This has happened across multiple machines.
Output Log
https://gist.github.com/scowalt/5cfc70636850df7cb5f9
The text was updated successfully, but these errors were encountered: