Bug#1086655: libgeo-libproj-ffi-perl: (autopkg)test failures on armel and armhf

Andreas Vögele andreas at andreasvoegele.com
Tue Feb 18 21:49:43 GMT 2025


This is an alignment bug. The file lib/Geo/LibProj/FFI.pm or rather the 
module Convert::Binary::C doesn't take into account that pointers are 
32-bits long on armhf but that double struct members are 8-byte aligned. 
The tests in t/lists.t pass if the alignment is set to 8 on armhf.

This Perl scripts outputs 20 on armhf but should output 24.

use 5.036;
use Convert::Binary::C;
my $c = Convert::Binary::C->new;
//my $c = Convert::Binary::C->new(Alignment => 8);
$c->parse(<<ENDC);
struct PJ_UNITS {
         const char  *id;
         const char  *to_meter;
         const char  *name;
         //char pad[4];
         double      factor;
};
ENDC
say $c->sizeof('PJ_UNITS');

The C program below outputs 24.

#include <stdio.h>

struct PJ_UNITS {
         const char  *id;
         const char  *to_meter;
         const char  *name;
         //char pad[4];
         double      factor;
};

int
main(void)
{
         printf("%ld\n", (long) sizeof(struct PJ_UNITS));
         return 0;
}



More information about the pkg-perl-maintainers mailing list