jbang icon indicating copy to clipboard operation
jbang copied to clipboard

Chocolately installer on Windows is erroring if user home has special characters

Open systemsincode opened this issue 6 years ago • 10 comments

I am using the recommended chocolately install and it is giving an error about the sha256 hash being wrong, but the downloaded zip does infact match the quoted checksum. Not sure whether I should have logged in with dococaltey or in here:

>> choco install jbang
>>
Chocolatey v0.10.15
Installing the following packages:
jbang
By installing you accept licenses for the packages.
Progress: Downloading jbang 0.33.0... 100%

jbang v0.33.0 [Approved]
jbang package files install completed. Performing other installation steps.
The package jbang wants to run 'chocolateyinstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint): Y

File appears to be downloaded already. Verifying with package checksum to determine if it needs to be redownloaded.
File 'C:\Users\Me\AppData\Local\Temp\chocolatey\jbang\0.33.0\jbang-0.33.0.zip' doesn't exist.
Downloading jbang
  from 'https://github.com/jbangdev/jbang/releases/download/v0.33.0/jbang-0.33.0.zip'
Progress: 100% - Completed download of C:\Users\Me\AppData\Local\Temp\chocolatey\jbang\0.33.0\jbang-0.33.0.zip (4.16 MB).
Download of jbang-0.33.0.zip (4.16 MB) completed.
File 'C:\Users\Me\AppData\Local\Temp\chocolatey\jbang\0.33.0\jbang-0.33.0.zip' doesn't exist.
ERROR: Checksum for 'C:\Users\Me\AppData\Local\Temp\chocolatey\jbang\0.33.0\jbang-0.33.0.zip' did not meet '95ddca626ead9775efd26f89217386e9c6668f7c0f543d84c867030cc4fd3e32' for checksum type 'sha256'. Consider passing the actual checksums through with --checksum --checksum64 once you validate the checksums are appropriate. A less secure option is to pass --ignore-checksums if necessary.
The install of jbang was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\jbang\tools\chocolateyinstall.ps1'.
 See log for details.

