teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.11-beta-skip-ghost.patch

Panu Matilainen 8020bf
commit a712252392eca75443ca45c10a72873cabec7963
Panu Matilainen 8020bf
Author: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen 8020bf
Date:   Mon Jan 28 12:50:39 2013 +0200
Panu Matilainen 8020bf
Panu Matilainen 8020bf
    Be more careful about skipping shared file/directory creation
Panu Matilainen 8020bf
    
Panu Matilainen 8020bf
    - Only skip shared file/dir creation if its actually being created
Panu Matilainen 8020bf
      by another package. Previously we could've decided to skip an entry
Panu Matilainen 8020bf
      where the other file was also being skipped for some other reason.
Panu Matilainen 8020bf
    - Ensure %ghost entries always have FA_SKIP on install, previously
Panu Matilainen 8020bf
      they often were FA_CREATE which makes no sense for %ghost. We dont
Panu Matilainen 8020bf
      encounter %ghosts at all during install in the FSM as they dont
Panu Matilainen 8020bf
      exist in the payload, but the file disposition calculations need
Panu Matilainen 8020bf
      to take them into account now that we're avoiding redundant creates.
Panu Matilainen 8020bf
    - Fixes a regression from commit f7f5f88f9f3d6587e747b034ccb64a3f00ff4e1e
Panu Matilainen 8020bf
      which unearthed the %ghost FA_CREATE issue, reported here:
Panu Matilainen 8020bf
      http://lists.fedoraproject.org/pipermail/buildsys/2013-January/004047.html
Panu Matilainen 8020bf
Panu Matilainen 8020bf
diff --git a/lib/transaction.c b/lib/transaction.c
Panu Matilainen 8020bf
index 6e9e025..397f23d 100644
Panu Matilainen 8020bf
--- a/lib/transaction.c
Panu Matilainen 8020bf
+++ b/lib/transaction.c
Panu Matilainen 8020bf
@@ -572,7 +572,8 @@ assert(otherFi != NULL);
Panu Matilainen 8020bf
 		}
Panu Matilainen 8020bf
 	    } else {
Panu Matilainen 8020bf
 		/* Skip create on all but the first instance of a shared file */
Panu Matilainen 8020bf
-		if (rpmfsGetAction(otherFs, otherFileNum) != FA_UNKNOWN)
Panu Matilainen 8020bf
+		rpmFileAction oaction = rpmfsGetAction(otherFs, otherFileNum);
Panu Matilainen 8020bf
+		if (oaction != FA_UNKNOWN && !XFA_SKIPPING(oaction))
Panu Matilainen 8020bf
 		    rpmfsSetAction(fs, i, FA_SKIP);
Panu Matilainen 8020bf
 	    }
Panu Matilainen 8020bf
 
Panu Matilainen 8020bf
@@ -760,6 +761,17 @@ static void skipInstallFiles(const rpmts ts, rpmte p)
Panu Matilainen 8020bf
 	ix = rpmfiDX(fi);
Panu Matilainen 8020bf
 	drc[ix]++;
Panu Matilainen 8020bf
 
Panu Matilainen 8020bf
+	/*
Panu Matilainen 8020bf
+	 * Always skip %ghosts on install.
Panu Matilainen 8020bf
+	 * XXX: Should we skip directory creation if there are only
Panu Matilainen 8020bf
+	 * %ghosts in it? Traditionally we create the (empty) directory, so
Panu Matilainen 8020bf
+	 * preserving that behavior for now at least: leave the refcount alone.
Panu Matilainen 8020bf
+	 */
Panu Matilainen 8020bf
+	if (rpmfiFFlags(fi) & RPMFILE_GHOST) {
Panu Matilainen 8020bf
+	    rpmfsSetAction(fs, i, FA_SKIP);
Panu Matilainen 8020bf
+	    continue;
Panu Matilainen 8020bf
+	}
Panu Matilainen 8020bf
+
Panu Matilainen 8020bf
 	/* Don't bother with skipped files */
Panu Matilainen 8020bf
 	if (XFA_SKIPPING(rpmfsGetAction(fs, i))) {
Panu Matilainen 8020bf
 	    drc[ix]--; dff[ix] = 1;