Included is a patch which I believe correctly resolves the following
failure in the latest (yesterday or today) rpm-3.0.4-0.33 that is in
rawhide.

[root@narn rpm-3.0.4]# rpm -vv --rebuilddb
D: rebuilding database /var/lib/rpm into /var/lib/rpm
temporary database /var/lib/rpm already exists
D: creating directory: /var/lib/rpm
error creating directory /var/lib/rpm: File exists

--------------------------------------------------------------------------
| Troy Benjegerdes    |  [EMAIL PROTECTED]    |    [EMAIL PROTECTED]   |
|    Unix is user friendly... You just have to be friendly to it first.  |
| This message composed with 100% free software.    http://www.gnu.org   |
--------------------------------------------------------------------------
--- rpm-3.0.4/lib/rebuilddb.c   Mon Jan 17 12:07:02 2000
+++ rpm-3.0.4.new/lib/rebuilddb.c       Sun Jan 30 20:43:17 2000
@@ -30,19 +30,27 @@
     xfree(tfn);
 
     tfn = rpmGetPath("%{_rebuilddbpath}", NULL);
-    if (!(tfn && tfn[0] != '%' && strcmp(tfn, dbpath))) {
+    if (!(tfn && tfn[0] != '%')) {
+       newrootdbpath = xmalloc(strlen(dbpath));
+       strcpy (newrootdbpath, rootdbpath);
+    } else {
+       newrootdbpath = rpmGetPath(rootdir, tfn, NULL);
+    }
+    newdbpath = newrootdbpath + strlen(rootdir);
+    xfree(tfn);
+    
+    if (! strcmp(newdbpath, dbpath)) {
        char pidbuf[20];
        char *t;
        sprintf(pidbuf, "rebuilddb.%d", (int) getpid());
-       t = xmalloc(strlen(dbpath) + strlen(pidbuf) + 1);
-       stpcpy(stpcpy(t, dbpath), pidbuf);
-       if (tfn) xfree(tfn);
-       tfn = t;
+       t = xmalloc(strlen(rootdbpath) + strlen(pidbuf) + 1);
+       stpcpy(stpcpy(t, rootdbpath), pidbuf);
+       if (newrootdbpath) xfree(newrootdbpath);
+       newrootdbpath = t;
+       newdbpath = newrootdbpath + strlen(rootdir);
        nocleanup = 0;
     }
-    newrootdbpath = rpmGetPath(rootdir, tfn, NULL);
-    newdbpath = newrootdbpath + strlen(rootdir);
-    xfree(tfn);
+    
 
     rpmMessage(RPMMESS_DEBUG, _("rebuilding database %s into %s\n"),
        rootdbpath, newrootdbpath);

Reply via email to