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

composefs: Add more error prefixing #3074

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/libostree/ostree-repo-composefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ ostree_composefs_target_write (OstreeComposefsTarget *target, int fd, guchar **o
GCancellable *cancellable, GError **error)
{
#ifdef HAVE_COMPOSEFS
GLNX_AUTO_PREFIX_ERROR ("Writing composefs", error);
g_autoptr (GOutputStream) tmp_out = NULL;
g_autoptr (GOutputStream) out = NULL;
struct lcfs_node_s *root;
Expand All @@ -235,7 +236,7 @@ ostree_composefs_target_write (OstreeComposefsTarget *target, int fd, guchar **o
}

if (lcfs_write_to (root, &options) != 0)
return glnx_throw_errno (error);
return glnx_throw_errno_prefix (error, "lcfs_write_to");

if (out_fsverity_digest)
*out_fsverity_digest = g_steal_pointer (&fsverity_digest);
Expand Down Expand Up @@ -402,7 +403,7 @@ checkout_composefs_recurse (OstreeRepo *self, const char *dirtree_checksum,
if (lcfs_node_add_child (parent, directory, name) != 0)
{
lcfs_node_unref (directory);
return glnx_throw_errno (error);
return glnx_throw_errno_prefix (error, "lcfs_node_add_child");
}
}

Expand All @@ -428,7 +429,7 @@ checkout_composefs_recurse (OstreeRepo *self, const char *dirtree_checksum,

if (!checkout_one_composefs_file_at (self, tmp_checksum, directory, fname, cancellable,
error))
return FALSE;
return glnx_prefix_error (error, "Processing %s", tmp_checksum);
}
contents_csum_v = NULL; /* iter_loop freed it */
}
Expand Down Expand Up @@ -494,6 +495,7 @@ checkout_composefs_tree (OstreeRepo *self, OstreeComposefsTarget *target, Ostree
static struct lcfs_node_s *
ensure_lcfs_dir (struct lcfs_node_s *parent, const char *name, GError **error)
{
GLNX_AUTO_PREFIX_ERROR ("Ensuring dir", error);
struct lcfs_node_s *node;

node = lcfs_node_lookup_child (parent, name);
Expand All @@ -505,7 +507,7 @@ ensure_lcfs_dir (struct lcfs_node_s *parent, const char *name, GError **error)
if (lcfs_node_add_child (parent, node, name) != 0)
{
lcfs_node_unref (node);
glnx_throw_errno (error);
glnx_throw_errno_prefix (error, "lcfs_node_add_child");
return NULL;
}

Expand Down Expand Up @@ -537,6 +539,7 @@ ostree_repo_checkout_composefs (OstreeRepo *self, OstreeComposefsTarget *target,
OstreeRepoFile *source, GCancellable *cancellable, GError **error)
{
#ifdef HAVE_COMPOSEFS
GLNX_AUTO_PREFIX_ERROR ("Checking out composefs", error);
char *root_dirs[] = { "usr", "etc", "boot", "var", "sysroot" };
int i;
struct lcfs_node_s *root, *dir;
Expand All @@ -545,7 +548,7 @@ ostree_repo_checkout_composefs (OstreeRepo *self, OstreeComposefsTarget *target,
= g_file_query_info (G_FILE (source), OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, cancellable, error);
if (!target_info)
return FALSE;
return glnx_prefix_error (error, "Failed to query");

if (!checkout_composefs_tree (self, target, source, target_info, cancellable, error))
return FALSE;
Expand Down
Loading