[pacman-dev] Bug in libalpm: sizeof(off_t)

Jeremy Heiner scalaprotractor at gmail.com
Wed Nov 20 22:26:12 EST 2013


An app developer can sometimes choose how big they want off_t to be
(by #defining _FILE_OFFSET_BITS). The default for i686 is 32 bits (a
bit odd, that). Pacman's configure attempts to choose 64 bits, and
succeeds in doing so for the Arch builds (but doesn't force that
choice).

Bad things happen when the app developer chooses differently than
configure did, but not until runtime. For example, the app's .o files
will think sizeof(alpm_file_t) == 12, whereas libalpm thinks it == 16.
The compile and link phases don't catch this.

One possible solution might be to "mv alpm.h alpm.h.in", and add something like:

#if sizeof(off_t) != @???@
#error ???
#endif

Not sure yet what to put in those "???" spots, but the basic idea is
to prevent the compiler from generating any .o files that disagree
with the ABI of /usr/lib/libalpm. Hope that all made sense, and that
I'm not duplicating - I searched the mailing list and the bug database
and found zero hits. Anyone see a better solution?
Jeremy


More information about the pacman-dev mailing list