summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--release_docs/RELEASE.txt2
-rw-r--r--src/H5L.c3
-rw-r--r--test/links.c76
3 files changed, 77 insertions, 4 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index d036d56..3a53feb 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -142,6 +142,8 @@ Bug Fixes since HDF5-1.8.0 release
Library
-------
+ - Fixed a bug that prevented external links from working after calling
+ H5close(). (NAF - 2009/04/10 - 1539)
- Modified library to write cached symbol table information to the
superblock, to allow library versions 1.3.0 to 1.6.3 to read files
created by this version. (NAF - 2009/04/08 - 1423)
diff --git a/src/H5L.c b/src/H5L.c
index 7066acc..0de2e10 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -286,6 +286,9 @@ H5L_term_interface(void)
H5L_table_g = (H5L_class_t *)H5MM_xfree(H5L_table_g);
H5L_table_used_g = H5L_table_alloc_g = 0;
+ /* Mark the interface as uninitialized */
+ H5_interface_initialize_g = 0;
+
FUNC_LEAVE_NOAPI(n)
} /* H5L_term_interface() */
diff --git a/test/links.c b/test/links.c
index d9e9b52..1d64dd9 100644
--- a/test/links.c
+++ b/test/links.c
@@ -81,6 +81,7 @@ const char *FILENAME[] = {
"extlinks18B", /* 41: */
"extlinks19A", /* 42: */
"extlinks19B", /* 43: */
+ "extlinks20", /* 44: */
NULL
};
@@ -131,6 +132,7 @@ const char *FILENAME[] = {
"extlinks18B", /* 41: */
"extlinks19A", /* 42: */
"extlinks19B", /* 43: */
+ "extlinks20", /* 44: */
NULL
};
@@ -4218,8 +4220,8 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format)
if (H5Pset_fapl_family(fam_fapl, op_data.fam_size, op_data.base_fapl) < 0) TEST_ERROR
/* Create parent and target files, group, and external link */
- h5_fixname(FILENAME[40], fapl, filename1, sizeof filename1);
- h5_fixname(FILENAME[41], fam_fapl, filename2, sizeof filename2);
+ h5_fixname(FILENAME[42], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[43], fam_fapl, filename2, sizeof filename2);
if ((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
if ((file2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fam_fapl)) < 0) TEST_ERROR
if ((group = H5Gcreate2(file1, "group1",H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -4297,6 +4299,67 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format)
} /* end external_set_elink_cb() */
+/*-------------------------------------------------------------------------
+ * Function: external_reset_register
+ *
+ * Purpose: Check that external links are registered after the library
+ * is reset.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Neil Fortner
+ * Apr. 9, 2009
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+external_reset_register(void)
+{
+ hid_t file;
+ char filename[NAME_BUF_SIZE];
+
+ TESTING("external links are registered after reset")
+
+ /* Create and close file */
+ h5_fixname(FILENAME[44], H5P_DEFAULT, filename, sizeof filename);
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if (H5Fclose(file) < 0) TEST_ERROR
+
+ /* Reset the library */
+ H5close();
+
+ /* Re open file */
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Create an external link */
+ if (H5Lcreate_external("some_file", "some_obj", file, "ext_link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Close file */
+ if (H5Fclose(file) < 0) TEST_ERROR
+
+ /* Try again to make sure the previous H5Lcreate_external call does not
+ * affect the ability to reset */
+ H5close();
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR
+ if (H5Lcreate_external("another_file", "another_obj", file, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Fclose(file) < 0) TEST_ERROR
+
+ if(HDremove(filename) != 0) TEST_ERROR
+
+ PASSED();
+ return 0;
+
+ error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return -1;
+} /* end external_reset_register() */
+
+
#ifdef H5_HAVE_WINDOW_PATH
/*-------------------------------------------------------------------------
@@ -12761,6 +12824,13 @@ main(void)
/* Close 2nd FAPL */
H5Pclose(fapl2);
+ h5_cleanup(FILENAME, fapl);
+
+ /* Test that external links can be used after a library reset. MUST be
+ * called last so the reset doesn't interfere with the property lists. This
+ * routine will delete its own file. */
+ nerrors += external_reset_register() < 0 ? 1 : 0;
+
/* Results */
if(nerrors) {
printf("***** %d LINK TEST%s FAILED! *****\n",
@@ -12769,8 +12839,6 @@ main(void)
}
printf("All link tests passed.\n");
- h5_cleanup(FILENAME, fapl);
-
/* clean up tmp directory created by external link tests */
HDrmdir(TMPDIR);