Skip to content

Release 2025.7 & regenerate bindings#3548

Closed
jmarrero wants to merge 3 commits intoostreedev:mainfrom
jmarrero:release-20257
Closed

Release 2025.7 & regenerate bindings#3548
jmarrero wants to merge 3 commits intoostreedev:mainfrom
jmarrero:release-20257

Conversation

@jmarrero
Copy link
Copy Markdown
Member

@jmarrero jmarrero commented Nov 6, 2025

No description provided.

@github-actions github-actions bot added the area/rust-bindings Relates to the Rust bindings for the C library label Nov 6, 2025
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request primarily focuses on bumping the project's version and regenerating the Rust bindings. The changes include updating dependencies like gio and glib, and adding a significant amount of documentation to the auto-generated binding files, which is a great improvement for code clarity and maintainability. However, I've identified two potential issues that need attention: a version number mismatch in configure.ac compared to the PR title, and a change in a function signature in the generated bindings that could lead to a panic. Addressing these points will ensure the release is consistent and the bindings are robust.

#[cfg_attr(docsrs, doc(cfg(feature = "v2016_5")))]
#[doc(alias = "ostree_blob_reader_read_blob")]
fn read_blob(&self, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<Option<glib::Bytes>, glib::Error> {
fn read_blob(&self, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<glib::Bytes, glib::Error> {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The return type of read_blob has been changed from Result<Option<glib::Bytes>, glib::Error> to Result<glib::Bytes, glib::Error>. The underlying C function ostree_blob_reader_read_blob can return NULL on success to indicate the end of the stream. The previous Rust binding correctly represented this with an Option<glib::Bytes>.

The new binding will likely cause a panic when from_glib_full(ret) is called with a NULL pointer from the C function, as from_glib_full on a non-nullable pointer type will panic on NULL.

Was the underlying C API or its nullability annotation in the GIR file changed intentionally? If the C function can still return NULL on success, this binding appears incorrect and may need to be reverted to return an Option.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well spotted...we very clearly have in the source

/**
 * ostree_blob_reader_read_blob
...
 * Returns: (nullable): A #GBytes blob, or %NULL if there are no more
 * 

so it definitely looks like something went wrong in the introspection -> Rust here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What build environment are you using? fedora-43, centos-10 etc?

#3549 doesn't change anything for me locally but I am very curious if it does for you

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fedora 42 with the latest gir.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did not change anything for me

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll re-do this inside a clean container and see if it's different.

cgwalters added a commit to cgwalters/ostree that referenced this pull request Nov 6, 2025
This is SUCH a giant trap. I am not totally sure why it's
working for me in a fedora-42 build env, but it seems like
it may have broken in a different build environment in
ostreedev#3548 (comment)

I used Sonnet to audit for similar instances beyond
`read_blob` and it found some, fix those too.

Signed-off-by: Colin Walters <walters@verbum.org>
cgwalters added a commit to cgwalters/ostree that referenced this pull request Nov 6, 2025
This is SUCH a giant trap. I am not totally sure why it's
working for me in a fedora-42 build env, but it seems like
it may have broken in a different build environment in
ostreedev#3548 (comment)

I used Sonnet to audit for similar instances beyond
`read_blob` and it found some, fix those too.

Signed-off-by: Colin Walters <walters@verbum.org>

/// Append the entire contents of the currently booted kernel commandline.
// rustdoc-stripper-ignore-next-stop
/// Appends the command line arguments in the file "/proc/cmdline"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool that the C docs are copied to Rust now

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think probably this happened because I did : $ make merge-lgpl-docs which https://github.com/ostreedev/ostree/blob/main/rust-bindings/README.md#documentation says I should not have done

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I just did: make gir-files && make gir


#[doc(alias = "ostree_bootconfig_parser_get_tries_done")]
#[doc(alias = "get_tries_done")]
pub fn tries_done(&self) -> u64 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also looks wrong to me that these APIs are going away?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/rust-bindings Relates to the Rust bindings for the C library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants