Fix Bug 1180: CRC checksum algorithm changed between 18.2.7 and 19.2.5, all volumes fail#412
Merged
arogge merged 3 commits intobareos:masterfrom Feb 10, 2020
Merged
Conversation
Bug bareos#1180: CRC checksum algorithm changed between 18.2.7 and 19.2.5 Previously the crc32 tests did only rudimentary changes, but did not check with a real bareos block. This patch now adds a dumped label block from a test-installation and calculates the checksum for that. This patch also changes the pattern for another test, so it triggers on an endianess problem too.
Fixes bareos#1180: CRC checksum algorihm changed between 18.2.7 and 19.2.5 Previously crc32.cc did not detect when it couldn't find out what endianess the machine was. This is now fixed so that 1. FreeBSD detects endianess correctly 2. the compile fails when there is no __BYTE_ORDER
Contributor
|
You may want to move the variables to their scope, this would increase readability. Why malloc and not use a std::array? |
franku
approved these changes
Feb 7, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On FreeBSD the new CRC library misdetected endianess. This lead to the big endian variant of the algorighm being used on little endian machines.
While this is still a worthy checksumming algorithm it doesn't lead to the same result as the previous one did.
As this worked its way through automated testing, this PR updates the automated tests for crc32 to catch such an error.
This PR also fixes the underlying problem by adding detection for the endianess on FreeBSD.