Page MenuHomePhabricator

manifest: tigher manifest parsing and flag use

Authored by joerg.sonnenberger on Jul 5 2020, 9:45 PM.



In the manifest line, flags are put directly after the hash, so the
parser has been guessing the presence of flags based on the length of
the hash. Replace this assumption by an enumeration of the valid flags
and removing them from the hash first as they are distinct input values.

Consistently handle the expected 256bit length of the SHA1-replacement
in the pure Python parser. Check that setting flags will use one of the
blessed values.

Extend write logic in the C version to handle 256bit hashes as well.

Verify that hashes always have exactly the expected length. Since
1070df141718 we should no longer depend on the old extra-byte hack.

Diff Detail

rHG Mercurial
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

I'm still working on this changeset to assert the "extra bytes in node" nonsense documented in some places, if someone has a case to actually trigger that it would be very helpful.

joerg.sonnenberger edited the summary of this revision. (Show Details)Jul 6 2020, 7:38 AM
joerg.sonnenberger updated this revision to Diff 21769.
This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.