[Yum-devel] [PATCH] make sure we're not prepending a path which is already been prepended with the installroot fixes rh bugs: https://bugzilla.redhat.com/show_bug.cgi?id=577627 and https://bugzilla.redhat.com/show_bug.cgi?id=560078

Seth Vidal skvidal at fedoraproject.org
Fri Apr 30 16:18:25 UTC 2010


---
 yum/rpmsack.py |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index 83268cc..6a40939 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -171,7 +171,10 @@ class RPMDBPackageSack(PackageSackBase):
         if cachedir is None:
             cachedir = misc.getCacheDir()
         self.setCacheDir(cachedir)
-        self._persistdir = root +  '/' + persistdir
+        if not os.path.normpath(persistdir).startswith(self.root):
+            self._persistdir = root +  '/' + persistdir
+        else:
+            self._persistdir = persistdir
         self._have_cached_rpmdbv_data = None
         self._cached_conflicts_data = None
         # Store the result of what happens, if a transaction completes.
@@ -231,7 +234,10 @@ class RPMDBPackageSack(PackageSackBase):
     def setCacheDir(self, cachedir):
         """ Sets the internal cachedir value for the rpmdb, to be the
             "installed" directory from this parent. """
-        self._cachedir = self.root + '/' + cachedir + "/installed/"
+        if not os.path.normpath(cachedir).startswith(self.root):
+            self._cachedir = self.root + '/' + cachedir + "/installed/"
+        else:
+            self._cachedir = '/' + cachedir + "/installed/"
 
     def readOnlyTS(self):
         if not self.ts:
-- 
1.7.0.1



More information about the Yum-devel mailing list