bihealth / sodar-server

SODAR: System for Omics Data Access and Retrieval
https://github.com/bihealth/sodar-server
MIT License
14 stars 3 forks source link

Make MD5 checksum comparison case insensitive #2032

Closed mziehm closed 3 weeks ago

mziehm commented 3 weeks ago

Having cicumvented issue #1818 by using the following powershell command: `Get-ChildItem -File | ForEach-Object { $hash = Get-FileHash $.FullName -Algorithm MD5 $md5File = "$($.FullName).md5"

Create a StreamWriter to write UTF-8 without BOM

$utf8NoBOMEncoding = New-Object System.Text.UTF8Encoding($false)
[System.IO.File]::WriteAllText($md5File, $hash.Hash, $utf8NoBOMEncoding)

}`

(because the powershell 5.0 (default on Win10), does not have a -Encoding UTF8NoBOM option for out-file)

I am faced with the following error: Failed to validate landing zone files: BatchValidateChecksumsTask failed: Checksums do not match for "xxx" in resource "ceph-1" (File: 57F53D6C2103C4F331B67BD65B533209; iRODS: 57f53d6c2103c4f331b67bd65b533209)

i.e. md5 checksum capitalization mismatch (my md5 sums have capital letters, iRODS lower case and this is not accepted as equal) i.e. comparison is case-sensitive and should be probably case-insensitive.

IMO, if there are very specific requirement for the md5 files this should be documented (better loosend were possible, whithout risk)

mziehm commented 3 weeks ago

Work around powershell 5.: `Get-ChildItem -File | ForEach-Object { $hash = Get-FileHash $.FullName -Algorithm MD5 $md5File = "$($.FullName).md5"

Create a StreamWriter to write UTF-8 without BOM

$utf8NoBOMEncoding = New-Object System.Text.UTF8Encoding($false)
[System.IO.File]::WriteAllText($md5File, $hash.Hash.ToLower(), $utf8NoBOMEncoding)

}`

mikkonie commented 3 weeks ago

This is a very trivial update of course, so I'll include it in the next release.

mikkonie commented 3 weeks ago

Done.