Colin Walters cc5874b
From 2ccf36ae3ded1da48dd659d46a4ccabdee0e0775 Mon Sep 17 00:00:00 2001
Colin Walters cc5874b
From: Colin Walters <walters@verbum.org>
Colin Walters cc5874b
Date: Fri, 4 Jan 2019 15:44:56 +0000
Colin Walters cc5874b
Subject: [PATCH] sysroot: Remove immutable bit from /etc/sysconfig/nfs
Colin Walters cc5874b
Colin Walters cc5874b
Work around for https://src.fedoraproject.org/rpms/nfs-utils/pull-request/7
Colin Walters cc5874b
Currently Fedora-only.
Colin Walters cc5874b
---
Colin Walters cc5874b
 src/libostree/ostree-sysroot-cleanup.c | 16 ++++++++++++++++
Colin Walters cc5874b
 1 file changed, 16 insertions(+)
Colin Walters cc5874b
Colin Walters cc5874b
diff --git a/src/libostree/ostree-sysroot-cleanup.c b/src/libostree/ostree-sysroot-cleanup.c
Colin Walters cc5874b
index 7a352e6b..b8ec9970 100644
Colin Walters cc5874b
--- a/src/libostree/ostree-sysroot-cleanup.c
Colin Walters cc5874b
+++ b/src/libostree/ostree-sysroot-cleanup.c
Colin Walters cc5874b
@@ -271,6 +271,22 @@ _ostree_sysroot_rmrf_deployment (OstreeSysroot *self,
Colin Walters cc5874b
     return FALSE;
Colin Walters cc5874b
   if (!glnx_shutil_rm_rf_at (self->sysroot_fd, origin_relpath, cancellable, error))
Colin Walters cc5874b
     return FALSE;
Colin Walters cc5874b
+
Colin Walters cc5874b
+  /* Special hack for Fedora's NFS package which is abusing the immutable bit
Colin Walters cc5874b
+   * https://src.fedoraproject.org/rpms/nfs-utils/pull-request/7
Colin Walters cc5874b
+   */
Colin Walters cc5874b
+  {
Colin Walters cc5874b
+    glnx_autofd int nfs_sysconfig_fd = -1;
Colin Walters cc5874b
+    if (!ot_openat_ignore_enoent (deployment_fd, "etc/sysconfig/nfs", &nfs_sysconfig_fd, error))
Colin Walters cc5874b
+      return FALSE;
Colin Walters cc5874b
+    if (nfs_sysconfig_fd != -1)
Colin Walters cc5874b
+      {
Colin Walters cc5874b
+        if (!_ostree_linuxfs_fd_alter_immutable_flag (nfs_sysconfig_fd, FALSE,
Colin Walters cc5874b
+                                                      cancellable, error))
Colin Walters cc5874b
+          return FALSE;
Colin Walters cc5874b
+      }
Colin Walters cc5874b
+  }
Colin Walters cc5874b
+
Colin Walters cc5874b
   if (!glnx_shutil_rm_rf_at (self->sysroot_fd, deployment_path, cancellable, error))
Colin Walters cc5874b
     return FALSE;
Colin Walters cc5874b
 
Colin Walters cc5874b
-- 
Colin Walters cc5874b
2.19.2
Colin Walters cc5874b