From 8d72e5e3e0fb13cb965a5973e0bcc793a831e740 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Wed, 12 Jun 2019 12:55:12 -0500 Subject: Fix for HDFFV-10800 H5Ocopy failure: The value for the H5F_LIBVER_V18 index in H5O_fill_ver_bounds[], the format version bounds array for fill value message, should be version 3 not 2. --- MANIFEST | 1 + release_docs/RELEASE.txt | 11 +++++++ src/H5Ofill.c | 2 +- test/CMakeTests.cmake | 1 + test/fill18.h5 | Bin 0 -> 3479 bytes test/objcopy.c | 9 ++--- test/tfile.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 103 insertions(+), 5 deletions(-) create mode 100644 test/fill18.h5 diff --git a/MANIFEST b/MANIFEST index c3dc0e9..c563f4c 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1009,6 +1009,7 @@ ./test/file_image.c ./test/file_image_core_test.h5 ./test/fill_old.h5 +./test/fill18.h5 ./test/fillval.c ./test/filter_fail.c ./test/filter_plugin.c diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 649ae24..f59784d 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -256,6 +256,17 @@ Bug Fixes since HDF5-1.10.3 release Library ------- + - H5Ocopy a dataset in a 1.8 library file created with the latest format + + When H5Ocopy the dataset in the 1.8 library file to a 1.10 library file + created with (v18, v18) version bounds, the library fails with error stack + indicating that the fill value message version is out of bounds. + + The value for the H5F_LIBVER_V18 index in H5O_fill_ver_bounds[], the format + version bounds array for fill value message, should be version 3 not 2. + + (VC - 2019/6/11, HDFFV-10800) + - Fixed a bug that would cause an error or cause fill values to be incorrectly read from a chunked dataset using the "single chunk" index if the data was held in cache and there was no data on disk. diff --git a/src/H5Ofill.c b/src/H5Ofill.c index d87dc84..53abff3 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -156,7 +156,7 @@ const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{ /* Format version bounds for fill value */ const unsigned H5O_fill_ver_bounds[] = { H5O_FILL_VERSION_1, /* H5F_LIBVER_EARLIEST */ - H5O_FILL_VERSION_2, /* H5F_LIBVER_V18 */ + H5O_FILL_VERSION_3, /* H5F_LIBVER_V18 */ H5O_FILL_VERSION_3, /* H5F_LIBVER_V110 */ H5O_FILL_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 3e6add0..d9172ce 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -158,6 +158,7 @@ set (HDF5_REFERENCE_TEST_FILES filespace_1_6.h5 filespace_1_8.h5 fill_old.h5 + fill18.h5 filter_error.h5 fsm_aggr_nopersist.h5 fsm_aggr_persist.h5 diff --git a/test/fill18.h5 b/test/fill18.h5 new file mode 100644 index 0000000..c092f59 Binary files /dev/null and b/test/fill18.h5 differ diff --git a/test/objcopy.c b/test/objcopy.c index df1c0e4..e35eea3 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -2136,7 +2136,7 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) char src_fname[NAME_BUF_SIZE]; /* Name of source file */ char dst_fname[NAME_BUF_SIZE]; /* Name of destination file */ H5F_libver_t low, high; /* File format bounds */ - unsigned srcdset_fillversion; /* Fill version of source dataset */ + unsigned srcdset_layoutversion; /* Layout version of source dataset */ int i, j; /* Local index variables */ H5D_t *dsetp = NULL; /* Pointer to internal dset structure */ herr_t ret; /* Generic return value */ @@ -2179,7 +2179,8 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) /* Get the internal dset ptr to get the fill version for verifying later */ if ((dsetp = (H5D_t *)H5VL_object(did_src)) == NULL) TEST_ERROR - srcdset_fillversion = dsetp->shared->dcpl_cache.fill.version; + + srcdset_layoutversion = dsetp->shared->layout.version; /* Close dataspace */ if(H5Sclose(sid) < 0) TEST_ERROR @@ -2224,9 +2225,9 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) /* If copy failed, check if the failure is expected */ if (ret < 0) { - /* Failure is valid if fill version of source dataset is + /* Failure is valid if layout version of source dataset is greater than destination */ - if (srcdset_fillversion <= H5O_fill_ver_bounds[high]) + if (srcdset_layoutversion <= H5O_layout_ver_bounds[high]) TEST_ERROR /* Close the DST file before continue */ diff --git a/test/tfile.c b/test/tfile.c index 695d437..e903ea7 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -169,6 +169,15 @@ const char *FILESPACE_NAME[] = { NULL }; + +/* Declarations for test_libver_bounds_copy(): */ +/* SRC_FILE: source file created under 1.8 branch with latest format */ +/* DST_FILE: destination file for copying the dataset in SRC_FILE */ +/* DSET_DS1: the dataset created in SRC_FILE to be copied to DST_FILE */ +#define SRC_FILE "fill18.h5" +#define DST_FILE "fill18_copy.h5" +#define DSET_DS1 "DS1" + /* Local test function declarations for version bounds */ static void test_libver_bounds_low_high(void); static void test_libver_bounds_super(hid_t fapl); @@ -5277,6 +5286,79 @@ test_libver_bounds_open(void) } /* end test_libver_bounds_open() */ +/*------------------------------------------------------------------------- + * Function: test_libver_bounds_copy + * + * Purpose: Test to verify HDFFV-10800 is fixed: + * This test is copied from the user test program: copy10.c. + * (See attached programs in the jira issue.) + * + * The source file used in the test is generated by the user test + * program "fill18.c" with the 1.8 library. The file is created + * with the latest format and the dataset created in the file + * has version 3 fill value message (latest). + * + * The test creates the destination file with (v18, v18) version bounds. + * H5Ocopy() should succeed in copying the dataset in the source file + * to the destination file. + * + * Return: Success: 0 + * Failure: number of errors + * + *------------------------------------------------------------------------- + */ +static void +test_libver_bounds_copy(void) +{ + hid_t src_fid = -1; /* File ID */ + hid_t dst_fid = -1; /* File ID */ + hid_t fapl = -1; /* File access property list ID */ + const char *src_fname; /* Source file name */ + herr_t ret; /* Generic return value */ + + /* Output message about the test being performed */ + MESSAGE(5, ("Testing H5Ocopy a dataset in a 1.8 library file to a 1.10 library file\n")); + + /* Get the test file name */ + src_fname = H5_get_srcdir_filename(SRC_FILE); + + /* Open the source test file */ + src_fid = H5Fopen(src_fname, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(src_fid, FAIL, "H5Fopen"); + + /* Create file access property list */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, FAIL, "H5Pcreate"); + + /* Set library version bounds to (v18, v18) */ + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_V18); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + + /* Create the destination file with the fapl */ + dst_fid = H5Fcreate(DST_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + CHECK(dst_fid, FAIL, "H5Pcreate"); + + /* Close the fapl */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + + /* Copy the dataset in the source file to the destination file */ + ret = H5Ocopy(src_fid, DSET_DS1, dst_fid, DSET_DS1, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret, SUCCEED, "H5Ocopy"); + + /* Close the source file */ + ret = H5Fclose(src_fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* Close the destination file */ + ret = H5Fclose(dst_fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* Remove the destination file */ + HDremove(DST_FILE); + +} /* end test_libver_bounds_copy() */ + /**************************************************************** ** ** test_libver_bounds(): @@ -5295,6 +5377,7 @@ test_libver_bounds(void) test_libver_bounds_real(H5F_LIBVER_EARLIEST, 1, H5F_LIBVER_LATEST, 2); test_libver_bounds_real(H5F_LIBVER_LATEST, 2, H5F_LIBVER_EARLIEST, 2); test_libver_bounds_open(); + test_libver_bounds_copy(); } /* end test_libver_bounds() */ /************************************************************************************** @@ -7690,5 +7773,6 @@ cleanup_file(void) HDremove(FILE5); HDremove(FILE6); HDremove(FILE7); + HDremove(DST_FILE); } -- cgit v0.12 From dfdc27b04b2e8bcd1985ba90ce6553d8b3805fda Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Fri, 14 Jun 2019 12:33:07 -0500 Subject: Fix release notes based on feedback from pull request. --- release_docs/RELEASE.txt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index f59784d..069f385 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -256,16 +256,18 @@ Bug Fixes since HDF5-1.10.3 release Library ------- - - H5Ocopy a dataset in a 1.8 library file created with the latest format + - Fixed an issue where copying a version 1.8 dataset between files using + H5Ocopy fails due to an incompatible fill version - When H5Ocopy the dataset in the 1.8 library file to a 1.10 library file - created with (v18, v18) version bounds, the library fails with error stack - indicating that the fill value message version is out of bounds. + When using the HDF5 1.10.x H5Ocopy() API call to copy a version 1.8 + dataset to a file created with both high and low library bounds set to + H5F_LIBVER_V18, the H5Ocopy() call will fail with the error stack indicating + that the fill value version is out of bounds. - The value for the H5F_LIBVER_V18 index in H5O_fill_ver_bounds[], the format - version bounds array for fill value message, should be version 3 not 2. + This was fixed by changing the fill value message version to H5O_FILL_VERSION_3 + (from H5O_FILL_VERSION_2) for H5F_LIBVER_V18. - (VC - 2019/6/11, HDFFV-10800) + (VC - 2019/6/14, HDFFV-10800) - Fixed a bug that would cause an error or cause fill values to be incorrectly read from a chunked dataset using the "single chunk" index if -- cgit v0.12