Blob Blame History Raw
From eae3a40f3b426525a805328c7552c292f510a780 Mon Sep 17 00:00:00 2001
From: Jonathan Lebon <jonathan@jlebon.com>
Date: Tue, 7 Aug 2018 15:59:09 -0400
Subject: [PATCH] libpriv/core: Always call rpmtsSetRootDir()

Call `rpmtsSetRootDir()` even in the `JUSTDB` run. This brings us in
line with libdnf and the rpm CLI itself, which both unconditionally call
`rpmtsSetRootDir()` regardless of whether we're targeting the system
root or a subdir.

This doesn't cause a `chroot()` to happen since librpm only does this
if the target root dir is not `/`.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1613517

Closes: #1492
Approved by: cgwalters
---
 src/libpriv/rpmostree-core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/libpriv/rpmostree-core.c b/src/libpriv/rpmostree-core.c
index d38303fa..87e3d07b 100644
--- a/src/libpriv/rpmostree-core.c
+++ b/src/libpriv/rpmostree-core.c
@@ -4009,6 +4009,8 @@ rpmostree_context_assemble (RpmOstreeContext      *self,
   }
 
   g_auto(rpmts) rpmdb_ts = rpmtsCreate ();
+  /* Always call rpmtsSetRootDir() here so rpmtsRootDir() isn't NULL -- see rhbz#1613517 */
+  rpmtsSetRootDir (rpmdb_ts, "/");
   rpmtsSetVSFlags (rpmdb_ts, _RPMVSF_NOSIGNATURES | _RPMVSF_NODIGESTS);
   /* https://bugzilla.redhat.com/show_bug.cgi?id=1607223
    * Newer librpm defaults to doing a full payload checksum, which we can't
-- 
2.17.1