-
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
Get-Processorbits function seems to be broken #809
Comments
As I wrote on the mailing list, the strictly correct comparison code should be:
because Get-ProcessorBits returns an int. However, both variants work correctly on my Windows 10 x64 (build 10586), using the latest code:
|
Ah, I just realized you were reporting invalid behavior on x86, not x64. Here is a test on Windows 7 x86:
|
I just installed mpc-be on that Windows 7 system (.NET 4.0, PowerShell 2.0) and the path addition was correct:
One more issue with your code: there is no guarantee that Program Files is on C: drive (or, in fact, that it is named Program Files!). You should use |
@jberezanski Inside the PowerShell host - this could be an issue. Better to create a package that does this. Rename this to nupkg: test-environment.1.0.0.nupkg.zip $bits = Get-ProcessorBits
Write-Host "Get-ProcessorBits = $bits"
Write-Host "`$bits -eq '64' = $($bits -eq '64')"
Write-Host "`$bits -eq 64 = $($bits -eq 64)"
Write-Host "`$bits -eq '32' = $($bits -eq '32')"
Write-Host "`$bits -eq 32 = $($bits -eq 32)" |
Try this in 0.9.10 and see what it reports. |
@sippi90 Thanks for finding the bug - I do agree with @jberezanski that you are not going about finding the install directory correctly. Users can override the default installation directory. A much more deterministic way to get this is to get the install location from the uninstaller registry key - https://gist.github.com/choco-bot/cc2a1764e8fc24943d1391979847a7f3#file-1-registrysnapshot-xml-L1-L9. You want to follow the code example from https://chocolatey.org/docs/helpers-get-uninstall-registry-key (source code is https://github.com/chocolatey/choco/blob/master/src/chocolatey.resources/helpers/functions/Get-UninstallRegistryKey.ps1). |
|
@jberezanski I'm assuming you scrubbed the environment variables prior to posting. Also, what is that last thing there and how did you get that to happen? |
I did not alter the output in any way; this is one of my test VMs, no sensitive data there. No idea why the package installation failed. Perhaps because it did not invoke Start-ChocolateyProcessAsAdmin (or any other install helper) and so $env:ChocolateyExitCode was never populated? What I did, step by step, after booting the VM:
Additional environment information: the OS is an almost completely unpatched (only 9 patches from 2013.12) Win7 Professional SP1 with only .NET 4.6.1 installed (I wrote ".NET 4.0" by mistake in a previous comment). Polish language. |
Just filed #810. It's supposed to be looking at lastexitcode, but that looks like it may not return correctly in all cases. Not sure if that is a culture specific thing or not yet. |
|
Thanks. |
Hi there,
since I updated MPC-BE package and did a bit of testing on Win10 x64/x86 VMs I noticed that the Get-Processorbits function seems to be broken.
Code:
$bits = Get-ProcessorBits
if ($bits -eq '64')
{
Install-ChocolateyPath 'C:\Program Files\MPC-BE x64'
}
else
{
Install-ChocolateyPath 'C:\Program Files\MPC-BE'
}
This should install shims on 32-Bit machines to path 'C:\Program Files\MPC-BE' but it doesn't.
It's creating shims for 'C:\Program Files\MPC-BE x64'
The text was updated successfully, but these errors were encountered: