teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.9.0-fstate-verify.patch

Panu Matilainen 5a40a0
commit ee0ae58b442c5f79967a0d0580144b5c84e0c888
Panu Matilainen 5a40a0
Author: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen 5a40a0
Date:   Wed Mar 9 10:25:29 2011 +0200
Panu Matilainen 5a40a0
Panu Matilainen 5a40a0
    Verify some properties of replaced and wrong-colored files (RhBug:528383)
Panu Matilainen 5a40a0
    - We can't verify any properties of replaced files, but we can and
Panu Matilainen 5a40a0
      should still see if it exists at all.
Panu Matilainen 5a40a0
    - Files skipped due to wrong color are supposed to share some of
Panu Matilainen 5a40a0
      the attributes with the file that got actually installed, such
Panu Matilainen 5a40a0
      as permissions and whether it exists at all. Verify what we can
Panu Matilainen 5a40a0
      instead of silently ignoring.
Panu Matilainen 5a40a0
Panu Matilainen 5a40a0
diff --git a/lib/verify.c b/lib/verify.c
Panu Matilainen 5a40a0
index 3be357d..46210bc 100644
Panu Matilainen 5a40a0
--- a/lib/verify.c
Panu Matilainen 5a40a0
+++ b/lib/verify.c
Panu Matilainen 5a40a0
@@ -70,12 +70,22 @@ int rpmVerifyFile(const rpmts ts, const rpmfi fi,
Panu Matilainen 5a40a0
      */
Panu Matilainen 5a40a0
     switch (rpmfiFState(fi)) {
Panu Matilainen 5a40a0
     case RPMFILE_STATE_NETSHARED:
Panu Matilainen 5a40a0
-    case RPMFILE_STATE_REPLACED:
Panu Matilainen 5a40a0
     case RPMFILE_STATE_NOTINSTALLED:
Panu Matilainen 5a40a0
-    case RPMFILE_STATE_WRONGCOLOR:
Panu Matilainen 5a40a0
     case RPMFILE_STATE_MISSING:
Panu Matilainen 5a40a0
 	return 0;
Panu Matilainen 5a40a0
 	break;
Panu Matilainen 5a40a0
+    case RPMFILE_STATE_REPLACED:
Panu Matilainen 5a40a0
+	/* For replaced files we can only verify if it exists at all */
Panu Matilainen 5a40a0
+	flags = RPMVERIFY_LSTATFAIL;
Panu Matilainen 5a40a0
+	break;
Panu Matilainen 5a40a0
+    case RPMFILE_STATE_WRONGCOLOR:
Panu Matilainen 5a40a0
+	/*
Panu Matilainen 5a40a0
+	 * Files with wrong color are supposed to share some attributes
Panu Matilainen 5a40a0
+	 * with the actually installed file - verify what we can.
Panu Matilainen 5a40a0
+	 */
Panu Matilainen 5a40a0
+	flags &= ~(RPMVERIFY_FILEDIGEST | RPMVERIFY_FILESIZE |
Panu Matilainen 5a40a0
+		   RPMVERIFY_MTIME | RPMVERIFY_RDEV);
Panu Matilainen 5a40a0
+	break;
Panu Matilainen 5a40a0
     case RPMFILE_STATE_NORMAL:
Panu Matilainen 5a40a0
 	break;
Panu Matilainen 5a40a0
     }