Use rpmfiConfigConflictIndex() for modified config testing on erase too
- Besides eliminating another copy-paste variant of the config file digest calculation and comparison, this fixes the case modified %config symlink gets silently erased. Unlike a regular config file, a symlink does not contain a whole lot of carefully tuned data, but if it's marked %config I think we should honor the %config file rules. - Adjust test-suite expectations to match the new behavior.
This commit is contained in:
parent
79f8122f41
commit
a3a08a4b0a
|
@ -544,21 +544,9 @@ assert(otherFi != NULL);
|
|||
break;
|
||||
|
||||
/* Pre-existing modified config files need to be saved. */
|
||||
if (S_ISREG(FMode) && (FFlags & RPMFILE_CONFIG)) {
|
||||
int algo = 0;
|
||||
size_t diglen = 0;
|
||||
const unsigned char *digest;
|
||||
if ((digest = rpmfiFDigestIndex(fi, i, &algo, &diglen))) {
|
||||
unsigned char fdigest[diglen];
|
||||
char *fn = rpmfiFNIndex(fi, i);
|
||||
int modified = (!rpmDoDigest(algo, fn, 0, fdigest, NULL) &&
|
||||
memcmp(digest, fdigest, diglen));
|
||||
free(fn);
|
||||
if (modified) {
|
||||
rpmfsSetAction(fs, i, FA_BACKUP);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (rpmfiConfigConflictIndex(fi, i)) {
|
||||
rpmfsSetAction(fs, i, FA_BACKUP);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Otherwise, we can just erase. */
|
||||
|
|
|
@ -92,10 +92,8 @@ test ! -L "${cf}"
|
|||
AT_CLEANUP
|
||||
|
||||
# Erase modified config link
|
||||
# Broken, no backup taken
|
||||
AT_SETUP([erase changed config link])
|
||||
AT_KEYWORDS([install])
|
||||
AT_XFAIL_IF([test $RPM_XFAIL -gt 0])
|
||||
AT_CHECK([
|
||||
RPMDB_CLEAR
|
||||
RPMDB_INIT
|
||||
|
|
Loading…
Reference in New Issue