Skip to content

Conversation

@giuseppe
Copy link
Member

@giuseppe giuseppe commented Feb 9, 2026

Closes: #1994

@gemini-code-assist
Copy link

Summary of Changes

Hello @giuseppe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the error reporting mechanism within the libcrun library by ensuring that the errno global variable is only captured and reported when a system call truly indicates a failure. Previously, errno might have been used in situations that were not actual error conditions, leading to potentially misleading error messages. The changes improve the precision of error diagnostics by aligning errno usage with actual system call failures, addressing issue #1994.

Highlights

  • Error Reporting Refinement: Modified crun_make_error calls to ensure errno is only used when a system call explicitly indicates an error (return value less than 0).
  • Preventing Misleading Errors: This change prevents errno from being reported in non-error scenarios, such as when read returns 0 (end-of-file) or a partial read, which do not set errno.
  • Improved Error Context: Enhances the accuracy of error messages by providing a relevant errno value only when an actual system call failure occurs.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/libcrun/linux.c
    • Updated expect_success_from_sync_socket to pass errno to crun_make_error only if the read call returns a negative value, otherwise 0.
    • Updated libcrun_run_linux_container to pass errno to crun_make_error only if the read call returns a negative value, otherwise 0.
Activity
  • The pull request addresses and closes issue linux: errno used after success #1994, indicating a fix for a reported problem.
  • No other review comments or discussions have been provided in the context.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@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 addresses a bug where errno was being used to create an error message even when the read() call did not fail but simply returned fewer bytes than requested. The changes correctly ensure that errno is only used when read() returns a negative value, indicating a true error. This prevents potentially misleading error messages caused by stale errno values. The fix is applied in two similar locations, expect_success_from_sync_socket and libcrun_run_linux_container. The changes are correct and effectively resolve the issue.

@packit-as-a-service
Copy link

Ephemeral COPR build failed. @containers/packit-build please check.

@packit-as-a-service
Copy link

TMT tests failed. @containers/packit-build please check.

@eriksjolund
Copy link
Contributor

Does this one need a similar fix?

crun/src/libcrun/container.c

Lines 4177 to 4180 in d0c1224

resources = make_runtime_spec_schema_config_linux_resources (tree, &ctx, &parser_err);
if (UNLIKELY (resources == NULL))
{
ret = crun_make_error (err, errno, "cannot parse resources: %s", parser_err);

@packit-as-a-service
Copy link

Ephemeral COPR build failed. @containers/packit-build please check.

@packit-as-a-service
Copy link

TMT tests failed. @containers/packit-build please check.

Closes: containers#1994

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: containers#1991

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: containers#1988

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: containers#1990

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@eriksjolund
Copy link
Contributor

LGTM

Side note: you can get more issue-PR links by editing #2006 (comment)
and adding more Closes: lines

@kolyshkin kolyshkin merged commit 0d7ed80 into containers:main Feb 10, 2026
37 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linux: errno used after success

3 participants