Skip to content

Print file summary on checksum validation failure#35161

Merged
alalazo merged 2 commits intospack:developfrom
haampie:fix/print-more-file-info-on-checksum-validation-failure
Jan 25, 2023
Merged

Print file summary on checksum validation failure#35161
alalazo merged 2 commits intospack:developfrom
haampie:fix/print-more-file-info-on-checksum-validation-failure

Conversation

@haampie
Copy link
Copy Markdown
Member

@haampie haampie commented Jan 25, 2023

Currently we print "sha256 checksum failed for [file]. Expected X but
got Y".

This PR extends that message with file size and contents info:

"... but got Y. File size = 123456 bytes. Contents = b'abc...def'"

That way we can immediately see if the file was downloaded only
partially, or if we downloaded a text page instead of a binary, etc.

This is mostly relevant for CI where the filesystem is not accessible
on failure.

For example:

==> Installing libxc-6.0.0-tzq4pnlyej64ltbzmhlnegkuxymvoob6
==> No binary for libxc-6.0.0-tzq4pnlyej64ltbzmhlnegkuxymvoob6 found: installing from source
==> Fetching https://www.tddft.org/programs/libxc/down.php?file=6.0.0/libxc-6.0.0.tar.gz
==> Error: ChecksumError: sha256 checksum failed for /tmp/harmen/spack-stage/spack-stage-libxc-6.0.0-tzq4pnlyej64ltbzmhlnegkuxymvoob6/libxc-6.0.0.tar.gz
    Expected d2ca205a762200dfba2e6c9e8ca2061aaddc6b7cf42048859fe717a7aa07de7c but got c2ca205a762200dfba2e6c9e8ca2061aaddc6b7cf42048859fe717a7aa07de7c. File size = 62940412 bytes. Contents = b'\x1f\x8b\x08\x00\x00\x00\x00\x00\x02\x03\xec\\{w\xda\xc6...\xbe\xfd\xfb\x8f\xff\xf7\xff\x07V\xf5P[\x00h~\x0f'

Currently we print "sha256 checksum failed for [file]. Expected X but
got Y".

This PR extends that message with file size and contents info:

"... but got Y. File size = 123456 bytes. Contents = b'abc...def'"

That way we can immediately see if the file was downloaded only
partially, or if we downloaded a text page instead of a binary, etc.
@spackbot-app spackbot-app bot added core PR affects Spack core functionality fetching tests General test capability(ies) labels Jan 25, 2023
alalazo
alalazo previously approved these changes Jan 25, 2023
@alalazo alalazo enabled auto-merge (squash) January 25, 2023 14:21
@alalazo alalazo merged commit 5f8c09f into spack:develop Jan 25, 2023
@haampie haampie deleted the fix/print-more-file-info-on-checksum-validation-failure branch January 25, 2023 16:22
kwryankrattiger pushed a commit to kwryankrattiger/spack that referenced this pull request Jan 27, 2023
Currently we print "sha256 checksum failed for [file]. Expected X but
got Y".

This PR extends that message with file size and contents info:

"... but got Y. File size = 123456 bytes. Contents = b'abc...def'"

That way we can immediately see if the file was downloaded only
partially, or if we downloaded a text page instead of a binary, etc.

Co-authored-by: Massimiliano Culpo <[email protected]>
amd-toolchain-support pushed a commit to amd-toolchain-support/spack that referenced this pull request Feb 16, 2023
Currently we print "sha256 checksum failed for [file]. Expected X but
got Y".

This PR extends that message with file size and contents info:

"... but got Y. File size = 123456 bytes. Contents = b'abc...def'"

That way we can immediately see if the file was downloaded only
partially, or if we downloaded a text page instead of a binary, etc.

Co-authored-by: Massimiliano Culpo <[email protected]>
techxdave pushed a commit to Tech-XCorp/spack that referenced this pull request Feb 17, 2023
Currently we print "sha256 checksum failed for [file]. Expected X but
got Y".

This PR extends that message with file size and contents info:

"... but got Y. File size = 123456 bytes. Contents = b'abc...def'"

That way we can immediately see if the file was downloaded only
partially, or if we downloaded a text page instead of a binary, etc.

Co-authored-by: Massimiliano Culpo <[email protected]>
jmcarcell pushed a commit to key4hep/spack that referenced this pull request Apr 13, 2023
Currently we print "sha256 checksum failed for [file]. Expected X but
got Y".

This PR extends that message with file size and contents info:

"... but got Y. File size = 123456 bytes. Contents = b'abc...def'"

That way we can immediately see if the file was downloaded only
partially, or if we downloaded a text page instead of a binary, etc.

Co-authored-by: Massimiliano Culpo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core PR affects Spack core functionality fetching tests General test capability(ies)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants