From 0b7a1f31a7cd6d00e5d8ea82aae7ba9aade53f53 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 22 Aug 2019 13:15:04 +0000 Subject: [PATCH] importer: Add some error prefixing I was debugging a failure in cosa when running in unprivileged podman, with this patch the error is: `error: Importing package 'alternatives': Writing tmpfiles mtree: llistxattr: Is a directory` And that finally made it obvious to me that the problem is not using tmpfs for `/tmp` (well, this is a bug in fuse-overlayfs). Anyways, let's prefix errors some more on general principle. Closes: #1889 Approved by: rfairley --- src/libpriv/rpmostree-importer.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/libpriv/rpmostree-importer.c b/src/libpriv/rpmostree-importer.c index adcc7e9f..4d271eee 100644 --- a/src/libpriv/rpmostree-importer.c +++ b/src/libpriv/rpmostree-importer.c @@ -884,7 +884,7 @@ import_rpm_to_repo (RpmOstreeImporter *self, g_autoptr(OstreeMutableTree) mtree = ostree_mutable_tree_new (); if (!ostree_repo_import_archive_to_mtree (repo, &opts, self->archive, mtree, modifier, cancellable, error)) - return FALSE; + return glnx_prefix_error (error, "Importing archive"); /* check if any of the cbs set an error */ if (cb_error != NULL) @@ -921,7 +921,7 @@ import_rpm_to_repo (RpmOstreeImporter *self, if (!ostree_repo_write_dfd_to_mtree (repo, tmpdir.fd, ".", mtree, modifier, cancellable, error)) - return FALSE; + return glnx_prefix_error (error, "Writing tmpfiles mtree"); /* check if any of the cbs set an error */ if (cb_error != NULL) @@ -933,7 +933,7 @@ import_rpm_to_repo (RpmOstreeImporter *self, g_autoptr(GFile) root = NULL; if (!ostree_repo_write_mtree (repo, mtree, &root, cancellable, error)) - return FALSE; + return glnx_prefix_error (error, "Writing mtree"); g_autoptr(GVariant) metadata = NULL; if (!build_metadata_variant (self, &metadata, cancellable, error)) @@ -949,7 +949,7 @@ import_rpm_to_repo (RpmOstreeImporter *self, if (!ostree_repo_write_commit_with_time (repo, NULL, "", "", metadata, OSTREE_REPO_FILE (root), buildtime, out_csum, cancellable, error)) - return FALSE; + return glnx_prefix_error (error, "Writing commit"); return TRUE; } @@ -967,8 +967,7 @@ rpmostree_importer_run (RpmOstreeImporter *self, if (!import_rpm_to_repo (self, &csum, cancellable, error)) { g_autofree char *name = headerGetAsString (self->hdr, RPMTAG_NAME); - g_prefix_error (error, "Importing package %s: ", name); - return FALSE; + return glnx_prefix_error (error, "Importing package '%s'", name); } const char *branch = rpmostree_importer_get_ostree_branch (self);