https://bugzilla.redhat.com/show_bug.cgi?id=1175759
Bug ID: 1175759
Summary: Checksum validation in PowerShell is wrong
Product: Fedora Documentation
Version: devel
Component: install-guide
Assignee: pbokoc(a)redhat.com
Reporter: gliverma(a)westga.edu
QA Contact: docs-qa(a)lists.fedoraproject.org
CC: pbokoc(a)redhat.com, zach(a)oglesby.co
Description of problem:
I tried to use the info at
http://docs.fedoraproject.org/en-US/Fedora/21/html/Installation_Guide/sec...
and found that the commands did not work due to missing quotes and case
sensitivity.
Version-Release number of selected component (if applicable):
Fedora 21
How reproducible:
Every time for me.
Steps to Reproduce:
1. Download ISO
2. Download checksum file
3. Use code on
http://docs.fedoraproject.org/en-US/Fedora/21/html/Installation_Guide/sec...
Actual results:
PS D:\Downloads> $image = "Fedora-Live-Workstation-x86_64-21-5.iso"
PS D:\Downloads> $checksum_file =
"Fedora-Workstation-21-x86_64-CHECKSUM.md5"
PS D:\Downloads> $sha256 = New-Object -TypeName
System.Security.Cryptography.sha256CryptoSer
viceProvider
PS D:\Downloads> $exepected_checksum = ((Get-Content $checksum_file |
Select-String -Pattern
$image) -split " ")[0]
PS D:\Downloads> $download_checksum =
[System.BitConverter]::ToString($sha256.ComputeHash([S
ystem.IO.File]::ReadAllBytes($PWD\$image)))
At line:1 char:109
+ ... adAllBytes($PWD\$image)))
+ ~
Missing ')' in method call.
At line:1 char:109
+ ... adAllBytes($PWD\$image)))
+ ~~~~~~~
Unexpected token '\$image' in expression or statement.
At line:1 char:116
+ ... tes($PWD\$image)))
+ ~
Unexpected token ')' in expression or statement.
At line:1 char:117
+ ... es($PWD\$image)))
+ ~
Unexpected token ')' in expression or statement.
At line:1 char:118
+ ... s($PWD\$image)))
+ ~
Unexpected token ')' in expression or statement.
+ CategoryInfo : ParserError: (:) [],
ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingEndParenthesisInMethodCall
Expected results:
No errors in console
Additional info:
I fixed the code and made the output more readable. Below is what I think
should be posted on that page of the docs:
$image = "Fedora-Live-Workstation-x86_64-21-5.iso"
$checksum_file = "Fedora-Workstation-21-x86_64-CHECKSUM"
$sha256 = New-Object -TypeName
System.Security.Cryptography.sha256CryptoServiceProvider
$expected_checksum = ((Get-Content $checksum_file | Select-String -Pattern
$image) -split " ")[0].ToLower()
$download_checksum =
[System.BitConverter]::ToString($sha256.ComputeHash([System.IO.File]::ReadAllBytes("$PWD\$image"))).ToLower()
-replace '-', ''
if ( "$download_checksum" -eq "$expected_checksum" ) {
echo "Checksum test passed!"
} else {
echo "Checksum test failed."
}
echo "Download Checksum: $download_checksum"
echo "Expected Checksum: $expected_checksum"
--
You are receiving this mail because:
You are the QA Contact for the bug.