Some fresh rpm hate

[prev] [thread] [next] [lurker] [Date index for 2006/03/15]

From: Rafael Garcia-Suarez
Subject: Some fresh rpm hate
Date: 08:33 on 15 Mar 2006
And now, some hate for developers. Sorry in advance for our
non-C-fluent readers.

Somewhere in the rpm library headers, up to version 4.4.4, you have
this nice typedef:

typedef void * (*rpmCallbackFunction)
                (/*@null@*/ const void * h,
                const rpmCallbackType what,
                const unsigned long amount,
                const unsigned long total,
                /*@null@*/ fnpyKey key,
                /*@null@*/ rpmCallbackData data)

So far so good. Except that in 4.4.5 the "amount" and "total"
arguments were changed to unsigned long long (without any mention in
the release changelog, of course, that would be telling).

So, if you have some C program that defines an rpmCallbackFunction,
when it gets called, the call stack is blown, your program segfaults
and gdb is confused. Hard to trace. Depending on the C application,
this might also have unnice consequences on your system's rpm
database, I suppose.

But it doesn't stop there. I haven't been able to figure out a way to
check for the version of the rpmlib you're linking against via plain
#ifdefs. Which means that I have to fallback to some Makefile magic to
add a CPP symbol that says whether I need an unsigned long or an
unsigned long long here. Duh.

Generated at 08:01 on 17 Mar 2006 by mariachi 0.52