summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2022-03-23 13:05:57 +0200
committerMichal Domonkos <mdomonko@redhat.com>2022-07-01 10:52:14 +0200
commit73fe137c0fee957ee8e0872a547698404ff73b64 (patch)
tree633936dc861ab088c924e1002e419c51dd889fc0
parent25e64a5032e1350044843fce6db8e5990a7c3df6 (diff)
downloadrpm-73fe137c0fee957ee8e0872a547698404ff73b64.tar.gz
Fix non-installed files taking part in file disposition calculations
Files that are not installed cannot conflict with anything, any more than skipped files can. The latter we handled, the former not. Strange what "obvious" cases can go on unnoticed forever, when lacking systematic tests. (cherry picked from commit cf2752b05c47a9461ffcaea04bdb774905286ba6)
-rw-r--r--lib/transaction.c3
-rw-r--r--tests/rpme.at17
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/transaction.c b/lib/transaction.c
index 55bc2d961..a44833086 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -434,6 +434,9 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx
if (XFA_SKIPPING(rpmfsGetAction(fs, fx)))
return;
+ if (rpmfilesFState(otherFi, ofx) == RPMFILE_STATE_NOTINSTALLED)
+ return;
+
if (rpmfilesCompare(otherFi, ofx, fi, fx)) {
int rConflicts = 1;
char rState = RPMFILE_STATE_REPLACED;
diff --git a/tests/rpme.at b/tests/rpme.at
index c41348f2f..2d395e27c 100644
--- a/tests/rpme.at
+++ b/tests/rpme.at
@@ -226,6 +226,23 @@ for p in a b; do
done
AT_CHECK([
+runroot rpm -U --ignoreos --excludepath=/usr/share /build/RPMS/noarch/conflicta-1.0-1.noarch.rpm
+runroot rpm -U --ignoreos /build/RPMS/noarch/conflictb-1.0-1.noarch.rpm
+runroot rpm -Vav --nogroup --nouser conflicta conflictb
+runroot rpm -e conflicta
+runroot rpm -Vav --nogroup --nouser conflictb
+runroot rpm -e conflictb
+runroot rpm -Vp --nogroup --nouser /build/RPMS/noarch/conflictb-1.0-1.noarch.rpm
+],
+[1],
+[......... /usr/share/my.version (not installed)
+......... /usr/share/my.version
+......... /usr/share/my.version
+missing /usr/share/my.version
+],
+[])
+
+AT_CHECK([
runroot rpm -U --ignoreos /build/RPMS/noarch/conflicta-1.0-1.noarch.rpm
runroot rpm -U --ignoreos --force /build/RPMS/noarch/conflictb-1.0-1.noarch.rpm
runroot rpm -Vav --nogroup --nouser conflicta conflictb