GithubHelp home page GithubHelp logo

chocolatey / checksum Goto Github PK

View Code? Open in Web Editor NEW
14.0 12.0 13.0 2.1 MB

Validates MD5/SHA1 CheckSums on the command line.

License: Apache License 2.0

Shell 5.49% C# 80.60% Batchfile 2.00% PowerShell 11.92%

checksum's Issues

Uplift to .Net framework 4.8

Description

Switch to use .NET Framework 4.8, rather than the currently targeted 4.0.

Why Is It Needed

Chocolatey CLI is moving to use .NET Framework 4.8, and checksum should be upgraded as well.

Related Issues and Tickets

Acceptance Tests

All tests, unit, integration, and Pester tests, all continue to work as expected.

Done Checklist

  • Documentation has been updated.
  • Automated tests have been added to cover this bug.
  • Manual tests have been added to cover this bug.

TeamCity Build Definition Required

Is Your Feature Request Related To A Problem? Please describe.

N/A

Describe The Solution. Why is it needed?

As part of improvements to Chocolatey Software build processes, we're moving build definitions into code where possible.
This will allow us to import the build to any of the TeamCity servers we need to.

Additional Context.

N/A

Related Issues

BuildProcess - Replace UppercuT build scripts

Description

Replace the UppercuT build scripts with Cake or a similar tool that allows updated build tools.

Why Is It Needed

The UppercuT build scripts are showing their age with being unable to work with newer versions of the .Net build process.

Related Issues and Tickets

GitHub issue for Open Source Chocolatey
GitLab issue for Chocolatey Licensed Extension

Acceptance Tests

  • Replace build.bat and test.bat with new scripts.
  • Ensure that building and testing still works as expected.

Done Checklist

  • Documentation has been updated.
  • Build scripts have been updated.

Chocolatey is using checksum.exe which is slow and can't cope with larger than 2GB files

Checklist

  • I confirm there are no unresolved issues reported on the Chocolatey Status page.
  • I have verified this is the correct repository for opening this issue.
  • I have verified no other issues exist related to my problem.
  • I have verified this is not an issue for a specific package.
  • I have verified this issue is not security related.
  • I confirm I am using official, and not unofficial, or modified, Chocolatey products.

What You Are Seeing?

Package fails to validate or install because download is larger than 2GB

What is Expected?

Chocolatey should be able to cope with large files for calculating checksum/filehash

How Did You Get This To Happen?

Tried to install package with downloaded file larger than 2GB eg- https://community.chocolatey.org/packages/resharper-platform/241.0.20240528.180551

System Details

As per verifier environment

Installed Packages

n/a

Output Log

2024-06-10 01:03:39,185 4952 [INFO ] - Download of JetBrains.dotUltimate.2024.1.3.exe (2.55 GB) completed.
2024-06-10 01:03:42,544 4952 [DEBUG] - No runtime virus checking built into FOSS Chocolatey. Check out Pro/Business - https://chocolatey.org/compare
2024-06-10 01:03:42,637 4952 [DEBUG] - Verifying package provided checksum of '5342ede24c95a30261c0d43402c5cd3687d4b208233f028d7cb1ef7fe99a5a25' for 'C:\ProgramData\chocolatey\lib\resharper-platform\JetBrains.dotUltimate.2024.1.3.exe'.
2024-06-10 01:03:42,793 4952 [DEBUG] - Running Get-ChecksumValid -file 'C:\ProgramData\chocolatey\lib\resharper-platform\JetBrains.dotUltimate.2024.1.3.exe' -checksum '5342ede24c95a30261c0d43402c5cd3687d4b208233f028d7cb1ef7fe99a5a25' -checksumType 'sha256' -originalUrl 'https://download.jetbrains.com/resharper/dotUltimate.2024.1.3/JetBrains.dotUltimate.2024.1.3.exe' 
2024-06-10 01:03:43,091 4952 [DEBUG] - checksum.exe found at 'C:\ProgramData\chocolatey\helpers\..\tools\checksum.exe'
2024-06-10 01:03:43,123 4952 [DEBUG] - Executing command ['C:\ProgramData\chocolatey\helpers\..\tools\checksum.exe' -c="5342ede24c95a30261c0d43402c5cd3687d4b208233f028d7cb1ef7fe99a5a25" -t="sha256" -f="C:\ProgramData\chocolatey\lib\resharper-platform\JetBrains.dotUltimate.2024.1.3.exe"]
2024-06-10 01:40:08,840 4952 [WARN ] - Chocolatey timed out waiting for the command to finish. The timeout
 specified (or the default value) was '2700' seconds. Perhaps try a
 higher `--execution-timeout`? See `choco -h` for details.
2024-06-10 01:40:08,888 4952 [DEBUG] - Calling command ['"C:\Windows\System32\shutdown.exe" /a']
2024-06-10 01:40:09,955 4952 [DEBUG] - Command ['"C:\Windows\System32\shutdown.exe" /a'] exited with '1116'
2024-06-10 01:40:10,683 4952 [DEBUG] - Capturing package files in 'C:\ProgramData\chocolatey\lib\resharper-platform'
2024-06-10 01:40:10,745 4952 [WARN ] - Error computing hash for 'C:\ProgramData\chocolatey\lib\resharper-platform\JetBrains.dotUltimate.2024.1.3.exe'
 Hash will be special code for locked file or file too big instead.
 Captured error:
  The file is too long. This operation is currently limited to supporting files less than 2 gigabytes in size.


### Additional Context

_No response_

Invalid: Argument parsing and hash type currently not complete/functional

I was trying to simply use the first of only two real mandatory switches - the file path:

C:\temp> checksum --hashtype=sha256 -f="c:\temp\rhash-1.3.5-1-win64.zip"
-f=c:\temp\rhash-1.3.5-1-win64.zip: The given path's format is not supported.
C:\temp> checksum -f="c:\temp\rhash-1.3.5-1-win64.zip"
-f=c:\temp\rhash-1.3.5-1-win64.zip: The given path's format is not supported.
C:\temp> checksum --file="c:\temp\rhash-1.3.5-1-win64.zip"
--file=c:\temp\rhash-1.3.5-1-win64.zip: The given path's format is not supported.
C:\temp> checksum --file='c:\temp\rhash-1.3.5-1-win64.zip'
--file=c:\temp\rhash-1.3.5-1-win64.zip: The given path's format is not supported.
C:\temp> checksum --file=c:\temp\rhash-1.3.5-1-win64.zip
--file=c:\temp\rhash-1.3.5-1-win64.zip: The given path's format is not supported.
C:\temp> checksum rhash-1.3.5-1-win64.zip
a965d954b7ef97d0801eb267a830aedd *rhash-1.3.5-1-win64.zip

...and then I read the "parse_arguments_and_set_up_configuration" code and see that you have not coded handling the path (yet?).

Then I just wanted to hash SHA256, so I try the second switch:

C:\temp> checksum .\rhash-1.3.5-1-win64.zip
a965d954b7ef97d0801eb267a830aedd *rhash-1.3.5-1-win64.zip
C:\temp> checksum .\rhash-1.3.5-1-win64.zip -t sha256
a965d954b7ef97d0801eb267a830aedd *rhash-1.3.5-1-win64.zip
C:\temp> checksum .\rhash-1.3.5-1-win64.zip -t=sha256
a965d954b7ef97d0801eb267a830aedd *rhash-1.3.5-1-win64.zip
C:\temp> checksum .\rhash-1.3.5-1-win64.zip -t 'sha256'
a965d954b7ef97d0801eb267a830aedd *rhash-1.3.5-1-win64.zip
C:\temp> checksum --hashtype=sha256 rhash-1.3.5-1-win64.zip
a965d954b7ef97d0801eb267a830aedd *rhash-1.3.5-1-win64.zip
C:\temp> checksum --hashtype=sha256 -f=rhash-1.3.5-1-win64.zip
C:\temp> checksum rhash-1.3.5-1-win64.zip
a965d954b7ef97d0801eb267a830aedd *rhash-1.3.5-1-win64.zip
C:\temp> checksum rhash-1.3.5-1-win64.zip --hashtype sha256
a965d954b7ef97d0801eb267a830aedd *rhash-1.3.5-1-win64.zip
C:\temp> checksum rhash-1.3.5-1-win64.zip --hashtype=sha256
a965d954b7ef97d0801eb267a830aedd *rhash-1.3.5-1-win64.zip
C:\temp> checksum rhash-1.3.5-1-win64.zip --hashtype="sha256"
a965d954b7ef97d0801eb267a830aedd *rhash-1.3.5-1-win64.zip
C:\temp> checksum rhash-1.3.5-1-win64.zip --hashtype "sha256"
a965d954b7ef97d0801eb267a830aedd *rhash-1.3.5-1-win64.zip
C:\temp> checksum rhash-1.3.5-1-win64.zip -t sha256
a965d954b7ef97d0801eb267a830aedd *rhash-1.3.5-1-win64.zip
C:\temp> checksum rhash-1.3.5-1-win64.zip -t "sha256"
a965d954b7ef97d0801eb267a830aedd *rhash-1.3.5-1-win64.zip
C:\temp> checksum rhash-1.3.5-1-win64.zip -t="sha256"
a965d954b7ef97d0801eb267a830aedd *rhash-1.3.5-1-win64.zip

....and then after fighting with it, I jumped back here and read the code for the "parse_arguments_and_set_up_configuration" method and immediately saw that you simply have not coded any handling for the hash type (yet?)......not sure the status of this little util but you may want to just note in the util's help and/or the readme that it only currently computes MD5 and the switches do not work and maybe a mention of whether there are plans to do so etc.

It looked like a cool quick console util that does what some of my PS module functions do so figured it could come in handy. Maybe if I get some time I can do a quick pull and help you finish it. :(

Does not work on file paths with apostrophe(s)

What You Are Seeing?

Checksum is stripping apostrophe(s) from file paths, and therefore not finding the file to checksum.

What is Expected?

That checksum.exe will work on file paths that contain apostrophe(s).

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

  1. Create a Windows 10 offline user called Mark's and it to an administrator account
  2. Log in as Mark's
  3. Run choco install 4k-video-downloader

Output Log

Log

Verifying package provided checksum of 'bd60576f083e250245978fff6030e7bf8e448fda4b24dd7715b2f67d5c3d9e47' for 'C:\Users\Mark's\AppData\Local\Temp\chocolatey\4k-video-downloader\4.20.4\4k-video-downloaderInstall.MSI'.
Running Get-ChecksumValid -file 'C:\Users\Mark's\AppData\Local\Temp\chocolatey\4k-video-downloader\4.20.4\4k-video-downloaderInstall.MSI' -checksum 'bd60576f083e250245978fff6030e7bf8e448fda4b24dd7715b2f67d5c3d9e47' -checksumType 'sha256' -originalUrl 'https://dl.4kdownload.com/app/4kvideodownloader_4.20.4_x64.msi?source=chocolatey'
checksum.exe found at 'C:\ProgramData\chocolatey\helpers\..\tools\checksum.exe'
Executing command ['C:\ProgramData\chocolatey\helpers\..\tools\checksum.exe' -c="bd60576f083e250245978fff6030e7bf8e448fda4b24dd7715b2f67d5c3d9e47" -t="sha256" -f="C:\Users\Mark's\AppData\Local\Temp\chocolatey\4k-video-downloader\4.20.4\4k-video-downloaderInstall.MSI"]
File 'C:\Users\Marks\AppData\Local\Temp\chocolatey\4k-video-downloader\4.20.4\4k-video-downloaderInstall.MSI' doesn't exist.
Command ['C:\ProgramData\chocolatey\helpers\..\tools\checksum.exe' -c="bd60576f083e250245978fff6030e7bf8e448fda4b24dd7715b2f67d5c3d9e47" -t="sha256" -f="C:\Users\Mark's\AppData\Local\Temp\chocolatey\4k-video-downloader\4.20.4\4k-video-downloaderInstall.MSI"] exited with '1'.
ERROR: Checksum for 'C:\Users\Mark's\AppData\Local\Temp\chocolatey\4k-video-downloader\4.20.4\4k-video-downloaderInstall.MSI' did not meet 'bd60576f083e250245978fff6030e7bf8e448fda4b24dd7715b2f67d5c3d9e47' 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.
 at Get-ChecksumValid, C:\ProgramData\chocolatey\helpers\functions\Get-CheckSumValid.ps1: line 210
at Get-ChocolateyWebFile, C:\ProgramData\chocolatey\helpers\functions\Get-ChocolateyWebFile.ps1: line 385
at Install-ChocolateyPackage, C:\ProgramData\chocolatey\helpers\functions\Install-ChocolateyPackage.ps1: line 402
at <ScriptBlock>, C:\ProgramData\chocolatey\lib\4k-video-downloader\tools\chocolateyinstall.ps1: line 25
at <ScriptBlock>, C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1: line 49
at <ScriptBlock>, <No file>: line 1

Add required VERIFICATION.txt file

As part of submitting a package to the Chocolatey Community Repository, a reasonably new requirement is that if it is an embedded package, that it contains a VERIFICATION.txt file, explaining how the binary files can be verified.

This wasn't in place that last time we pushed checksum to the CCR, so we need to get this added., otherwise, it can't be approved.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.