fix: Improve case-sensitive handling #550
Merged
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.
As called out in #523, we have some issues if a manifest file contains files whose names vary only by case. When this happens, we create a
NullReferenceException
that causes the validator to terminate prematurely without providing information to allow the person to address the issue. This PR does the following:It leaves the overall validation logic unchanged, but it detects the case that was causing the
NullReferenceException
and reports it as anAdditionalFile
error. This is consistent with the effect of copying 2 files whose names vary only by case to a file case-insensitive drive. This change allows the validation to complete with errors, rather than exiting prematurelyIf errors are found when scanning on a case-insensitive system, it adds a brief warning to inform the users that if they created the manifest on a case-sensitive system, they may need to validate it on a case-sensitive system. We already have a mechanism to identify case-sensitivity, but it was private inside a class. It is now exposed on the associated interface. Unit tests have been updated to account for the case sensitivity check.
I simulated this case locally by generating a manifest, then manually creating some cases where file entries differed by case and by hash. When the validator runs, the order in which the manifest entries is processed is nondeterministic. As a result, the same manifest file can produce different errors. Depending on the order of processing, the errors may be reported as invalid hashes or as additional files. Because of this, I made the case sensitivity warning general and displayed it at the top of the output results. If any errors are found when validation is performed on a case-insensitive OS, the error header now reads as follows:
There was also a private member in the
OSUtils
class that was notreadonly
and the compiler complained about it. I fixed it while I was touching the file.