summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Kim <jkm@hdfgroup.org>2011-10-24 21:50:13 (GMT)
committerJonathan Kim <jkm@hdfgroup.org>2011-10-24 21:50:13 (GMT)
commite54d15a26ca33a093730861b517604b9305faf67 (patch)
tree2f753d7c84b9d656a6228b9c2c8f499f0f51d447
parent1dcc75407eb48ebe0ffa3ff35087bbcb4a96c3a7 (diff)
downloadhdf5-e54d15a26ca33a093730861b517604b9305faf67.zip
hdf5-e54d15a26ca33a093730861b517604b9305faf67.tar.gz
hdf5-e54d15a26ca33a093730861b517604b9305faf67.tar.bz2
[svn-r21658] Purpose:
HDFFV-7770 - h5diff segmentation fault on JPSS files Description: Fixed segfault over non-comparable attribute with different dimention or rank, along with '-c' option to display details. Tested: jam (linux32-LE), koala (linux64-LE), heiwa (linuxppc64-BE), tejeda (mac32-LE), linew (solaris-BE), Windows, Cmake
-rw-r--r--release_docs/RELEASE.txt31
-rw-r--r--tools/h5diff/CMakeLists.txt1
-rw-r--r--tools/h5diff/h5diffgentest.c59
-rw-r--r--tools/h5diff/testfiles/h5diff_221.txt6
-rw-r--r--tools/h5diff/testfiles/h5diff_222.txt6
-rw-r--r--tools/h5diff/testfiles/non_comparables1.h5bin6408 -> 6568 bytes
-rw-r--r--tools/h5diff/testfiles/non_comparables2.h5bin6408 -> 6584 bytes
-rwxr-xr-xtools/h5diff/testh5diff.sh3
-rw-r--r--tools/lib/h5diff_attr.c4
-rw-r--r--tools/lib/h5diff_util.c31
10 files changed, 95 insertions, 46 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 528361a..844f5ab 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -624,24 +624,27 @@ Bug Fixes since HDF5-1.8.0 release
Tools
-----
- - Fixed h5diff to display all the comparable object and attribute
- regardless of non-comparables. HDFFV-7693 (JKM 09/16/2011)
- - Fixed h5repack to update values of references(object and region) of
- attributes in h5repack for 1) references, 2) ARRAY of references,
- 3) VLEN of references, and 4) COMPOUND of references.
- (JIRA HDF5 5932) PC -2011/09/14
+ - h5diff: fixed segfault over non-comparable attribute with different
+ dimention or rank, along with '-c' option to display details.
+ HDFFV-7770 (JKM 2011/10/24)
+ - Fixed h5diff to display all the comparable object and attribute
+ regardless of non-comparables. HDFFV-7693 (JKM 2011/09/16)
+ - Fixed h5repack to update values of references(object and region) of
+ attributes in h5repack for 1) references, 2) ARRAY of references,
+ 3) VLEN of references, and 4) COMPOUND of references.
+ (JIRA HDF5 5932) PC -2011/09/14
- h5diff: fixed segfault over dataset with container types
(array,lven) with multiple nested compound types.
(ex: compound->array->compound, compound->vlen->compound)
- HDFFV-7712 JKM (09/01/2011)
+ HDFFV-7712 JKM (2011/09/01)
- h5repack: added macro to handle failure in H5Dread/write when memory
allocation failed inside the library. (PC -- 2011/08/19)
- Fixed h5jam not to allow specifying an HDF5 formatted file as input
file for -u (user block file) option, because the original HDF5 file
- will not be accessible if allows. HDFFV-5941 (JKM 08/15/2011)
+ will not be accessible if allows. HDFFV-5941 (JKM 2011/08/15)
- Revised command help pages of h5jam and h5unjam. The descriptions
were not up to date and some were missing.
- HDFFV-7515 (JKM 08/15/2011)
+ HDFFV-7515 (JKM 2011/08/15)
- h5repack: h5repack failed to copy dataset if the layout is changed
from chunked with unlimited dims to contiguous. HDFFV-7649
(PC -- 2011/07/15)
@@ -650,29 +653,29 @@ Bug Fixes since HDF5-1.8.0 release
Manual. HDFFV-7656 (PC -- 2011/07/15)
- Fixed h5diff to display instructive error message and exit with 1
when mutually exclusive options (-d, -p and --use-system-epsilon)
- are used together. HDFFV-7600 (JKM 07/07/2011)
+ are used together. HDFFV-7600 (JKM 2011/07/07)
- Fixed h5dump to display the first line of each element into correct
position for multiple dimention array type.
Before this fix, the first line of each element in array were
displayed after the last line of previous element without
moving to the next line (+indentation).
- Bug #HDFFV-5878 (JKM 06/15/2011)
+ Bug #HDFFV-5878 (JKM 2011/06/15)
- Fixed h5dump to display correct value for H5T_STD_I8LE dataset
on a system (ppc64, linux, Big-Endian, clustering).
- Bug #HDFFV-7594 (ABERT & JKM 05/12/2011)
+ Bug #HDFFV-7594 (ABERT & JKM 2011/05/12)
- Fixed h5diff to compare file itself correctly. Previously h5diff
reported either different or not compatible in certain cases even
comparing file itself. This fix also improve performance when
comparing same target objects through verifying the obj&file
addresses before comparing the details in the objects (ex: datasets
- or attributes) Bug #HDFFV-5928 (XCAO & JKM 05/06/2011)
+ or attributes) Bug #HDFFV-5928 (XCAO & JKM 2011/05/06)
- Updated h5dump test case script to prevent entire test failure upon
source directory is read-only. Bug# HDFFV-4342 (JKM 2011/4/12)
- Fixed h5dump displaying incorrect values for H5T_STD_I8BE type data in
attribute on Big-Endian machine. H5T_STD_I8BE is unsigned 8bit type,
so h5dump is supposed to display -2 instead of 254. It worked
correctly on Little-Endian system , but not on Big-Endian system.
- Bug #HDFFV-4358 (JKM 04/08/2011)
+ Bug #HDFFV-4358 (JKM 2011/04/08)
- Updated to unify option name to '--enable-error-stack' for printing
HDF5 error stack messages for HDF5 tools. h5ls and h5dump for now.
For h5ls, this replaces "-e/--errors" option, which is deprecated.
diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt
index 9f45d6a..866102b 100644
--- a/tools/h5diff/CMakeLists.txt
+++ b/tools/h5diff/CMakeLists.txt
@@ -1131,6 +1131,7 @@ ADD_H5_TEST (h5diff_208 0 -c ${FILE19} ${FILE20})
ADD_H5_TEST (h5diff_220 1 -c non_comparables1.h5 non_comparables2.h5 /g1)
# comparable dataset with non-comparable attribute and other comparable attributes.
+# Also test non-compatible attributes with different type, dimention, rank.
# All the rest comparables should display differences.
ADD_H5_TEST (h5diff_221 1 -c non_comparables1.h5 non_comparables2.h5 /g2)
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index 4fd6d54..78949c8 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -4701,9 +4701,14 @@ static void test_non_comparables (const char * fname, int make_diffs)
hid_t sid1=0;
hid_t tid_dset1=0;
hid_t tid_attr1=0;
- hsize_t dims1[1] = {DIM_ARRY};
+ hsize_t dims1_1[1] = {DIM_ARRY};
+ hsize_t dims1_2[1] = {DIM_ARRY+1};
+ hsize_t dims2[2] = {DIM_ARRY, 1};
int data1[DIM_ARRY] = {0,0,0};
int data2[DIM_ARRY] = {1,1,1};
+ int data3[DIM_ARRY+1] = {1,1,1,1};
+ int data1_dim2[DIM_ARRY][1] = {0,0,0};
+ int rank_attr;
char data1_str[DIM_ARRY][STR_SIZE]= {"ab","cd","ef"};
herr_t status = SUCCEED;
int i;
@@ -4713,6 +4718,9 @@ static void test_non_comparables (const char * fname, int make_diffs)
void *attr_data_ptr1=NULL;
void *attr_data_ptr2=NULL;
void *attr_data_ptr3=NULL;
+ void *attr_data_ptr4=NULL;
+ void *attr2_dim_ptr=NULL;
+ void *attr3_dim_ptr=NULL;
/* init */
tid_dset1=H5Tcopy(H5T_NATIVE_INT);
@@ -4722,6 +4730,10 @@ static void test_non_comparables (const char * fname, int make_diffs)
tid_attr1=H5Tcopy(H5T_NATIVE_INT);
attr_data_ptr1=(int*)&data1;
attr_data_ptr3=(int*)&data1;
+ attr_data_ptr4=(int*)&data1;
+ attr2_dim_ptr=(hsize_t*)&dims1_1;
+ attr3_dim_ptr=(hsize_t*)&dims1_1;
+ rank_attr=1;
if (make_diffs)
{
@@ -4737,12 +4749,22 @@ static void test_non_comparables (const char * fname, int make_diffs)
* group2
*/
dset_data_ptr3=(int*)&data2;
- /* attr1 */
+ /* dset1/attr1 */
tid_attr1=H5Tcopy(H5T_C_S1);
H5Tset_size(tid_attr1, (size_t)STR_SIZE);
attr_data_ptr2=(char*)&data1_str;
- /* attr2 */
- attr_data_ptr3=(int*)&data2;
+
+ /* dset1/attr2 */
+ attr2_dim_ptr=(hsize_t*)&dims1_2;
+
+ /* dset1/attr3 */
+ attr_data_ptr3=(int*)&data1_dim2;
+ attr3_dim_ptr=(hsize_t*)&dims2;
+ rank_attr=2;
+
+ /* dset1/attr4 */
+ attr_data_ptr4=(int*)&data2;
+
}
@@ -4779,7 +4801,7 @@ static void test_non_comparables (const char * fname, int make_diffs)
/*-----------------------------------------------------------------------
* Datasets in /g1
*------------------------------------------------------------------------*/
- if((sid1 = H5Screate_simple(1, dims1, NULL)) < 0)
+ if((sid1 = H5Screate_simple(1, dims1_1, NULL)) < 0)
goto out;
/* dset1 */
@@ -4796,10 +4818,10 @@ static void test_non_comparables (const char * fname, int make_diffs)
status = FAIL;
goto out;
}
- write_attr(did1,1,dims1,"attr", H5T_NATIVE_INT, attr_data_ptr1);
+ write_attr(did1,1,dims1_1,"attr", H5T_NATIVE_INT, attr_data_ptr1);
/* dset2 */
- status = write_dset(gid1, 1, dims1,"dset2", H5T_NATIVE_INT, dset_data_ptr2);
+ status = write_dset(gid1, 1, dims1_1,"dset2", H5T_NATIVE_INT, dset_data_ptr2);
if (status == FAIL)
{
fprintf(stderr, "Error: %s> write_dset failed\n", fname);
@@ -4809,7 +4831,8 @@ static void test_non_comparables (const char * fname, int make_diffs)
/*-----------------------------------------------------------------------
* Datasets in /g2
*------------------------------------------------------------------------*/
- /* dset1 */
+ /* ---------
+ * dset1 */
if((did2 = H5Dcreate2(gid2, "dset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
{
fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", "dset1");
@@ -4823,14 +4846,22 @@ static void test_non_comparables (const char * fname, int make_diffs)
status = FAIL;
goto out;
}
- /* attr1 */
- write_attr(did2,1,dims1,"attr1", tid_attr1, attr_data_ptr2);
+ /* attr1 - non-compatible : different type */
+ write_attr(did2,1,dims1_1,"attr1", tid_attr1, attr_data_ptr2);
- /* attr2 */
- write_attr(did2,1,dims1,"attr2", H5T_NATIVE_INT, attr_data_ptr3);
- /* dset2 */
- status = write_dset(gid2, 1, dims1,"dset2", H5T_NATIVE_INT, dset_data_ptr3);
+ /* attr2 - non-compatible : same rank, different dimention */
+ write_attr(did2,1, attr2_dim_ptr,"attr2", H5T_NATIVE_INT, data3);
+
+ /* attr3 - non-compatible : different rank */
+ write_attr(did2, rank_attr,attr3_dim_ptr,"attr3", H5T_NATIVE_INT, attr_data_ptr3);
+
+ /* attr4 - compatible : different data values */
+ write_attr(did2,1,dims1_1,"attr4", H5T_NATIVE_INT, attr_data_ptr4);
+
+ /*----------
+ * dset2 */
+ status = write_dset(gid2, 1, dims1_1,"dset2", H5T_NATIVE_INT, dset_data_ptr3);
if (status == FAIL)
{
fprintf(stderr, "Error: %s> write_dset failed\n", fname);
diff --git a/tools/h5diff/testfiles/h5diff_221.txt b/tools/h5diff/testfiles/h5diff_221.txt
index 8f90300..621f5c3 100644
--- a/tools/h5diff/testfiles/h5diff_221.txt
+++ b/tools/h5diff/testfiles/h5diff_221.txt
@@ -1,5 +1,9 @@
Not comparable: <attr1> is of class H5T_INTEGER and <attr1> is of class H5T_STRING
-attribute: <attr2 of </g2/dset1>> and <attr2 of </g2/dset1>>
+Not comparable: <attr2> has rank 1, dimensions [3], max dimensions [3]
+and <attr2> has rank 1, dimensions [4], max dimensions [4]
+Not comparable: <attr3> has rank 1, dimensions [3], max dimensions [3]
+and <attr3> has rank 2, dimensions [3x1], max dimensions [3x1]
+attribute: <attr4 of </g2/dset1>> and <attr4 of </g2/dset1>>
3 differences found
dataset: </g2/dset1> and </g2/dset1>
6 differences found
diff --git a/tools/h5diff/testfiles/h5diff_222.txt b/tools/h5diff/testfiles/h5diff_222.txt
index 6e1bbd4..bdecb8a 100644
--- a/tools/h5diff/testfiles/h5diff_222.txt
+++ b/tools/h5diff/testfiles/h5diff_222.txt
@@ -6,7 +6,11 @@ dataset: </g1/dset1> and </g1/dset1>
dataset: </g1/dset2> and </g1/dset2>
3 differences found
Not comparable: <attr1> is of class H5T_INTEGER and <attr1> is of class H5T_STRING
-attribute: <attr2 of </g2/dset1>> and <attr2 of </g2/dset1>>
+Not comparable: <attr2> has rank 1, dimensions [3], max dimensions [3]
+and <attr2> has rank 1, dimensions [4], max dimensions [4]
+Not comparable: <attr3> has rank 1, dimensions [3], max dimensions [3]
+and <attr3> has rank 2, dimensions [3x1], max dimensions [3x1]
+attribute: <attr4 of </g2/dset1>> and <attr4 of </g2/dset1>>
3 differences found
dataset: </g2/dset1> and </g2/dset1>
6 differences found
diff --git a/tools/h5diff/testfiles/non_comparables1.h5 b/tools/h5diff/testfiles/non_comparables1.h5
index 3aa5199..71b65c8 100644
--- a/tools/h5diff/testfiles/non_comparables1.h5
+++ b/tools/h5diff/testfiles/non_comparables1.h5
Binary files differ
diff --git a/tools/h5diff/testfiles/non_comparables2.h5 b/tools/h5diff/testfiles/non_comparables2.h5
index d860625..188ceb9 100644
--- a/tools/h5diff/testfiles/non_comparables2.h5
+++ b/tools/h5diff/testfiles/non_comparables2.h5
Binary files differ
diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh
index 74ecd3a..8de12a5 100755
--- a/tools/h5diff/testh5diff.sh
+++ b/tools/h5diff/testh5diff.sh
@@ -799,7 +799,8 @@ TOOLTEST h5diff_207.txt -c h5diff_basic2.h5 h5diff_basic2.h5 g2/dset8 g2/dset9
# not comparable in dataspace of zero dimension size
TOOLTEST h5diff_208.txt -c h5diff_dset_zero_dim_size1.h5 h5diff_dset_zero_dim_size2.h5
-# non-comparable dataset with comparable attribute, and other comparable datasets.
+# non-comparable dataset with comparable attribute, and other comparable datasets.
+# Also test non-compatible attributes with different type, dimention, rank.
# All the comparables should display differences.
TOOLTEST h5diff_220.txt -c non_comparables1.h5 non_comparables2.h5 /g1
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index d9132e9..85cd01f 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -380,8 +380,10 @@ hsize_t diff_attr(hid_t loc1_id,
*----------------------------------------------------------------------
*/
+ /* pass dims1 and dims2 for maxdims as well since attribute's maxdims
+ * are always same */
if( diff_can_type(ftype1_id, ftype2_id, rank1, rank2, dims1, dims2,
- NULL, NULL, name1, name2, options, 0) != 1 )
+ dims1, dims2, name1, name2, options, 0) != 1 )
{
if(H5Tclose(ftype1_id) < 0)
goto error;
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index 6d340d9..dfdc8b3 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -35,24 +35,27 @@ print_dimensions (int rank, hsize_t *dims)
{
int i;
- if ( rank > 0 )
- {
-
- parallel_print("[" );
- for ( i = 0; i < rank-1; i++)
- {
- parallel_print(HSIZE_T_FORMAT, dims[i]);
- parallel_print("x");
- }
-
- parallel_print(HSIZE_T_FORMAT, dims[rank-1]);
- parallel_print("]" );
- }
- else
+ if ( rank <= 0 )
{
parallel_print("H5S_SCALAR" );
}
+ else
+ {
+ if (!dims)
+ parallel_print("dimension is NULL");
+ else
+ {
+ parallel_print("[");
+ for ( i = 0; i < rank-1; i++)
+ {
+ parallel_print(HSIZE_T_FORMAT, dims[i]);
+ parallel_print("x");
+ }
+ parallel_print(HSIZE_T_FORMAT, dims[rank-1]);
+ parallel_print("]" );
+ }
+ }
}