Panu Matilainen 8a4615
commit 274dbf557d1cac90f7c278f9b6d6af05997d92df
Panu Matilainen 8a4615
Author: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen 8a4615
Date:   Tue Mar 20 16:32:54 2012 +0200
Panu Matilainen 8a4615
Panu Matilainen 8a4615
    Don't free up file info sets on transaction test-runs, take II
Panu Matilainen 8a4615
    
Panu Matilainen 8a4615
    - Despite commit cef18c94807af0935b7796c462aab8ed39f0f376, we'd still
Panu Matilainen 8a4615
      end up freeing the file info sets via rpmteClose() while going
Panu Matilainen 8a4615
      through the test-transaction packages. This together with commit
Panu Matilainen 8a4615
      06a2f1269b035a3a76464149834f2a5a8c4e89f2 caused install failures
Panu Matilainen 8a4615
      on packages which have %pretrans scriptlets, if a test-transaction
Panu Matilainen 8a4615
      was first performed on the same transaction set that gets used
Panu Matilainen 8a4615
      for the "real" transaction as well. How wonderfully obscure...
Panu Matilainen 8a4615
Panu Matilainen 8a4615
diff --git a/lib/rpmte.c b/lib/rpmte.c
Panu Matilainen 8a4615
index d1e4f87..65e1e76 100644
Panu Matilainen 8a4615
--- a/lib/rpmte.c
Panu Matilainen 8a4615
+++ b/lib/rpmte.c
Panu Matilainen 8a4615
@@ -917,7 +917,8 @@ int rpmteProcess(rpmte te, pkgGoal goal)
Panu Matilainen 8a4615
 {
Panu Matilainen 8a4615
     /* Only install/erase resets pkg file info */
Panu Matilainen 8a4615
     int scriptstage = (goal != PKG_INSTALL && goal != PKG_ERASE);
Panu Matilainen 8a4615
-    int reset_fi = (scriptstage == 0);
Panu Matilainen 8a4615
+    int test = (rpmtsFlags(te->ts) & RPMTRANS_FLAG_TEST);
Panu Matilainen 8a4615
+    int reset_fi = (scriptstage == 0 && test == 0);
Panu Matilainen 8a4615
     int failed = 1;
Panu Matilainen 8a4615
 
Panu Matilainen 8a4615
     /* Dont bother opening for elements without pre/posttrans scripts */