summaryrefslogtreecommitdiffstats
path: root/src/H5Gtest.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2009-04-08 21:53:31 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2009-04-08 21:53:31 (GMT)
commitc1c58f79a865a1e4bf53949e8819f6612c2cbd93 (patch)
tree156e27bc731b365284991ea0e3cf53a1cdf5c9d6 /src/H5Gtest.c
parent659f3a77ea0f7548ed09a9624de3fe2a183f451c (diff)
downloadhdf5-c1c58f79a865a1e4bf53949e8819f6612c2cbd93.zip
hdf5-c1c58f79a865a1e4bf53949e8819f6612c2cbd93.tar.gz
hdf5-c1c58f79a865a1e4bf53949e8819f6612c2cbd93.tar.bz2
[svn-r16710] Purpose: Fix bug 1423
Description: Versions of the library between 1.3.0 and 1.6.3 have a bug which prevents them from opening any file that does not have the root group's symbol table information cached in the root group's entry in the superblock. Prior to 1.8 this was not an issue as this information was always cached. However, 1.8.0 stopped writing this information (which is not required by the file format specification), and these older versions can therefore not read files created or last written by versions 1.8.0 to 1.8.2. This fix modifies the library to once again add this information to the superblock (when using the old file format). Tested: jam, linew, smirom (h5committest)
Diffstat (limited to 'src/H5Gtest.c')
-rw-r--r--src/H5Gtest.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/H5Gtest.c b/src/H5Gtest.c
index 1f09048..f3508eb 100644
--- a/src/H5Gtest.c
+++ b/src/H5Gtest.c
@@ -550,3 +550,59 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5G_user_path_test() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_verify_cached_stab_test
+ *
+ * Purpose: Check that a that the provided group entry contains a
+ * cached symbol table entry, that the entry matches that in
+ * the provided group's object header, and check that the
+ * addresses are valid.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Neil Fortner
+ * Mar 31, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent)
+{
+ H5O_stab_t stab; /* Symbol table */
+ H5HL_t *heap = NULL; /* Pointer to local heap */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_verify_cached_stab_test)
+
+ /* Verify that stab info is cached in ent */
+ if(ent->type != H5G_CACHED_STAB)
+ HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "symbol table information is not cached")
+
+ /* Read the symbol table message from the group */
+ if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, &stab, H5AC_ind_dxpl_id))
+ HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "unable to read symbol table message")
+
+ /* Verify that the cached symbol table info matches the symbol table message
+ * in the object header */
+ if((ent->cache.stab.btree_addr != stab.btree_addr)
+ || (ent->cache.stab.heap_addr != stab.heap_addr))
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "cached stab info does not match object header")
+
+ /* Verify that the btree address is valid */
+ if(H5B_valid(grp_oloc->file, H5AC_ind_dxpl_id, H5B_SNODE, stab.btree_addr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "b-tree address is invalid")
+
+ /* Verify that the heap address is valid */
+ if(NULL == (heap = H5HL_protect(grp_oloc->file, H5AC_ind_dxpl_id, stab.heap_addr, H5AC_READ)))
+ HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "heap address is invalid")
+
+done:
+ /* Release resources */
+ if(heap && H5HL_unprotect(grp_oloc->file, H5AC_ind_dxpl_id, heap, stab.heap_addr) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_verify_cached_stab_test() */
+