Skip to content

deploy: Use delete_if_present in can_soft_reboot#3532

Merged
cgwalters merged 1 commit intoostreedev:mainfrom
ckyrouac:softreboot-fix
Oct 15, 2025
Merged

deploy: Use delete_if_present in can_soft_reboot#3532
cgwalters merged 1 commit intoostreedev:mainfrom
ckyrouac:softreboot-fix

Conversation

@ckyrouac
Copy link
Contributor

@ckyrouac ckyrouac commented Oct 9, 2025

This avoids a dump when trying to delete the ostree= karg if it isn't present. This is an issue with bootc factory reset.

@openshift-ci
Copy link

openshift-ci bot commented Oct 9, 2025

Hi @ckyrouac. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

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 correctly fixes a crash in ostree_sysroot_deployment_can_soft_reboot by using ostree_kernel_args_delete_if_present. This prevents an assertion failure when the ostree= kernel argument is not present, which can happen in scenarios like a bootc factory reset.

The change is correct and addresses the issue. I've added one suggestion to further improve the robustness of this function by handling other potential failure cases from ostree_kernel_args_delete_if_present more gracefully instead of using g_assert().

Comment on lines +4392 to +4393
g_assert (ostree_kernel_args_delete_if_present (booted_kargs, "ostree", NULL));
g_assert (ostree_kernel_args_delete_if_present (target_kargs, "ostree", NULL));

Choose a reason for hiding this comment

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

medium

While ostree_kernel_args_delete_if_present() correctly handles the case where the ostree= argument is missing, it can still fail and return FALSE in other scenarios (e.g., if there are multiple ostree= arguments). Using g_assert() here would cause a crash in such cases.

It would be more robust to check the return value and gracefully return FALSE from ostree_sysroot_deployment_can_soft_reboot(), indicating that a soft reboot is not possible. This avoids a potential crash and makes the function more resilient to unexpected kernel argument configurations. You might also consider adding a g_debug() message to log the failure.

  if (!ostree_kernel_args_delete_if_present (booted_kargs, "ostree", NULL))
    return FALSE;
  if (!ostree_kernel_args_delete_if_present (target_kargs, "ostree", NULL))
    return FALSE;

@cgwalters cgwalters enabled auto-merge October 9, 2025 13:59
@champtar
Copy link
Collaborator

@ckyrouac can you rebase on main to pickup the latest CI fix ?

This avoids a dump when trying to delete the ostree= karg if it isn't
present. This is an issue with bootc factory reset.

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
auto-merge was automatically disabled October 14, 2025 12:58

Head branch was pushed to by a user without write access

@ckyrouac
Copy link
Contributor Author

rebased

@cgwalters cgwalters enabled auto-merge October 14, 2025 19:03
@cgwalters cgwalters disabled auto-merge October 14, 2025 19:04
@cgwalters
Copy link
Member

/ok-to-test

@champtar
Copy link
Collaborator

fcos-e2e is going to timeout again, but there is almost no logs
@cgwalters do you have more access ?

@cgwalters
Copy link
Member

the fcos-e2e mostly duplicates the jenkins run
/override ci/prow/fcos-e2e

@openshift-ci
Copy link

openshift-ci bot commented Oct 15, 2025

@cgwalters: Overrode contexts on behalf of cgwalters: ci/prow/fcos-e2e

Details

In response to this:

the fcos-e2e mostly duplicates the jenkins run
/override ci/prow/fcos-e2e

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@cgwalters cgwalters merged commit 742f00f into ostreedev:main Oct 15, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants