size_t odiglen, ndiglen;
const unsigned char * odigest, * ndigest;
odigest = rpmfiFDigestIndex(ofi, oix, &oalgo, &odiglen);
+ ndigest = rpmfiFDigestIndex(nfi, nix, &nalgo, &ndiglen);
if (diskWhat == REG) {
if (rpmDoDigest(oalgo, fn, 0, (unsigned char *)buffer, NULL))
return FA_CREATE; /* assume file has been removed */
if (odigest && !memcmp(odigest, buffer, odiglen))
return FA_CREATE; /* unmodified config file, replace. */
+ /* hash algo changed in new, recalculate digest */
+ if (oalgo != nalgo)
+ if (rpmDoDigest(nalgo, fn, 0, (unsigned char *)buffer, NULL))
+ return FA_CREATE; /* assume file has been removed */
+ if (ndigest && !memcmp(ndigest, buffer, ndiglen))
+ return FA_CREATE; /* file identical in new, replace. */
}
- ndigest = rpmfiFDigestIndex(nfi, nix, &nalgo, &ndiglen);
/* Can't compare different hash types, backup to avoid data loss */
if (oalgo != nalgo || odiglen != ndiglen)
return save;
AT_CLEANUP
# ------------------------------
-# Modified config file matches the content from new package. Creating a
-# backup makes no sense in this case, but that's what currently happens.
+# Modified config file matches the content from new package.
AT_SETUP([upgrade changing, modified config 2])
AT_KEYWORDS([install])
AT_CHECK([
foo-2.0
foo-2.0
],
-[warning: /etc/my.conf saved as /etc/my.conf.rpmsave]
-)
+[])
AT_CLEANUP
# config(noreplace) variants of the same cases.
AT_CLEANUP
# ------------------------------
-# Modified config file matches the content from new package. Creating a
-# backup makes no sense in this case, but that's what currently happens.
+# Modified config file matches the content from new package.
AT_SETUP([upgrade changing, modified config(noreplace) 2])
AT_KEYWORDS([install])
AT_CHECK([
foo-2.0
foo-2.0
],
-[warning: /etc/my.conf created as /etc/my.conf.rpmnew]
-)
+[])
AT_CLEANUP
# Shared config file variants of the same cases
AT_CLEANUP
# ------------------------------
-# Modified config file matches the content from new package. Creating a
-# backup makes no sense in this case, but that's what currently happens.
+# Modified config file matches the content from new package.
AT_SETUP([upgrade changing, modified shared config 2])
AT_KEYWORDS([install])
AT_CHECK([
foo-2.0
foo-2.0
],
-[warning: /etc/my.conf saved as /etc/my.conf.rpmsave]
-)
+[])
AT_CLEANUP
# Shared config(noreplace) variants of the more interesting cases
AT_CLEANUP
# ------------------------------
-# Modified config file matches the content from new package. Creating a
-# backup makes no sense in this case, but that's what currently happens.
+# Modified config file matches the content from new package.
AT_SETUP([upgrade changing, modified shared config(noreplace) 2])
AT_KEYWORDS([install])
AT_CHECK([
foo-2.0
foo-2.0
],
-[warning: /etc/my.conf created as /etc/my.conf.rpmnew]
-)
+[])
AT_CLEANUP