Whether this is 100% correct fix or not, but it seems to fix real problems. Eg:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=173285
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=106057
(the related Suse bugs are private unfortunately)

AFAICT it doesn't have serious side-effects either, so I'm considering on applying - let me know if you disagree.

        - Panu -

---

Open all rpm databases before doing chroot. [#43266], [#44584]
rh#103852

Already in rpm-4.4.7, configurable with a macro (for whatever reason).

--- ./lib/transaction.c.orig    2005-12-14 21:15:40.000000000 +0000
+++ ./lib/transaction.c 2006-01-27 20:05:40.000000000 +0000
@@ -1677,8 +1859,10 @@ rpmMessage(RPMMESS_DEBUG, _("computing %
        const char * rootDir = rpmtsRootDir(ts);
        xx = chdir("/");
        /[EMAIL PROTECTED] -noeffect @*/
-       if (rootDir != NULL && strcmp(rootDir, "/") && *rootDir == '/')
+       if (rootDir != NULL && strcmp(rootDir, "/") && *rootDir == '/') {
+           rpmdbOpenAllButTemporary(ts->rdb);
            xx = chroot(rootDir);
+       }
        /[EMAIL PROTECTED] =noeffect @*/
        (void) rpmtsSetChrootDone(ts, 1);
     }
--- ./rpmdb/rpmdb.c.orig        2005-02-16 03:18:19.000000000 +0000
+++ ./rpmdb/rpmdb.c     2006-02-21 20:37:44.000000000 +0000
@@ -811,6 +811,33 @@ int rpmdbOpenAll(rpmdb db)
     return rc;
 }

+int rpmdbOpenAllButTemporary(rpmdb db)
+{
+    int dbix;
+    int rc = 0;
+
+    if (db == NULL) return -2;
+
+    if (dbiTags != NULL)
+    for (dbix = 0; dbix < dbiTagsMax; dbix++) {
+       if (db->_dbi[dbix] != NULL)
+           continue;
+       /* Filter out temporary databases */
+       switch ((dbiTags[dbix])) {
+       case RPMDBI_AVAILABLE:
+       case RPMDBI_ADDED:
+       case RPMDBI_REMOVED:
+       case RPMDBI_DEPENDS:
+           continue;
+           /[EMAIL PROTECTED]@*/ /[EMAIL PROTECTED]@*/ break;
+       default:
+           /[EMAIL PROTECTED]@*/ break;
+       }
+       (void) dbiOpen(db, dbiTags[dbix], db->db_flags);
+    }
+    return rc;
+}
+
 int rpmdbCloseDBI(rpmdb db, int rpmtag)
 {
     int dbix;
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
https://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to