Don't throw away modified config files on cross-hash upgrades (rhbz#479869)
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 28 Jan 2009 14:34:06 +0000 (16:34 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 28 Jan 2009 14:34:06 +0000 (16:34 +0200)
- different digest types can't be compared, take a backup to avoid
  data loss
- Patch from Miloslav Trmac

lib/rpmfi.c

index 10ef83b..4b34763 100644 (file)
@@ -667,9 +667,9 @@ rpmFileAction rpmfiDecideFate(const rpmfi ofi, rpmfi nfi, int skipMissing)
                return FA_CREATE;       /* unmodified config file, replace. */
        }
        ndigest = rpmfiFDigest(nfi, &nalgo, &ndiglen);
-       /* XXX can't compare different hash types, what should we do here? */
+       /* Can't compare different hash types, backup to avoid data loss */
        if (oalgo != nalgo || odiglen != ndiglen)
-           return FA_CREATE;
+           return save;
        if (odigest && ndigest && !memcmp(odigest, ndigest, odiglen))
            return FA_SKIP;     /* identical file, don't bother. */
     } else /* dbWhat == LINK */ {