Hello Enrico, At Imagination Technologies (http://imgtec.com/) Dragoslav Sicarov have found a solution to Debian bug #733510.
https://bugs.debian.org/733510 My NMU patch for grib-api_1.10.4-3.1 is below, at the end of this message. With the changes in the NMU patch grib-api builds successfully on mips and amd64. The bug report together with the patch has been forwarded upstream. Regards, Aníbal -- Aníbal Monsalve Salazar <anibal.monsalvesala...@imgtec.com> debdiff grib-api_1.10.4-3.dsc grib-api_1.10.4-3.1.dsc diff -Nru grib-api-1.10.4/debian/changelog grib-api-1.10.4/debian/changelog --- grib-api-1.10.4/debian/changelog 2013-08-25 00:27:18.000000000 +0100 +++ grib-api-1.10.4/debian/changelog 2014-04-30 09:07:10.000000000 +0100 @@ -1,3 +1,12 @@ +grib-api (1.10.4-3.1) unstable; urgency=medium + + * Non-maintainer upload. + * Fix "FTBFS: grib-api - tests fail for mips" + Patch by Dragoslav Sicarov <dragoslav.sica...@imgtec.com> + Closes: #733510 + + -- Anibal Monsalve Salazar <ani...@debian.org> Wed, 30 Apr 2014 09:06:53 +0100 + grib-api (1.10.4-3) unstable; urgency=low * Back to Arch: any after successful testing on mips and sparc. diff -Nru grib-api-1.10.4/debian/patches/grib_bits.diff grib-api-1.10.4/debian/patches/grib_bits.diff --- grib-api-1.10.4/debian/patches/grib_bits.diff 1970-01-01 01:00:00.000000000 +0100 +++ grib-api-1.10.4/debian/patches/grib_bits.diff 2014-04-30 08:57:04.000000000 +0100 @@ -0,0 +1,66 @@ +From: Dragoslav Sicarov <dragoslav.sica...@imgtec.com> +Subject: FTBFS: grib-api - tests fail for mips +Date: Sun, 29 Dec 2013 15:13:16 +0000 + +https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=733510 + +FTBFS: 21 of 38 tests fail when trying to build package from source on +mips. Part of build log has been attached. + +The root cause of failing tests for mips is in function +grib_encode_unsigned_long() that is used for writing into grib message +buffer (function is implemented differently for big-endian and +little-endian architectures). + +On big-endian architectures, function uses shift operations, where in +some corner-case situations left operand (which is of type unsigned +long; size of long equals 4 bytes for 32bit system) is shifted right by +32 bits. + +According to C standard, if the value of the right operand of shift +operation is negative, or is greater than or equal to the width of the +left operand, the behaviour is undefined. + +On 32-bit mips architecture shift operations by a variable number of +bits are translated to/use 'srlv' and 'sllv' instructions which shift +left operand by (right_operand mod 32) bits. In case of shifting by 32 +bits, this results in left operand being unchanged. However, in order +for this package to function properly a result of 0 is expected. + +Proposed patch fixes these corner-cases by setting the result of shift +operation to 0 if right operand is greater than or equal to size of long +(actually, no shifting is performed, the result is set to zero). + +--- a/src/grib_bits.c 2013-05-29 16:32:07.000000000 +0100 ++++ b/src/grib_bits.c 2014-04-30 08:40:17.717503443 +0100 +@@ -24,7 +24,7 @@ + long GRIB_MASK = -1; /* Mask of sword bits */ + + # define VALUE(p,q,b) \ +- (((b)==max_nbits ? GRIB_MASK : ~(GRIB_MASK<<(b))) & ((p)>>(max_nbits-((q)+(b))))) ++ (((b)==max_nbits ? GRIB_MASK : ~(GRIB_MASK<<(b))) & (((max_nbits-((q)+(b))) >= max_nbits) ? 0 : ((p)>>(max_nbits-((q)+(b)))))) + + # define MASKVALUE(q,b) \ + ((b)==max_nbits ? GRIB_MASK : (~(GRIB_MASK<<(b))<<(max_nbits-((q)+(b))))) +--- a/src/grib_bits_fast_big_endian.c 2013-05-29 16:32:07.000000000 +0100 ++++ b/src/grib_bits_fast_big_endian.c 2014-04-30 08:40:17.733503444 +0100 +@@ -62,9 +62,16 @@ int grib_encode_unsigned_long(unsigned c + countOfLeftmostBits = max_nbits - startBit; + startBit = max_nbits - remainingBits; + remainingBits -= countOfLeftmostBits; +- destination[nextWord] = +- ((destination[nextWord] >> countOfLeftmostBits) << countOfLeftmostBits) +- + (VALUE(val,startBit,countOfLeftmostBits)); ++ if (countOfLeftmostBits < max_nbits) ++ { ++ destination[nextWord] = ++ ((destination[nextWord] >> countOfLeftmostBits) << countOfLeftmostBits) ++ + (VALUE(val,startBit,countOfLeftmostBits)); ++ } ++ else ++ { ++ destination[nextWord] = (VALUE(val,startBit,countOfLeftmostBits)); ++ } + startBit = 0; + nextWord++; + } diff -Nru grib-api-1.10.4/debian/patches/series grib-api-1.10.4/debian/patches/series --- grib-api-1.10.4/debian/patches/series 1970-01-01 01:00:00.000000000 +0100 +++ grib-api-1.10.4/debian/patches/series 2014-04-30 08:58:38.000000000 +0100 @@ -0,0 +1 @@ +grib_bits.diff
signature.asc
Description: Digital signature