Bug#761603: libhdf4: wrong endianness on s390x/mips
Johan Van de Wauw
johan.vandewauw at gmail.com
Tue Sep 16 10:04:09 UTC 2014
Thanks for your patch. I am also running some more tests on different
architectures.
Johan
On Sun, Sep 14, 2014 at 11:53 PM, Rebecca Palmer
<rebecca_palmer at zoho.com> wrote:
> Package: libhdf4-0
> Version: 4.2.10~1exp1
> Control: tags -1 patch
>
> (from debian/patches/hdfi.h )
>>
>> --- a/HDF4/hdf/src/hconv.h
>> +++ b/HDF4/hdf/src/hconv.h
>> @@ -59,7 +59,7 @@
>> /* CONSTANT DEFINITIONS
>> */
>>
>> /*****************************************************************************/
>> /* Generally Big-Endian machines */
>> -#if !defined(INTEL86) && !defined(MIPSEL) && !defined(DEC_ALPHA) &&
>> !defined(I860) && !defined(SUN386) && !(defined(__ia64) && !(defined(hpux)
>> || defined(__hpux))) && !defined(__x86_64__)
>> +#if !defined(INTEL86) && !defined(MIPSEL) && !defined(DEC_ALPHA) &&
>> !defined(I860) && !defined(SUN386) && !(defined(__ia64) && !(defined(hpux)
>> || defined(__hpux))) && !defined(__x86_64__) && (defined(__powerpc__) &&
>> !defined(__LITTLE_ENDIAN__)) && !defined(__aarch64__) &&
>> !defined(__ARM_EABI__)
>
>
> That treats anything that isn't powerpc as little-endian, which is wrong for
> s390x and mips.
>
> The result of this appears to be that while the data itself gets put the
> right way round, the array size metadata doesn't:
>
> # t100x100 is the test file from
> http://sources.debian.net/src/libhdf4/4.2.10-1%7Eexp1/hdf/util/testfiles/fp2hdf/t100x100/
> amd64$ hdfimport t100x100 -o test_amd64.hdf
> qemu-s390x$ hdfimport t100x100 -o test_s390x.hdf
> $ cmp test_s390x.hdf test_amd64.hdf -l
> 41095 144 0
> 41098 0 144
> 41192 144 0
> 41195 0 144
> 41293 0 102
> 41294 0 310
> 41295 310 0
> 41296 102 0
> 42044 62 63
> amd64$ hdiff test_amd64.hdf test_s390x.hdf
> Comparison not supported
> <DataSet> has rank 2, dimensions [ 100 100 ]
> <DataSet> has rank 2, dimensions [ 1677721600 1677721600 ]
> # 1677721600 = 100 << 24
> qemu-s390x$ hdiff test_amd64.hdf test_s390x.hdf
> Comparison not supported
> <DataSet> has rank 2, dimensions [ 1677721600 1677721600 ]
> <DataSet> has rank 2, dimensions [ 100 100 ]
> qemu-s390x$ hdp dumpsds test_s390x.hdf
> File name: test_s390x.hdf
>
> Variable Name = DataSet
> Index = 0
> Type= 32-bit floating point
> Ref. = 2
> Compression method = NONE
> Rank = 2
> Number of attributes = 1
> Dim0: Name=fakeDim0
> Size = 100
> Scale Type = 32-bit floating point
> Number of attributes = 0
> Dim1: Name=fakeDim1
> Size = 100
> Scale Type = 32-bit floating point
> Number of attributes = 0
> Attr0: Name = valid_range
> Type = 32-bit floating point
> Count= 2
> Value = 0.000000 100.000000
> Data :
> [...large array...]
> amd64$ hdp dumpsds test_s390x.hdf
> File name: test_s390x.hdf
>
> Variable Name = DataSet
> Index = 0
> Type= 32-bit floating point
> Ref. = 2
> Compression method = NONE
> Rank = 2
> Number of attributes = 1
> Dim0: Name=fakeDim0
> Size = 1677721600
> Scale Type = 32-bit floating point
> Number of attributes = 0
> Dim1: Name=fakeDim1
> Size = 1677721600
> Scale Type = 32-bit floating point
> Number of attributes = 0
> Attr0: Name = valid_range
> Type = 32-bit floating point
> Count= 2
> Value = 0.000000 0.000000
> Data :
> in sdsdumpfull: space allocation for buf failed. Terminated!
>
> If you want to keep this (weird, and fragile in that it silently treats
> anything it doesn't recognise as big-endian) form use
>
> +#if !defined(INTEL86) && !defined(MIPSEL) && !defined(DEC_ALPHA) &&
> !defined(I860) && !defined(SUN386) && !(defined(__ia64) && !(defined(hpux)
> || defined(__hpux))) && !defined(__x86_64__) && !(defined(__powerpc__) &&
> defined(__LITTLE_ENDIAN__)) && !defined(__aarch64__) &&
> !defined(__ARM_EABI__)
>
> Fortunately, nothing outside libhdf4 uses this header (according to
> codesearch.debian.net), so nothing else should need recompiling.
>
> _______________________________________________
> Pkg-grass-devel mailing list
> Pkg-grass-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel
More information about the Pkg-grass-devel
mailing list