#1849: CarpetIOHDF5: fix check for old string datatype --------------------+------------------------------------------------------- Reporter: knarf | Owner: eschnett Type: defect | Status: new Priority: minor | Milestone: Component: Carpet | Version: development version Keywords: hdf5 | --------------------+------------------------------------------------------- The current code contains a check for an old way the grid structure string was saved: as H5T_NATIVE_CHAR. This check test whether the type found in a (checkpoint) file is of that type. However, this fails if H5T_NATIVE_CHAR was different on the machine writing the checkpoint and the one restoring from it (e.g., big vs. little endian int8).
Instead of checking if the saved type is of type H5T_NATIVE_CHAR, this patch checks for the new datatype being of class H5T_STRING.
This change makes the two restore testsuites pass on big endian machines (the checkpoint file in the testsuite was written using the old mechanism, on a little endian machine).
https://bitbucket.org/eschnett/carpet/pull- requests/8/fixed_string_check/diff
I tested that this fixes the problems on the big endian machine, and that the testsuite also still works on a regular, little endian machine, for both an old and a new-style checkpoint.
The two lines changed both look like this: {{{ - HDF5_ERROR(old_data = H5Tequal(datatype, H5T_NATIVE_CHAR)); + HDF5_ERROR(old_data = 0 == H5Tdetect_class(datatype, H5T_STRING)); }}}
I am not sure about whether we should back-port this. It would be easy, as the change is very small, and I tested it, but I would like to have a separate "yes" for that.