[Rpm-maint] [Suse patch] Make rebuilddb work with the --root option.

Panu Matilainen pmatilai at redhat.com
Tue May 22 07:48:06 UTC 2007


Without the patch, --rebuilddb --root <root> fails with a somewhat 
entertaining error message "temporary database <root> already exists".

Already applied...

 	- Panu -

---

Make rebuilddb work with the --root option. [#65993]

--- ./rpmdb/rpmdb.c.orig	2005-02-16 03:18:19.000000000 +0000
+++ ./rpmdb/rpmdb.c	2006-02-21 20:37:44.000000000 +0000
@@ -3771,7 +3887,7 @@ int rpmdbRebuild(const char * prefix, rp
      }
      dbpath = rootdbpath = rpmGetPath(prefix, tfn, NULL);
      if (!(prefix[0] == '/' && prefix[1] == '\0'))
-	dbpath += strlen(prefix);
+	dbpath += strlen(prefix) - 1;
      tfn = _free(tfn);

      /*@-nullpass@*/
@@ -3794,7 +3910,7 @@ int rpmdbRebuild(const char * prefix, rp
      }
      newdbpath = newrootdbpath = rpmGetPath(prefix, tfn, NULL);
      if (!(prefix[0] == '/' && prefix[1] == '\0'))
-	newdbpath += strlen(prefix);
+	newdbpath += strlen(prefix) - 1;
      tfn = _free(tfn);

      rpmMessage(RPMMESS_DEBUG, _("rebuilding database %s into %s\n"),



More information about the Rpm-maint mailing list