[MINC-development] test failures: minc2-label-test

Steve M. Robbins steve at sumost.ca
Tue Oct 6 01:49:11 EDT 2015


Hi,

I'm a little stumped.  The new libminc 2.3.00 fails on certain Debian 
architectures but works on others; see 
https://buildd.debian.org/status/package.php?p=libminc

Mostly, it is minc2-label-test that fails.  The first failure is line 172:

   168    miget_label_value ( vol, "White", &white_value );
   169    miget_label_value ( vol, "Blue", &blue_value );
   170
   171    if (white_value != 0xffffff) {
   172      TESTRPT("miget_label_value, White", white_value);
   173    }

Instead of 0x00ffffff, we get -256 = 0xffffff00 -- i.e. a byte-swapped value.  
I traced through label.c and found this code that employs "miswap4()".   Here 
I'm way over my head, so maybe someone can quickly fill me in: 

1. What are volume->mtype_id and volume->ftype_id ?

2. Is there any implicit assumptions in this code about the bit-length of 
unsigned short and unsigned int?  Any implicit assumptions about endianness?



int  midefine_label(mihandle_t volume, int value, const char *name)
{
...
    MI_CHECK_HDF_CALL_RET(result = H5Tenum_insert(volume->mtype_id, name, 
&value),"H5Tenum_insert");

    /* We might have to swap these values before adding them to
     * the file type.
     * 
     * COOL! the whole purpose of HDF5 being machine independent is defeated 
here!
     */
    if (H5Tget_order(volume->ftype_id) != H5Tget_order(volume->mtype_id)) {
        switch (H5Tget_size(volume->ftype_id)) {
        case 2:
            value = miswap2((unsigned short) value);
            break;
        case 4:
            value = miswap4((unsigned int) value);
            break;
        }
    }
    MI_CHECK_HDF_CALL_RET(result = H5Tenum_insert(volume->ftype_id, name, 
&value),"H5Tenum_insert");


Thanks,
-Steve
P.S.  See trivial fixes in https://github.com/BIC-MNI/libminc/pull/59

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: This is a digitally signed message part.
URL: <http://www.bic.mni.mcgill.ca/pipermail/minc-development/attachments/20151006/8a84a4d0/attachment.pgp>


More information about the MINC-development mailing list