From 57cf8d9bc0448abcb7f395d2a175be6b6373a569 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Thu, 15 Jun 2017 13:35:36 -0400 Subject: [PATCH 4/4] postprocess: always nuke /var/run If `/var/run` exists, it will be a dir, so we'll fail the `unlinkat` with `EISDIR`. Let's just explicitly nuke it. Closes: #831 Approved by: cgwalters --- src/libpriv/rpmostree-postprocess.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libpriv/rpmostree-postprocess.c b/src/libpriv/rpmostree-postprocess.c index 8252f41..094e7b8 100644 --- a/src/libpriv/rpmostree-postprocess.c +++ b/src/libpriv/rpmostree-postprocess.c @@ -329,7 +329,6 @@ convert_var_to_tmpfiles_d (int src_rootfs_dfd, * runtime. (And really both in CentOS and Fedora) */ const char *known_state_files[] = { - "run", /* We never want to traverse into /run when making tmpfiles since it's a tmpfs */ "lib/systemd/random-seed", /* https://bugzilla.redhat.com/show_bug.cgi?id=789407 */ "lib/systemd/catalog/database", "lib/plymouth/boot-duration", @@ -340,6 +339,10 @@ convert_var_to_tmpfiles_d (int src_rootfs_dfd, if (!glnx_opendirat (src_rootfs_dfd, "var", TRUE, &var_dfd, error)) return FALSE; + /* We never want to traverse into /run when making tmpfiles since it's a tmpfs */ + if (!glnx_shutil_rm_rf_at (var_dfd, "run", cancellable, error)) + return FALSE; + /* Here, delete some files ahead of time to avoid emitting warnings * for things that are known to be harmless. */ @@ -349,7 +352,7 @@ convert_var_to_tmpfiles_d (int src_rootfs_dfd, if (unlinkat (var_dfd, path, 0) < 0) { if (errno != ENOENT) - return glnx_throw_errno_prefix (error, "unlinkat"); + return glnx_throw_errno_prefix (error, "unlinkat(%s)", path); } } -- 2.13.0