Verify some properties of replaced and wrong-colored files (RhBug:528383)
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 9 Mar 2011 08:25:29 +0000 (10:25 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 9 Mar 2011 08:30:51 +0000 (10:30 +0200)
- We can't verify any properties of replaced files, but we can and
  should still see if it exists at all.
- Files skipped due to wrong color are supposed to share some of
  the attributes with the file that got actually installed, such
  as permissions and whether it exists at all. Verify what we can
  instead of silently ignoring.

lib/verify.c

index 3be357d..46210bc 100644 (file)
@@ -70,12 +70,22 @@ int rpmVerifyFile(const rpmts ts, const rpmfi fi,
      */
     switch (rpmfiFState(fi)) {
     case RPMFILE_STATE_NETSHARED:
-    case RPMFILE_STATE_REPLACED:
     case RPMFILE_STATE_NOTINSTALLED:
-    case RPMFILE_STATE_WRONGCOLOR:
     case RPMFILE_STATE_MISSING:
        return 0;
        break;
+    case RPMFILE_STATE_REPLACED:
+       /* For replaced files we can only verify if it exists at all */
+       flags = RPMVERIFY_LSTATFAIL;
+       break;
+    case RPMFILE_STATE_WRONGCOLOR:
+       /*
+        * Files with wrong color are supposed to share some attributes
+        * with the actually installed file - verify what we can.
+        */
+       flags &= ~(RPMVERIFY_FILEDIGEST | RPMVERIFY_FILESIZE |
+                  RPMVERIFY_MTIME | RPMVERIFY_RDEV);
+       break;
     case RPMFILE_STATE_NORMAL:
        break;
     }