youki-dev / oci-spec-rs

OCI Runtime, Image and Distribution Spec in Rust
https://crates.io/crates/oci-spec
Apache License 2.0
218 stars 52 forks source link

Structs for spec objects should not be platform-dependent #243

Closed burgerdev closed 3 weeks ago

burgerdev commented 1 month ago

Some structs in the runtime spec are conditionally compiled based on the target platform (e.g. PosixRlimitType). If you use the oci-spec library in a Windows or MacOS binary, these definitions are absent and some spec-conforming objects can't be parsed.

This does not matter when, say, building a container runtime, because the compiled binary runs on the target platform. However, I believe that the following use cases should be supported by the spec library:

  1. Generate OCI runtime spec objects for a Linux cluster on a MacOS laptop.
  2. Analyze OCI runtime spec deployed in a Linux cluster with a Windows-based security scanner.
saschagrunert commented 1 month ago

@utam0k would it break youki if we just allow to parse all fields on all platforms?

Apokleos commented 1 month ago

It comes to me that, can youki be compiled on MacOS which you're using. could you have a try ? thx @burgerdev

burgerdev commented 1 month ago

If it helps, sure. Do you mean compiling natively, or cross-compiling? Native darwin builds would not make too much sense, would they? Also, the docs state that Linux is required: https://github.com/containers/youki?tab=readme-ov-file#-getting-started.

utam0k commented 1 month ago

@utam0k would it break youki if we just allow to parse all fields on all platforms?

I don't have MacOS but I don't think it would break youki.