Panu Matilainen 240842
commit df4eed5debcdc9209e1f5e66d17230861a55a7fc
Panu Matilainen 240842
Author: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen 240842
Date:   Wed Oct 10 10:37:34 2012 +0300
Panu Matilainen 240842
Panu Matilainen 240842
    Filter out skipped files on hardlink checking (RhBug:864622)
Panu Matilainen 240842
    
Panu Matilainen 240842
    - Legitimately skipped files (links) must not cause install-errors.
Panu Matilainen 240842
      This has always been broken, but the errors were completely ignored
Panu Matilainen 240842
      on install prior to rpm 4.10.
Panu Matilainen 240842
    - Backported from commit eeea54c76b130da3769ae10f7db2c2fcfb5c57be
Panu Matilainen 240842
Panu Matilainen 240842
diff --git a/lib/fsm.c b/lib/fsm.c
Panu Matilainen 240842
index e4ffcaf..4840708 100644
Panu Matilainen 240842
--- a/lib/fsm.c
Panu Matilainen 240842
+++ b/lib/fsm.c
Panu Matilainen 240842
@@ -1964,12 +1964,14 @@ static int fsmStage(FSM_t fsm, fileStage stage)
Panu Matilainen 240842
 	    fsm->links = fsm->li->next;
Panu Matilainen 240842
 	    fsm->li->next = NULL;
Panu Matilainen 240842
 	    if (fsm->goal == FSM_PKGINSTALL && fsm->li->linksLeft) {
Panu Matilainen 240842
+		rpmfs fs = rpmteGetFileStates(fsmGetTe(fsm));
Panu Matilainen 240842
 		for (nlink_t i = 0 ; i < fsm->li->linksLeft; i++) {
Panu Matilainen 240842
-		    if (fsm->li->filex[i] < 0)
Panu Matilainen 240842
+		    int ix = fsm->li->filex[i];
Panu Matilainen 240842
+		    if (ix < 0 || XFA_SKIPPING(rpmfsGetAction(fs, ix)))
Panu Matilainen 240842
 			continue;
Panu Matilainen 240842
 		    rc = CPIOERR_MISSING_HARDLINK;
Panu Matilainen 240842
 		    if (fsm->failedFile && *fsm->failedFile == NULL) {
Panu Matilainen 240842
-			fsm->ix = fsm->li->filex[i];
Panu Matilainen 240842
+			fsm->ix = ix;
Panu Matilainen 240842
 			if (!fsmMapPath(fsm)) {
Panu Matilainen 240842
 	    		    /* Out-of-sync hardlinks handled as sub-state */
Panu Matilainen 240842
 			    *fsm->failedFile = fsm->path;