Repository navigation
Add UAPI.16: File Manifest spec - #213
Conversation
|
(mostly posted here to start the discussion) |
54f9001 to
f4a161c
Compare
|
As mentioned elsewhere, it would be great if this could be embedded in existing json manifests, to avoid having to ship multiple ones, and consumers knew how to find it - essentially the existing mkosi manifest. If I understand correctly, the only thing needed for this to work is to establish an optional and well-known "key" under which this object can be found under a parent json object? |
|
Is the intention of this specc to solve this issue, or is this trying to solve a different problem? |
|
@Foxboron Totally different problem, it's designed to replace SHA256SUMS for sysupdate to list remote resources |
|
@daandemeyer Hmm, should the title be |
keszybz
left a comment
There was a problem hiding this comment.
I think it'd be nice to use semantic line breaks here. We agreed in general to do this in new documents.
I'd probably call the other spec an "Inode Spec", since that's more what it is. Or "File System Object" or so. This one here is purely about files. You are absolutely right, this might be confusing, but it will either way I am sure. I am against naming this after the software that likely implements this, it's supposed to be a generic spec, independent of any specific implementation. |
|
Hmm, we could also consider extending this spec to just cover what is requested in #207 too. I mean, if I grok this right it would just mean adding some more fields to encode UNIX inode properties in full: i.e. |
f4a161c to
914c9f6
Compare
|
Posted a new version covering all comments, but not trying to address #207 (would prefer if we did that in a later follow-up PR) |
^^^ ? |
i don't grok this request? it seems to me that the manifest format here could easily be embedded by mkosi's package manifests if it wants file-level information. But that's something to decide and define in mkosi's format, it's not something we could dictate here? |
Having a "suggested" key for the object would allow consumers to know what to search for, without having to come up with one for each case. Just like there's a "suggested" filename for the file in the spec? |
|
I wouldn't merge this into the mkosi manifest but treat it like the SHA256SUMS file mkosi can generate with |
|
Nah it has to be in the same file, at least as an option, as I most definitely do not want to have to deal with having to publish yet another file |
Sorry I'm not groking how you can avoid this. Anyway, this isn't "yet another file" to publish since it'll replace SHA256SUMS |
The UAPI.16 spec is being discussed here: uapi-group/specifications#213
well, i was more thinking about extensions that are on the same conceptual level as signatures here. for example, an extension that tops the metric up with a tpm quote or so, which isn't strictly a signature, but does possible pin the manifest sufficiently in a cryptographic sense. or a reference to some crytographic ledger or so |
|
i dropped the "WIP" and "do-not-merge" decoration/labels now from this. From my perspective this is good to go. would be thankful if anyone who is not me could bless this and we can get this merged. i think the general structure is acceepted now by most, and tweaks we can always do after the initial publishing. on systemd's side the big PR that makes use of all of this is hopefully close to being merged, hence would be great if we could get both in at the same time. |
|
The big PR on systemd's side is systemd/systemd#44292 |
The UAPI.16 spec is being discussed here: uapi-group/specifications#213 This also adds the opt-in "user-name" and "group-name" fields, which include the owning user and group names ("userName", "groupName"), resolved via NSS on the host, like tar does it. Since they reflect the host's view of the IDs, they are not included by default.
The UAPI.16 spec is being discussed here: uapi-group/specifications#213 This also adds the opt-in "user-name" and "group-name" fields, which include the owning user and group names ("userName", "groupName"), resolved via NSS on the host, like tar does it. Since they reflect the host's view of the IDs, they are not included by default.
The UAPI.16 spec is being discussed here: uapi-group/specifications#213 This also implements the opt-in "user-name" and "group-name" fields, which include the owning user and group names ("userName", "groupName"), resolved via NSS on the host, like tar does it. Since they reflect the host's view of the IDs, they are not included by default.
The UAPI.16 spec is being discussed here: uapi-group/specifications#213 This also implements the opt-in "user-name" and "group-name" fields, which include the owning user and group names ("userName", "groupName"), resolved via NSS on the host, like tar does it. Since they reflect the host's view of the IDs, they are not included by default.
|
hey, is it possible that this file manifest spec could have a common simple library for integration? |
The entries of a directory may come in any order. That's convenient for producers but leaves consumers guessing. A consumer that wants to merge manifests, or to check that no name is listed twice, has to keep every name of a directory around for a manifest in an unknown order. With the code point ordering it only needs to compare each name with the previous one, so the memory it needs doesn't grow with the manifest. Mandating one ordering was rejected when the spec was written (cf. [1]): some listings are better sorted by version or in the order their entries were added, and GPT manifests list partitions in the order of the partition table. So instead let a manifest declare that it is sorted by code point, through a new objectOrder field of the root file object, and recommend that manifests sorted that way declare it. A consumer that relies on it checks it while reading, which costs nothing given the above. The field says that the complete names strictly increase. That covers the order within each directory, rules out repeated names, and for a flat listing it also means that the entries of an implied directory come together. The field describes the manifest and not the root directory. So tools that combine manifests don't compare it between their inputs, and only set it on their output if it holds there. [1]: uapi-group#213 (comment) Signed-off-by: Christian Brauner (Amutable) <[email protected]>
The spec says that a field set to null and a field left out are the same, and several fields have defaults that may be spelled out or left out. But it doesn't say when two file objects mean the same, so tools that compare manifests compare their JSON instead. The join that systemd-manifest is gaining refuses to join objects that only differ in how the same values are written: "type":"reg" versus no type, "uid":null versus no uid, or an uppercase versus a lowercase digest. Making the JSON itself reproducible was rejected when the spec was written (cf. [1]), and this doesn't need it. Define equivalence by value instead, and recommend that tools comparing or combining manifests use it. [1]: uapi-group#213 Signed-off-by: Christian Brauner (Amutable) <[email protected]>
The entries of a directory may come in any order. That's convenient for producers but leaves consumers guessing. A consumer that wants to merge manifests, or to check that no name is listed twice, has to keep every name of a directory around for a manifest in an unknown order. With the code point ordering it only needs to compare each name with the previous one, so the memory it needs doesn't grow with the manifest. Mandating one ordering was rejected when the spec was written (cf. [1]): some listings are better sorted by version or in the order their entries were added, and GPT manifests list partitions in the order of the partition table. So instead let a manifest declare that it is sorted by code point, through the new "order" field of the root file object, and recommend that manifests sorted that way declare it. A consumer that relies on it checks it while reading, which costs nothing given the above. The field says that the complete names strictly increase. That covers the order within each directory, rules out repeated names, and for a flat listing it also means that the entries of an implied directory come together. The field describes the manifest and not the root directory. So tools that combine manifests don't compare it between their inputs, and only set it on their output if it holds there. [1]: uapi-group#213 (comment) Signed-off-by: Christian Brauner (Amutable) <[email protected]>
The spec says that a field set to null and a field left out are the same, and several fields have defaults that may be spelled out or left out. But it doesn't say when two file objects mean the same, so tools that compare manifests compare their JSON instead. The join that systemd-manifest is gaining refuses to join objects that only differ in how the same values are written: "type":"reg" versus no type, "uid":null versus no uid, or an uppercase versus a lowercase digest. Making the JSON itself reproducible was rejected when the spec was written (cf. [1]), and this doesn't need it. Define equivalence by value instead, and recommend that tools comparing or combining manifests use it. [1]: uapi-group#213 Signed-off-by: Christian Brauner (Amutable) <[email protected]>
The entries of a directory may come in any order. That's convenient for producers but leaves consumers guessing. A consumer that wants to merge manifests, or to check that no name is listed twice, has to keep every name of a directory around for a manifest in an unknown order. With the code point ordering it only needs to compare each name with the previous one, so the memory it needs doesn't grow with the manifest. Mandating one ordering was rejected when the spec was written (cf. [1]): some listings are better sorted by version or in the order their entries were added, and GPT manifests list partitions in the order of the partition table. So instead let a manifest declare that it is sorted by code point, through the new "order" field of the root file object, and recommend that manifests sorted that way declare it. A consumer that relies on it checks it while reading, which costs nothing given the above. The field says that the complete names strictly increase. That covers the order within each directory and rules out repeated names. The field describes the manifest and not the root directory. So tools that combine manifests don't compare it between their inputs, and only set it on their output if it holds there. [1]: uapi-group#213 (comment) Signed-off-by: Christian Brauner (Amutable) <[email protected]>
The spec doesn't say when two file objects mean the same, so tools that compare manifests compare their JSON text, and the result depends on how a producer happens to write things. The join that systemd-manifest is gaining refuses to join objects that only differ in how they are written, for example "uid":null versus no uid at all. Making the JSON itself reproducible was rejected when the spec was written (cf. [1]), and this doesn't need it. Define equivalence on the level of JSON values instead. The order of fields and the escaping of strings don't matter, and a field set to null is the same as a field that isn't set, which the spec already says elsewhere. Values aren't interpreted any further, so this works just as well for fields a tool doesn't know, which keeps the spec extensible (cf. [2]). That's also what the join does, except that it tells null and unset apart. Comparing values means that "type":"reg" and no type at all, or an uppercase and a lowercase sha256, are not equivalent. The spec already says that sha256 SHALL be written in lowercase. For the former, recommend that generators don't spell out defaults. [1]: uapi-group#213 [2]: uapi-group#253 (comment) Signed-off-by: Christian Brauner (Amutable) <[email protected]>
The entries of a directory may come in any order. That's convenient for producers but leaves consumers guessing. A consumer that wants to merge manifests, or to check that no name is listed twice, has to keep every name of a directory around for a manifest in an unknown order. With the code point ordering it only needs to compare each name with the previous one, so the memory it needs doesn't grow with the manifest. Mandating one ordering was rejected when the spec was written (cf. [1]): some listings are better sorted by version or in the order their entries were added, and GPT manifests list partitions in the order of the partition table. So instead let a manifest declare that it is sorted by code point, through the new "order" field of the root file object, and recommend that manifests sorted that way declare it. A consumer that relies on it checks it while reading, which costs nothing given the above. The field says that the complete names strictly increase. That covers the order within each directory and rules out repeated names. The field describes the manifest and not the root directory. So tools that combine manifests don't compare it between their inputs, and only set it on their output if it holds there. [1]: uapi-group#213 (comment) Signed-off-by: Christian Brauner (Amutable) <[email protected]>
The spec doesn't say when two file objects mean the same, so tools that compare manifests compare their JSON text, and the result depends on how a producer happens to write things. The join that systemd-manifest is gaining refuses to join objects that only differ in how they are written, for example "uid":null versus no uid at all. Making the JSON itself reproducible was rejected when the spec was written (cf. [1]), and this doesn't need it. Define equivalence on the level of JSON values instead. The order of fields and the escaping of strings don't matter, and a field set to null is the same as a field that isn't set, which the spec already says elsewhere. Values aren't interpreted any further, so this works just as well for fields a tool doesn't know, which keeps the spec extensible (cf. [2]). That's also what the join does, except that it tells null and unset apart. Comparing values means that "type":"reg" and no type at all, or an uppercase and a lowercase sha256, are not equivalent. The spec already says that sha256 SHALL be written in lowercase. For the former, recommend that generators don't spell out defaults. [1]: uapi-group#213 [2]: uapi-group#253 (comment) Signed-off-by: Christian Brauner (Amutable) <[email protected]>
Currently, the entries of a directory may appear in any order. The spec recommends sorting them by code point, by UAPI.10 version or by the time they were added, and a manifest sorted by code point should declare it with the `order` field. That's a problem for tools that create a file system or an archive from a manifest. ufat creates FAT images from manifests and ucpio creates cpio archives from them, and both read the manifest record by record. If the entries of a directory may come in any order, such a builder has to keep the names of every directory that is still open in memory to find a name that is listed twice, or it has to sort the whole manifest first, which takes memory or temporary storage in proportion to the size of the manifest. And if two producers list the same tree in different orders, a builder that writes the entries in the order of the manifest creates two different images of the same tree. When the spec was added I asked to either mandate one ordering or to just say "any order". Lennart preferred "any order", since sorting is hard and different use-cases want different orderings, such as version ordering (cf. [1]). For listings like the ones sysupdate consumes it's also handy to just append new entries at the end (cf. [2]). And a manifest that only describes files that exist already, for example to verify them later, doesn't need a particular order either. systemd-manifest verify checks every file object on its own. So we shouldn't mandate one ordering for every manifest. Instead, let's put the rule on the manifests that file systems and archives are created from. The producer knows whether it generates a manifest for that or for describing files that exist already. Such a manifest must list the entries of every directory in the code point ordering, and must declare it with `order`. The declaration is in the root file object, so a builder knows up front what it is going to get, and it can check the order while reading with one comparison of each name with the previous one. A builder may refuse a manifest that is not in the code point ordering instead of sorting it. Manifests of a GPT partition table are not affected. systemd-repart --manifest-gpt lists the whole image and then the partitions in the order of its partition list, which for a table it created is the order of the partition table. Nothing changes for the tools that write such manifests today but the declaration. systemd-manifest make, and systemd-dissect --uapi16 and systemd-repart --manifest, which use the same code, already sort every directory with strcmp(), whatever their output is used for later. So they can always set `order`, which none of them does yet. While at it, point to the exception where the spec says that files may appear in any order within a directory. [1]: uapi-group#213 (comment) [2]: uapi-group#253 (comment) Signed-off-by: Christian Brauner (Amutable) <[email protected]>
Currently, the entries of a directory may appear in any order. The spec recommends sorting them by code point, by UAPI.10 version or by the time they were added, and a manifest sorted by code point should declare it with the `order` field. That's a problem for tools that create a file system or an archive from a manifest. ufat creates FAT images from manifests and ucpio creates cpio archives from them, and both read the manifest record by record. If the entries of a directory may come in any order, such a builder has to keep the names of every directory that is still open in memory to find a name that is listed twice, or it has to sort the whole manifest first, which takes memory or temporary storage in proportion to the size of the manifest. And if two producers list the same tree in different orders, a builder that writes the entries in the order of the manifest creates two different images of the same tree. When the spec was added I asked to either mandate one ordering or to just say "any order". Lennart preferred "any order", since sorting is hard and different use-cases want different orderings, such as version ordering (cf. [1]). For listings like the ones sysupdate consumes it's also handy to just append new entries at the end (cf. [2]). And a manifest that only describes files that exist already, for example to verify them later, doesn't need a particular order either. systemd-manifest verify checks every file object on its own. So we shouldn't mandate one ordering for every manifest. Instead, let's put the rule on the manifests that file systems and archives are created from, and on the ones whose file objects are placed in a file system or an archive that exists already. The producer knows whether it generates a manifest for that or for describing files that exist already. Such a manifest must list the entries of every directory in the code point ordering, and must declare it with `order`. The declaration is in the root file object, so a builder knows up front what it is going to get, and it can check the order while reading with one comparison of each name with the previous one. A builder, or a tool that adds files to an existing file system or archive, may refuse a manifest that is not in the code point ordering instead of sorting it. For adding files we also need to cover the manifest of the file system or archive that exists already. If that manifest declares an ordering and the new file objects are added to it, it has to stay in that ordering and keep declaring it. So a tool can't just append them at the end and drop `order`. Otherwise a builder may refuse to create the image again from the updated manifest, and the manifest differs from the one of the same image created in one go. Since the new file objects come in the code point ordering too, the tool can merge them in with one pass. Note that this is only about the manifests. Where the new entries end up in the file system or archive is up to the tool. Manifests of a GPT partition table are not affected. systemd-repart --manifest-gpt lists the whole image and then the partitions in the order of its partition list, which for a table it created is the order of the partition table. Nothing changes for the tools that write such manifests today but the declaration. systemd-manifest make, and systemd-dissect --uapi16 and systemd-repart --manifest, which use the same code, already sort every directory with strcmp(), whatever their output is used for later. So they can always set `order`, which none of them does yet. While at it, point to the exception where the spec says that files may appear in any order within a directory, say "where" instead of "even if" in the two places that say that no ordering is mandated, and mention the new requirement where the `order` field is described. [1]: uapi-group#213 (comment) [2]: uapi-group#253 (comment) Signed-off-by: Christian Brauner (Amutable) <[email protected]>
Tools like ufat and ucpio create images from manifests and read them record by record. If the entries of a directory may come in any order, they have to keep the names of every open directory in memory to catch a name that is listed twice, or sort the whole manifest first. And the same tree listed in two orders results in two different images. When the spec was added Lennart preferred "any order" over mandating one ordering (cf. [1]), and a manifest that only describes files that exist already doesn't need one. So let's only require the code point ordering for manifests that are generated for creating a file system or an archive, or for placing file objects in an existing one. They must declare it with `order`, and consumers may refuse manifests that aren't sorted. GPT manifests are not affected. If the manifest of an existing file system or archive declares an ordering, adding file objects to it must preserve the ordering and its declaration. This is only about the manifests. Where the entries end up in the file system or archive is up to the tool. systemd-manifest make, systemd-dissect --uapi16 and systemd-repart --manifest already sort with strcmp(), so they only need to set `order`. While at it, adjust the sentences that say that no ordering is mandated, and point to the new rule where `order` is described. [1]: uapi-group#213 (comment) Signed-off-by: Christian Brauner (Amutable) <[email protected]>
Tools like ufat and ucpio create images from manifests and read them record by record. If the entries of a directory may come in any order, they have to keep the names of every open directory in memory to catch a name that is listed twice, or sort the whole manifest first. And the same tree listed in two orders results in two different images. When the spec was added Lennart preferred "any order" over mandating one ordering (cf. [1]), and a manifest that only describes files that exist already doesn't need one. So let's only require the code point ordering for manifests that are generated for creating a file system or an archive, or for placing file objects in an existing one. They must declare it with `order`, and consumers may refuse manifests that aren't sorted or don't declare it. GPT manifests are not affected. If the manifest of an existing file system or archive declares an ordering, adding file objects to it must preserve the ordering and its declaration. This is only about the manifests. Where the entries end up in the file system or archive is up to the tool. systemd-manifest make, systemd-dissect --uapi16 and systemd-repart --manifest already sort with strcmp(), so they only need to set `order`. While at it, adjust the sentences that say that no ordering is mandated, and point to the new rule where `order` is described. [1]: uapi-group#213 (comment) Signed-off-by: Christian Brauner (Amutable) <[email protected]>
Tools like ufat and ucpio create images from manifests and read them record by record. If the entries of a directory may come in any order, they have to keep the names of every open directory in memory to catch a name that is listed twice, or sort the whole manifest first. And the same tree listed in two orders results in two different images. When the spec was added Lennart preferred "any order" over mandating one ordering (cf. [1]), and a manifest that only describes files that exist already doesn't need one. So let's only require the code point ordering for manifests that are generated for creating a file system or an archive, or for placing file objects in an existing one. They must declare it with `order`, and consumers may refuse manifests that aren't sorted or don't declare it. GPT manifests are not affected. If the manifest of an existing file system or archive declares an ordering, adding file objects to it must preserve the ordering and its declaration. This is only about the manifests. Where the entries end up in the file system or archive is up to the tool. systemd-manifest make, systemd-dissect --uapi16 and systemd-repart --manifest already sort with strcmp(), so they only need to set `order`. While at it, adjust the sentences that say that no ordering is mandated, and point to the new rule where `order` is described. [1]: #213 (comment) Signed-off-by: Christian Brauner (Amutable) <[email protected]>
Yes! I'm building this currently and should be ready for a release soon. |
Thank you @brauner ! |
I should be able to publish it this coming week btw. I would try adding support to |
@hsiangkao I published a first version of https://github.com/systemd/uapi16 |
No description provided.