Re: file filtering in dpkg -i
On Wed, 19 May 2010, Martin Pitt wrote:
> Right now it doesn't work for me at all, though. Current git head on
> current sid, even without my dpkg patch, constantly fails with
>
> dpkg: ../../../lib/dpkg/dump.c:147: w_booleandefno: Assertion `value==1' failed.
Guillem pushed a commit where many usage of integers 0/1 were replaced by
booleans (type bool, true/false). But he probably missed some places to
update.
Attached is an untested patch. I'm just not sure whether the check
of pifp->valid was important.
Keeping it is not really possible because "-1" evaluates neither like true
nor false in the tests that follow.
Cheers,
--
Raphaël Hertzog
Like what I do? Sponsor me: http://ouaza.com/wp/2010/01/05/5-years-of-freexian/
My Debian goals: http://ouaza.com/wp/2010/01/09/debian-related-goals-for-2010/
diff --git a/lib/dpkg/dump.c b/lib/dpkg/dump.c
index d6a21b9..05d076a 100644
--- a/lib/dpkg/dump.c
+++ b/lib/dpkg/dump.c
@@ -138,13 +138,13 @@ void w_filecharf(struct varbuf *vb,
void w_booleandefno(struct varbuf *vb,
const struct pkginfo *pigp, const struct pkginfoperfile *pifp,
enum fwriteflags flags, const struct fieldinfo *fip) {
- int value= pifp->valid ? PKGPFIELD(pifp,fip->integer,int) : -1;
+ bool value = PKGPFIELD(pifp, fip->integer, bool);
if (!(flags&fw_printheader)) {
- varbufaddstr(vb, (value==1) ? "yes" : "no");
+ varbufaddstr(vb, value ? "yes" : "no");
return;
}
if (!value) return;
- assert(value==1);
+ assert(value == true);
varbufaddstr(vb,fip->name); varbufaddstr(vb, ": yes\n");
}
Reply to: