- fix recorded file state of otherwise skipped files (#492947)

- compress ChangeLog, drop old CHANGES file (#492440)
This commit is contained in:
Panu Matilainen 2009-04-03 07:45:24 +00:00
parent 58f7f156f9
commit 1a5c9c21c5
2 changed files with 92 additions and 2 deletions

View File

@ -0,0 +1,81 @@
commit 4e77d95a7856216e49453009c855cce701734b9c
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Fri Apr 3 10:28:59 2009 +0300
Make sure installed files have state (rhbz#492947)
- rpmfsSetState() doesn't get called for skipped files like %ghost and
%config(noreplace), causing incorrect file state ("no state") getting
recorded in rpmdb, leading to inapproriate removal/rename on erase, ick
- For TR_ADDED, always default file states to RPMFILE_STATE_NORMAL, fsm
changes it as necessary for skipped colors and such. Lazy alloc on
rpmfsSetState() is not correct as rpmfsSetState() might not get called
at all.
- originally broken by commit 8d6c4b8c95b59f5a71d90c582c2e98f5c7ed7b9d
diff --git a/lib/fsm.c b/lib/fsm.c
index b892b03..752f0cc 100644
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -663,8 +663,6 @@ static int fsmMapPath(FSM_t fsm)
break;
case FA_COPYIN:
case FA_CREATE:
- if (rpmteType(te) == TR_ADDED)
- rpmfsSetState(fs, i, RPMFILE_STATE_NORMAL);
break;
case FA_SKIPNSTATE:
diff --git a/lib/rpmte.c b/lib/rpmte.c
index 6ff20f5..e1ef060 100644
--- a/lib/rpmte.c
+++ b/lib/rpmte.c
@@ -285,7 +285,7 @@ static void addTE(rpmts ts, rpmte p, Header h,
struct rpmtd_s bnames;
headerGet(h, RPMTAG_BASENAMES, &bnames, HEADERGET_MINMEM);
- p->fs = rpmfsNew(rpmtdCount(&bnames));
+ p->fs = rpmfsNew(rpmtdCount(&bnames), p->type);
rpmtdFreeData(&bnames);
}
@@ -896,11 +896,15 @@ rpmfs rpmteGetFileStates(rpmte te) {
return te->fs;
}
-rpmfs rpmfsNew(unsigned int fc) {
+rpmfs rpmfsNew(unsigned int fc, rpmElementType type) {
rpmfs fs = xmalloc(sizeof(*fs));
fs->fc = fc;
fs->replaced = NULL;
fs->states = NULL;
+ if (type == TR_ADDED) {
+ fs->states = xmalloc(sizeof(*fs->states) * fs->fc);
+ memset(fs->states, RPMFILE_STATE_NORMAL, fs->fc);
+ }
fs->actions = xmalloc(fc * sizeof(*fs->actions));
memset(fs->actions, FA_UNKNOWN, fc * sizeof(*fs->actions));
fs->numReplaced = fs->allocatedReplaced = 0;
@@ -958,10 +962,6 @@ sharedFileInfo rpmfsNextReplaced(rpmfs fs , sharedFileInfo replaced)
void rpmfsSetState(rpmfs fs, unsigned int ix, rpmfileState state)
{
assert(ix < fs->fc);
- if (fs->states == NULL) {
- fs->states = xmalloc(sizeof(*fs->states) * fs->fc);
- memset(fs->states, RPMFILE_STATE_MISSING, fs->fc);
- }
fs->states[ix] = state;
}
diff --git a/lib/rpmte_internal.h b/lib/rpmte_internal.h
index 3ce4112..60c52bd 100644
--- a/lib/rpmte_internal.h
+++ b/lib/rpmte_internal.h
@@ -81,7 +81,7 @@ int rpmteHaveTransScript(rpmte te, rpmTag tag);
rpmfs rpmteGetFileStates(rpmte te);
RPM_GNUC_INTERNAL
-rpmfs rpmfsNew(unsigned int fc);
+rpmfs rpmfsNew(unsigned int fc, rpmElementType type);
RPM_GNUC_INTERNAL
rpmfs rpmfsFree(rpmfs fs);

View File

@ -25,7 +25,7 @@
Summary: The RPM package management system Summary: The RPM package management system
Name: rpm Name: rpm
Version: %{rpmver} Version: %{rpmver}
Release: 0.%{snapver}.8%{?dist} Release: 0.%{snapver}.9%{?dist}
Group: System Environment/Base Group: System Environment/Base
Url: http://www.rpm.org/ Url: http://www.rpm.org/
Source0: http://rpm.org/releases/testing/%{name}-%{srcver}.tar.bz2 Source0: http://rpm.org/releases/testing/%{name}-%{srcver}.tar.bz2
@ -48,6 +48,7 @@ Patch201: rpm-4.7.0-beta1-fstates.patch
Patch202: rpm-4.7.0-beta1-installangs.patch Patch202: rpm-4.7.0-beta1-installangs.patch
Patch203: rpm-4.7.0-alpha-isa.patch Patch203: rpm-4.7.0-alpha-isa.patch
Patch204: rpm-4.7.0-rsa-v4.patch Patch204: rpm-4.7.0-rsa-v4.patch
Patch205: rpm-4.7.0-beta1-default-filestate.patch
# These are not yet upstream # These are not yet upstream
Patch300: rpm-4.7.0-extra-provides.patch Patch300: rpm-4.7.0-extra-provides.patch
@ -195,6 +196,7 @@ that will manipulate RPM packages and databases.
%patch202 -p1 -b .installangs %patch202 -p1 -b .installangs
%patch203 -p1 -b .alpha-isa %patch203 -p1 -b .alpha-isa
%patch204 -p1 -b .rsa-v4 %patch204 -p1 -b .rsa-v4
%patch205 -p1 -b .default-fstate
%patch300 -p1 -b .extra-prov %patch300 -p1 -b .extra-prov
%patch301 -p1 -b .rpmfc-order %patch301 -p1 -b .rpmfc-order
@ -274,6 +276,9 @@ find $RPM_BUILD_ROOT -name "*.la"|xargs rm -f
# avoid dragging in tonne of perl libs for an unused script # avoid dragging in tonne of perl libs for an unused script
chmod 0644 $RPM_BUILD_ROOT/%{rpmhome}/perldeps.pl chmod 0644 $RPM_BUILD_ROOT/%{rpmhome}/perldeps.pl
# compress our ChangeLog, it's fairly big...
bzip2 -9 ChangeLog
%clean %clean
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
@ -298,7 +303,7 @@ exit 0
%files -f %{name}.lang %files -f %{name}.lang
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc CHANGES GROUPS COPYING CREDITS ChangeLog doc/manual/[a-z]* %doc GROUPS COPYING CREDITS ChangeLog.bz2 doc/manual/[a-z]*
%{_sysconfdir}/cron.daily/rpm %{_sysconfdir}/cron.daily/rpm
%config(noreplace,missingok) %{_sysconfdir}/logrotate.d/rpm %config(noreplace,missingok) %{_sysconfdir}/logrotate.d/rpm
@ -404,6 +409,10 @@ exit 0
%doc doc/librpm/html/* %doc doc/librpm/html/*
%changelog %changelog
* Fri Apr 03 2009 Panu Matilainen <pmatilai@redhat.com> - 4.7.0-0.beta1.9
- fix recorded file state of otherwise skipped files (#492947)
- compress ChangeLog, drop old CHANGES file (#492440)
* Thu Apr 2 2009 Tom "spot" Callaway <tcallawa@redhat.com> - 4.7.0-0.beta1.8 * Thu Apr 2 2009 Tom "spot" Callaway <tcallawa@redhat.com> - 4.7.0-0.beta1.8
- Fix sparcv9v and sparc64v targets - Fix sparcv9v and sparc64v targets