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

Allan McRae allan at archlinux.org
Mon Nov 25 09:12:39 EST 2013


On 25/11/13 23:43, Andrew Gregory wrote:
> On 11/25/13 at 09:08pm, Allan McRae wrote:
>> 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.
> 
> If I'm not mistaken, sizeof is evaluated at compile time.  This works
> because the sizeof(off_t) in the #define is evaluated when the calling
> program is compiled and the sizeof(off_t) inside
> alpm_initialize_check_largefile is evaluated when alpm is compiled.
> 

Ah - compile time evaluation...  I understand what this is doing now.
However, I don't like that this is a runtime check.

>From searching around, we are definitely not the first people to run
into this issue, but seem to be the only ones who are trying to code around.

Allan



More information about the pacman-dev mailing list