Chocolatey installed 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - jbang (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\jbang\tools\chocolateyinstall.ps1'.
 See log for details.

But it matches the requested when tested : image

systemsincode avatar Jul 11 '20 23:07 systemsincode

I've skipped by ignoreing checksums for now

systemsincode avatar Jul 11 '20 23:07 systemsincode

can you replicate it again ?

I tried just now and it "just works":

The package jbang wants to run 'chocolateyinstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint): y

Downloading jbang
  from 'https://github.com/jbangdev/jbang/releases/download/v0.33.0/jbang-0.33.0.zip'
Progress: 100% - Completed download of C:\Users\max\AppData\Local\Temp\chocolatey\jbang\0.33.0\jbang-0.33.0.zip (4.16 MB).
Download of jbang-0.33.0.zip (4.16 MB) completed.
Hashes match.
Extracting C:\Users\max\AppData\Local\Temp\chocolatey\jbang\0.33.0\jbang-0.33.0.zip to C:\ProgramData\chocolatey\lib\jbang...
C:\ProgramData\chocolatey\lib\jbang
Added C:\ProgramData\chocolatey\bin\jbang.exe shim pointed to '..\lib\jbang\jbang-0.33.0\bin\jbang.cmd'.
 The install of jbang was successful.
  Software installed to 'C:\ProgramData\chocolatey\lib\jbang'

Chocolatey installed 1/1 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

see "Hashes match."

maxandersen avatar Jul 12 '20 20:07 maxandersen

I uninstalled and made sure it was really gone (and the cache).... -> Same again... Sorry! Maybe its another issue with space in the path...but this must be a chocolately problem?

2020-07-12 22:08:24,964 24640 [INFO ] - Downloading jbang 
  from 'https://github.com/jbangdev/jbang/releases/download/v0.33.0/jbang-0.33.0.zip'
2020-07-12 22:08:26,883 24640 [INFO ] - 
2020-07-12 22:08:26,894 24640 [INFO ] - Download of jbang-0.33.0.zip (4.16 MB) completed.
2020-07-12 22:08:30,121 24640 [ERROR] - ERROR: Checksum for 'C:\Users\Matthew O'Surname\AppData\Local\Temp\chocolatey\jbang\0.33.0\jbang-0.33.0.zip' did not meet '95ddca626ead9775efd26f89217386e9c6668f7c0f543d84c867030cc4fd3e32' for checksum type 'sha256'. Consider passing the actual checksums through with --checksum --checksum64 once you validate the checksums are appropriate. A less secure option is to pass --ignore-checksums if necessary.
2020-07-12 22:08:30,324 24640 [ERROR] - The install of jbang was NOT successful.
2020-07-12 22:08:30,334 24640 [ERROR] - Error while running 'C:\ProgramData\chocolatey\lib\jbang\tools\chocolateyinstall.ps1'.
 See log for details.
2020-07-12 22:08:32,393 24640 [WARN ] - 
Chocolatey installed 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
2020-07-12 22:08:32,404 24640 [INFO ] - 
2020-07-12 22:08:32,417 24640 [ERROR] - Failures
2020-07-12 22:08:32,422 24640 [ERROR] -  - jbang (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\jbang\tools\chocolateyinstall.ps1'.
 See log for details.

systemsincode avatar Jul 12 '20 21:07 systemsincode

more thinking your ' could be the cause.

it could be issue in chocolateyinstall.ps1

what is in your "C:\ProgramData\chocolatey\logs\chocolatey.log" that might help ?

maxandersen avatar Jul 12 '20 21:07 maxandersen

Just moans about the checksum but paths are quoted as I'd expect.. bit weird..

2020-07-12 22:08:29,989 24640 [DEBUG] - checksum.exe found at 'C:\ProgramData\chocolatey\helpers\..\tools\checksum.exe'
2020-07-12 22:08:29,992 24640 [DEBUG] - Executing command ['C:\ProgramData\chocolatey\helpers\..\tools\checksum.exe' -c="95ddca626ead9775efd26f89217386e9c6668f7c0f543d84c867030cc4fd3e32" -t="sha256" -f="C:\Users\Matthew O'Surname\AppData\Local\Temp\chocolatey\jbang\0.33.0\jbang-0.33.0.zip"]
2020-07-12 22:08:30,107 24640 [DEBUG] - Command ['C:\ProgramData\chocolatey\helpers\..\tools\checksum.exe' -c="95ddca626ead9775efd26f89217386e9c6668f7c0f543d84c867030cc4fd3e32" -t="sha256" -f="C:\Users\Matthew O'Surname\AppData\Local\Temp\chocolatey\jbang\0.33.0\jbang-0.33.0.zip"] exited with '1'.
2020-07-12 22:08:30,121 24640 [ERROR] - ERROR: Checksum for 'C:\Users\Matthew O'Surname\AppData\Local\Temp\chocolatey\jbang\0.33.0\jbang-0.33.0.zip' did not meet '95ddca626ead9775efd26f89217386e9c6668f7c0f543d84c867030cc4fd3e32' for checksum type 'sha256'. Consider passing the actual checksums through with --checksum --checksum64 once you validate the checksums are appropriate. A less secure option is to pass --ignore-checksums if necessary.
2020-07-12 22:08:30,128 24640 [DEBUG] - Built-in PowerShell host called with ['[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1'; & 'C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1' -packageScript 'C:\ProgramData\chocolatey\lib\jbang\tools\chocolateyinstall.ps1' -installArguments '' -packageParameters '''] exited with '-1'.

systemsincode avatar Jul 12 '20 22:07 systemsincode

yep ....https://github.com/chocolatey/choco/issues/1590 seems known issue with chocolately...I guess close as not your problem..

systemsincode avatar Jul 12 '20 22:07 systemsincode

Wondering if I can fix it though.

For you; if changing your name is not an option (I assume it's not 😀 maybe try out of scoop install option gives you similar issues or better handled here ?

maxandersen avatar Jul 12 '20 22:07 maxandersen

Believe it or not I've had to change my primary email at work at our aws login is set to this and also hates apostrophes.

systemsincode avatar Jul 12 '20 23:07 systemsincode

yeah man - i'm sorry the world kinda agreed on making one of the characters in your name an escape character. As a scandinavian myself with a 29 lettered alphabet I set pride in ensuring unusual but common characters works ...but in some places it is out of my control :/

I'll keep this one open as a known issue, but as for now looking at the .ps1 files even if I did quote everything in there I'm pretty sure your personal ' will not be treated well by chocolatey's sha comparison logic.

maxandersen avatar Jul 13 '20 05:07 maxandersen

looks like choco fixed this back in 2023 https://github.com/chocolatey/choco/issues/1590

thus closing here.

maxandersen avatar Jul 30 '25 10:07 maxandersen