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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read StartDiskNumber as uint32 #83923
Read StartDiskNumber as uint32 #83923
Changes from all commits
c538535
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than duplicate this whole thing what about just flipping the byte you need, within the test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, i'll try. But I changed quite a few bytes in different parts(https://www.diffchecker.com/YK5V7XvS), so any advice would be helpful for me how to do it better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I almost wonder then whether it would make sense to extract that "proto zip" data into a mock with a method like SetStartDiskNumber. That would make it cleaner to use and easier to maintain and extend.
It could in future eg abstract the ability to add more entries, which is more than just flipping some bytes, and maybe in future expose ways to get the bytes corrupted in interesting ways, without the tests knowing about the structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand your idea correctly. We take s_slightlyIncorrectZip64 as a basis and create extensions for it such as SetStartDiskNumber? (and smth like SetCustomHeaderField in future)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes -- I mean, I created that for a particular test and I see it's getting used in another place, now you needed it here and had to make larger edits as you say. But those tests shouldn't need to know the zip format.
So I wonder whether that suggests it would be helpful to wrap the array in a class that exposes it and that class can take care of any modifications a test needs. For now if nothing else you could just paste your new array in there, alongside the other one, but it would be a start.
If you don't want to do that here, I think what you have is fine. (I'll let area owners sign off though)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I don't have an idea for a good implementation of this right now. It is complicated by the fact that different tests use different initialization methods (zip files in ZipTestData, byte arrays through MemberData or static byte arrays)
In my vision, it would look something like this:
In this PR I can move the archive to ZipTestData/StrangeZipFiles folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dotnet/area-system-io-compression would have to say what they would like. I don't have any strong opinion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should tag someone else?