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

Allan McRae allan at archlinux.org
Mon Nov 25 06:08:47 EST 2013


On 22/11/13 22:37, Jeremy Heiner wrote:
> On Thu, Nov 21, 2013 at 3:52 PM, Allan McRae <allan at archlinux.org> wrote:
>> Nope - documenting is the only real way to deal with this.  For example:
>>
>> http://www.gnupg.org/documentation/manuals/gpgme/Largefile-Support-_0028LFS_0029.html
> 
> How about the approach outlined in the attachment? It passes 'make
> check' and performs correctly when a libalpm client app goofs up.
> 

Please send patches inline so we can easily comment.

I was quite surprised this worked:

+#define alpm_initialize(root,dbpath,err) \
+  alpm_initialize_check_largefile(root, dbpath, err, sizeof(off_t))

The sizeof(off_t) gets evaluated before the #define?  That can't be
right...   So must be optimised out?  I'm either missing something here
or this is prone to breakage.


I guess a working approach would be to find the size of off_t during
configure (e.g. [1] - there are other approaches) and test sizeof(off_t)
== SIZEOF_OFF_T  in alpm_initialise.

Allan

[1]
http://www.gnu.org/software/autoconf-archive/ax_compile_check_sizeof.html



More information about the pacman-dev mailing list