diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2022-03-23 14:25:31 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2022-03-28 10:43:36 +0300 |
commit | 0bb3fa9025882cd11867ffa0f8ab0bf3e6314d70 (patch) | |
tree | f8fc2de1e2745c5803acc513d40c32f1bcdd643b | |
parent | cf2752b05c47a9461ffcaea04bdb774905286ba6 (diff) | |
download | rpm-0bb3fa9025882cd11867ffa0f8ab0bf3e6314d70.tar.gz |
Fix excluded paths taking part in file disposition calculations
Commit f311fb65eea4791fa15a00412384b96fdccbbf1c added a step to reset
calculated states between rpmtsRun() calls to allow for %pretrans
hacks, but this causes actions set for --excludepath to get lost.
While those do get recalculated at the time of actual install and
correctly skipped, this causes them to be considered for file
disposition which they should not.
-rw-r--r-- | lib/rpmfs.c | 9 | ||||
-rw-r--r-- | tests/rpme.at | 17 |
2 files changed, 23 insertions, 3 deletions
diff --git a/lib/rpmfs.c b/lib/rpmfs.c index 5f91cd28d..02c31a83d 100644 --- a/lib/rpmfs.c +++ b/lib/rpmfs.c @@ -20,8 +20,7 @@ rpmfs rpmfsNew(rpm_count_t fc, int initState) { rpmfs fs = xcalloc(1, sizeof(*fs)); fs->fc = fc; - fs->actions = xmalloc(fs->fc * sizeof(*fs->actions)); - rpmfsResetActions(fs); + fs->actions = xcalloc(fs->fc, sizeof(*fs->actions)); if (initState) { fs->states = xmalloc(sizeof(*fs->states) * fs->fc); memset(fs->states, RPMFILE_STATE_NORMAL, fs->fc); @@ -122,6 +121,10 @@ void rpmfsSetAction(rpmfs fs, unsigned int ix, rpmFileAction action) void rpmfsResetActions(rpmfs fs) { if (fs && fs->actions) { - memset(fs->actions, FA_UNKNOWN, fs->fc * sizeof(*fs->actions)); + for (int i = 0; i < fs->fc; i++) { + /* --excludepaths is processed early, avoid undoing that */ + if (fs->actions[i] != FA_SKIPNSTATE) + fs->actions[i] = FA_UNKNOWN; + } } } diff --git a/tests/rpme.at b/tests/rpme.at index 2d395e27c..f46d64a6b 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 /build/RPMS/noarch/conflicta-1.0-1.noarch.rpm +runroot rpm -U --ignoreos --excludepath=/usr/share /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 +......... /usr/share/my.version (not installed) +......... /usr/share/my.version (not installed) +missing /usr/share/my.version +], +[]) + +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 |