56 lines
1.5 KiB
Diff
56 lines
1.5 KiB
Diff
|
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("/");
|
||
|
/*@-superuser -noeffect @*/
|
||
|
- if (rootDir != NULL && strcmp(rootDir, "/") && *rootDir == '/')
|
||
|
+ if (rootDir != NULL && strcmp(rootDir, "/") && *rootDir == '/') {
|
||
|
+ rpmdbOpenAllButTemporary(ts->rdb);
|
||
|
xx = chroot(rootDir);
|
||
|
+ }
|
||
|
/*@=superuser =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;
|
||
|
+ /*@notreached@*/ /*@switchbreak@*/ break;
|
||
|
+ default:
|
||
|
+ /*@switchbreak@*/ break;
|
||
|
+ }
|
||
|
+ (void) dbiOpen(db, dbiTags[dbix], db->db_flags);
|
||
|
+ }
|
||
|
+ return rc;
|
||
|
+}
|
||
|
+
|
||
|
int rpmdbCloseDBI(rpmdb db, int rpmtag)
|
||
|
{
|
||
|
int dbix;
|