From 1b937c69f4b8187401eeb8eef195bbcc2ea58312 Mon Sep 17 00:00:00 2001 From: Muqun Yang Date: Fri, 7 Feb 2020 14:43:02 -0600 Subject: HDFFV-11014, fix the h5repack issue that misses a few attributes during the repacking. The flag that checks the object reference attribute is not updated properly. The fix is trivial. Just need to move the flag update line into the inner loop. Tested at Jelly. Also update the release.txt. --- release_docs/RELEASE.txt | 10 ++++++++++ tools/src/h5repack/h5repack_refs.c | 9 ++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 8b25de0..12a703d 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -479,6 +479,16 @@ New Features Tools: ------ + - h5repack was fixed to repack the reference attributes properly. + The code line that checks if the update of reference inside a compound + datatype is misplaced outside the code block loop that carries out the + check. In consequence, the next attribute that is not the reference + type was repacked again as the reference type and caused the failure of + repacking. The fix is to move the corresponding code line to the correct + code block. + + (KY -2020/02/07, HDFFV-11014) + - h5diff was updated to use the new reference APIs. h5diff uses the new reference APIs to compare references. diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c index e6a747d..54fe1f2 100644 --- a/tools/src/h5repack/h5repack_refs.c +++ b/tools/src/h5repack/h5repack_refs.c @@ -530,9 +530,16 @@ static int copy_refs_attr(hid_t loc_in, ref_comp_size = NULL; } } + /* This line below needs to be moved in this loop instead of inserting outside. Otherwise, + ref_comp_field_n may be >0 for the next attribute, which may not be + the reference type and will be accidently treated as the reference type. + It will then cause the H5Acreate2 failed since that attribute is already created. + KY 2020-02-07 + */ + is_ref_comp = (ref_comp_field_n > 0); + } - is_ref_comp = (ref_comp_field_n > 0); if (!(is_ref || is_ref_vlen || is_ref_array || is_ref_comp)) { if (H5Tclose(mtype_id) < 0) -- cgit v0.12