Filter out skipped files on hardlink checking
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 1 Oct 2012 06:23:29 +0000 (09:23 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 1 Oct 2012 06:35:39 +0000 (09:35 +0300)
- Legitimately skipped files (links) must not cause install-errors.
  This has always been broken, but the errors were completely ignored
  on install prior to rpm 4.10, and now that we're only creating the
  first instance of a shared file, secondary arch multilib packages
  with hardlinks were causing install failures because of the "missing"
  hardlinks here.
- The relevant part here is obviously the XFA_SKIPPING() test, for
  which we need the file states. To keep the lines short, grab the
  index to a helper variable and replace other fsm->li->filex[i] uses
  with that too.

lib/fsm.c

index 7afe014..29854b3 100644 (file)
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -551,17 +551,19 @@ static hardLink_t freeHardLink(hardLink_t li)
 static int checkHardLinks(FSM_t fsm)
 {
     int rc = 0;
+    rpmfs fs = fsmGetFs(fsm);
 
     while ((fsm->li = fsm->links) != NULL) {
        fsm->links = fsm->li->next;
        fsm->li->next = NULL;
        if (fsm->li->linksLeft) {
            for (nlink_t i = 0 ; i < fsm->li->linksLeft; i++) {
-               if (fsm->li->filex[i] < 0)
+               int ix = fsm->li->filex[i];
+               if (ix < 0 || XFA_SKIPPING(rpmfsGetAction(fs, ix)))
                    continue;
                rc = CPIOERR_MISSING_HARDLINK;
                if (fsm->failedFile && *fsm->failedFile == NULL) {
-                   fsm->ix = fsm->li->filex[i];
+                   fsm->ix = ix;
                    if (!fsmMapPath(fsm)) {
                        /* Out-of-sync hardlinks handled as sub-state */
                        *fsm->failedFile = fsm->path;