teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone
Blob Blame History Raw
commit ee0ae58b442c5f79967a0d0580144b5c84e0c888
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Wed Mar 9 10:25:29 2011 +0200

    Verify some properties of replaced and wrong-colored files (RhBug:528383)
    - 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.

diff --git a/lib/verify.c b/lib/verify.c
index 3be357d..46210bc 100644
--- a/lib/verify.c
+++ b/lib/verify.c
@@ -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;
     }