Repository navigation
uapi16: more fixes from the 0.1.0 review - #4
Merged
Merged
Conversation
brauner
force-pushed
the
contents-checks
branch
from
November 23, 2026 20:59
e22bde4 to
ea4feef
Compare
brauner
force-pushed
the
contents-checks
branch
from
November 23, 2026 21:01
ea4feef to
f2c2b3d
Compare
A writer takes a contents object whose file is the name of the root and
writes
{"contents":[{"file":""}],"name":"x"}
which a reader refuses:
manifest object 1: contents file reference: name is empty: ''
Every name is one a reader takes for a file but the root's, which is
empty, and ContentsSource::File() can hold it: Name::ROOT,
Name::default() and the parent of a name at the top are all the name of
the root. So refuse such a contents object in ContentsObject::check(),
which checks the values of a contents object as a reader does, with the
error a reader gives for the record. That error moves into
Error::invalid_file_reference() so that the reader and the writer share
it. The message only differs in the name of the object, which a reader
doesn't know yet when it reads the contents objects.
Since the previous commit set_contents() runs ContentsObject::check()
as well, through ContentsObject::check_values(). So it now fills in
nothing from such a contents object either. Before, the file "" with
the original size 5 gave the object the size 5 and the contents object
the encoded size 5, both marked as filled in.
The sweep of the previous commit agrees once it has the name of the
root among its files. Before this change 15718 of its file objects with
one or two contents objects didn't agree with a reader, and the writer
took 9741 objects whose records a reader refuses. Now all of them agree,
and where a reader takes the record nothing changes.
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
A reader refuses the record of a file object with more than
MAX_CONTENTS contents objects:
manifest object 1: more than 256 contents entries
and so does a writer. But set_contents() still fills in from them: 257
contents objects with the file "a" and the original size 5 give each of
them the encoded size 5 and the object the size 5, all marked as filled
in. With 256 of them a reader takes the record, and set_contents() gives
the object the reader reads.
Nothing follows from contents objects a reader doesn't take. So with
more than MAX_CONTENTS of them set_contents() fills in nothing at all,
neither for the object nor for any of them, and doesn't check them
either.
Of the 3168800 file objects of the sweep, 4000 have 256 or 257 contents
objects. Before this change 42 of them didn't agree with a reader. Now
none of the file objects of the sweep disagrees, and where a reader
takes the record nothing changes.
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
brauner
force-pushed
the
contents-checks
branch
from
November 23, 2026 21:20
f2c2b3d to
d731833
Compare
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.
Two more fixes for contents objects, on top of #3. Both turned up after
#3 was pushed. 0.1.0 isn't published yet, so they go into it as well,
and it is published from the top once this and #3 are merged.
and wrote "file":"", which a reader refuses. The writer now refuses
it with the error a reader gives for that record, and set_contents()
fills in nothing from it.
objects, although a reader and a writer refuse such an object. Now
nothing is filled in at all then.
With both, set_contents() agrees with a reader on all 3168800 file
objects of the sweep. For a record a reader takes it gives the object
the reader reads, and for one it refuses it fills in nothing.
Every commit builds and passes clippy and the tests with rustc 1.85 and
the current stable, and for the cross targets, musl and i686.