Blame SOURCES/0001-treecompose-Add-various-g_prefix_error.patch

c034ea
From 9f671efc60e8cb84ad2c73718c686692c92585fa Mon Sep 17 00:00:00 2001
c034ea
From: Colin Walters <walters@verbum.org>
c034ea
Date: Thu, 15 Jun 2017 13:29:06 -0400
c034ea
Subject: [PATCH 1/4] treecompose: Add various g_prefix_error()
c034ea
c034ea
To help debug a problem which turned out to be in SELinux postprocessing for
c034ea
RHELAH.
c034ea
c034ea
Closes: #830
c034ea
Approved by: jlebon
c034ea
---
c034ea
 src/app/rpmostree-compose-builtin-tree.c | 20 ++++++++++++++++----
c034ea
 src/libpriv/rpmostree-postprocess.c      | 28 +++++++++++++---------------
c034ea
 2 files changed, 29 insertions(+), 19 deletions(-)
c034ea
c034ea
diff --git a/src/libpriv/rpmostree-postprocess.c b/src/libpriv/rpmostree-postprocess.c
c034ea
index 46fb636..db24c70 100644
c034ea
--- a/src/libpriv/rpmostree-postprocess.c
c034ea
+++ b/src/libpriv/rpmostree-postprocess.c
c034ea
@@ -654,10 +654,7 @@ postprocess_selinux_policy_store_location (int rootfs_dfd,
c034ea
 
c034ea
       name = dent->d_name;
c034ea
       if (renameat (dfd_iter.fd, name, etc_selinux_dfd, name) != 0)
c034ea
-        {
c034ea
-          glnx_set_error_from_errno (error);
c034ea
-          return FALSE;
c034ea
-        }
c034ea
+        return glnx_throw_errno_prefix (error, "rename(%s)", name);
c034ea
     }
c034ea
 
c034ea
   return TRUE;
c034ea
@@ -794,12 +791,18 @@ create_rootfs_from_yumroot_content (int            target_root_dfd,
c034ea
 
c034ea
   /* NSS configuration to look at the new files */
c034ea
   if (!replace_nsswitch (src_rootfs_fd, cancellable, error))
c034ea
-    goto out;
c034ea
+    {
c034ea
+      g_prefix_error (error, "nsswitch replacement: ");
c034ea
+      goto out;
c034ea
+    }
c034ea
 
c034ea
   if (selinux)
c034ea
     {
c034ea
       if (!postprocess_selinux_policy_store_location (src_rootfs_fd, cancellable, error))
c034ea
-        goto out;
c034ea
+        {
c034ea
+          g_prefix_error (error, "SELinux postprocess: ");
c034ea
+          goto out;
c034ea
+        }
c034ea
     }
c034ea
 
c034ea
   /* We take /usr from the yum content */
c034ea
@@ -1615,17 +1618,15 @@ rpmostree_prepare_rootfs_for_commit (int            workdir_dfd,
c034ea
   glnx_fd_close int target_root_dfd = -1;
c034ea
 
c034ea
   if (mkdirat (workdir_dfd, temp_new_root, 0755) < 0)
c034ea
-    {
c034ea
-      glnx_set_error_from_errno (error);
c034ea
-      return FALSE;
c034ea
-    }
c034ea
+    return glnx_throw_errno_prefix (error, "creating %s", temp_new_root);
c034ea
+
c034ea
   if (!glnx_opendirat (workdir_dfd, temp_new_root, TRUE,
c034ea
                        &target_root_dfd, error))
c034ea
     return FALSE;
c034ea
 
c034ea
   if (!create_rootfs_from_yumroot_content (target_root_dfd, *inout_rootfs_fd, treefile,
c034ea
                                            cancellable, error))
c034ea
-    return FALSE;
c034ea
+    return glnx_prefix_error (error, "Finalizing rootfs");
c034ea
 
c034ea
   (void) close (*inout_rootfs_fd);
c034ea
 
c034ea
@@ -1634,10 +1635,7 @@ rpmostree_prepare_rootfs_for_commit (int            workdir_dfd,
c034ea
 
c034ea
   if (TEMP_FAILURE_RETRY (renameat (workdir_dfd, temp_new_root,
c034ea
                                     workdir_dfd, rootfs_name)) != 0)
c034ea
-    {
c034ea
-      glnx_set_error_from_errno (error);
c034ea
-      return FALSE;
c034ea
-    }
c034ea
+    return glnx_throw_errno_prefix (error, "rename(%s, %s)", temp_new_root, rootfs_name);
c034ea
 
c034ea
   *inout_rootfs_fd = target_root_dfd;
c034ea
   target_root_dfd = -1;  /* Transfer ownership */
c034ea
-- 
c034ea
2.13.0
c034ea