Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sysroot: Reword comment and use gboolean over bool, error handling #3195

Merged
merged 1 commit into from
Feb 23, 2024

Conversation

ericcurtin
Copy link
Collaborator

@ericcurtin ericcurtin commented Feb 22, 2024

Be more explicit in the comment, and use gboolean over bool. Less header
inclusions when we use gboolean. Although bool is used in some places.
Write a separate _ostree_sysroot_parse_bootlink_aboot function for
aboot. Make is_aboot optional. Handle invalid androidboot karg and no
ostree and androidboot kargs differently.

Co-authored-by: Jonathan Lebon [email protected]
Signed-off-by: Eric Curtin [email protected]

@ericcurtin ericcurtin self-assigned this Feb 22, 2024
@github-actions github-actions bot added the area/prepare-root Issue relates to ostree-prepare-root label Feb 22, 2024
@ericcurtin ericcurtin force-pushed the pr3192_comments branch 3 times, most recently from 24a907e to 2aebb28 Compare February 22, 2024 19:08
@ericcurtin ericcurtin force-pushed the pr3192_comments branch 4 times, most recently from b755a5c to df3bb0e Compare February 22, 2024 19:24
* the `ostree=` karg for `ostree-prepare-root.service` specifically, but
* otherwise that karg doesn't exist on the real command-line. */
if (!otcore_get_ostree_target (cmdline, &is_aboot, &ostree_target,
&otcore_get_ostree_target_error))
return TRUE;
errx (EXIT_FAILURE, "Failed to determine ostree target: %s",
Copy link
Member

Choose a reason for hiding this comment

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

error))
if (is_aboot)
{
if (!_ostree_sysroot_parse_bootlink_aboot (ostree_target, &stateroot, error))
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think having it be separate is cleaner indeed. 👍

@ericcurtin ericcurtin force-pushed the pr3192_comments branch 5 times, most recently from e66af4e to 8b20427 Compare February 23, 2024 10:30
@ericcurtin
Copy link
Collaborator Author

This is ready @jlebon @jmarrero

@ericcurtin ericcurtin changed the title sysroot: Reword comment and use gboolean over bool sysroot: Reword comment and use gboolean over bool, error handling Feb 23, 2024
Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

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

Some last error-handling-related bits, otherwise LGTM.

/* This could happen in CoreOS live environments, where we hackily mock
gboolean is_aboot = false;
if (!otcore_get_ostree_target (cmdline, &is_aboot, &ostree_target, error))
errx (EXIT_FAILURE, "Failed to determine ostree target: %s", (*error)->message);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
errx (EXIT_FAILURE, "Failed to determine ostree target: %s", (*error)->message);
return glnx_prefix_error (error, "Invalid ostree target");

static GRegex *regex;
g_autofree char *symlink_val = glnx_readlinkat_malloc (-1, bootlink, NULL, error);
if (!symlink_val)
return glnx_throw (error, "Failed to read '%s' symlink", bootlink);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return glnx_throw (error, "Failed to read '%s' symlink", bootlink);
return glnx_prefix_error (error, "Failed to read '%s' symlink", bootlink);

Be more explicit in the comment, and use gboolean over bool. Less header
inclusions when we use gboolean. Although bool is used in some places.
Write a separate _ostree_sysroot_parse_bootlink_aboot function for
aboot. Make is_aboot optional. Handle invalid androidboot karg and no
ostree and androidboot kargs differently.

Co-authored-by: Jonathan Lebon <[email protected]>
Signed-off-by: Eric Curtin <[email protected]>
@ericcurtin
Copy link
Collaborator Author

Re-pushed with changes

@jlebon jlebon merged commit 26e220e into ostreedev:main Feb 23, 2024
24 checks passed
@ericcurtin ericcurtin deleted the pr3192_comments branch February 23, 2024 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/prepare-root Issue relates to ostree-prepare-root
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants