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