Closed tobhe closed 3 months ago
Just noticed that this was recently changes in https://github.com/diskfs/go-diskfs/pull/181. Unfortunately that PR doesn't have a lot of context so I don't really understand what motivated this.
This is a good catch, thank you. Unfortunately, with a year plus of time since #181, I do not recall either. 🤦♂️
The more I think about it, the more that change doesn't make sense to me. It should be the following:
The above is what is provided by partitionArraySector(primary bool). So why was it changed? I have no idea.
Can you make the change locally to revert that apparently erroneous #181 and confirm that it works correctly? If so, I will then commit the revert.
Or does your comment "the fixed version with the secondary table pointing to the secondary partition list" mean, "I tested it with this commit and it now works correctly"?
I tested with the commit included in this PR which should be equivalent to a revert of #181 and resulted in the second (correct) output of cpgt show I included above. I didn't test with an actual revert because I only found the responsible commit after I found the fix, but since the fix literally reverses the commit that broke it I think that should be good enough.
No need for a revert. I like a clear new commit better for things like this. You say it is good, all tests pass, let's merge it in.
Do you think cgpt could be used as a standalone test? Create a gpt filesystem in a file, run cgpt on it to validate it?
Sure, that sounds like a good idea. I did write a small program that does that anyway. Let me see if I can clean it up and hook it up to the test infrastructure.
Currently both tables point to the primary GPT partition entry array which doesn't make a lot of sense. Pass "primary" to t.partitionArraySector() to get the right address for each of the tables instead.
I found this because I was building images for a Chrombook and noticed that cgpt always reported the secondary GPT header as corrupted.
For comparison here is the
cgpt show
output without this fix for a minimal ESP example:And in comparison the fixed version with the secondary table pointing to the secondary partition list: