summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2023-08-02 16:28:08 (GMT)
committerGitHub <noreply@github.com>2023-08-02 16:28:08 (GMT)
commit89b4afd4b317c5131cbc8607c99d21b369d050eb (patch)
treefb2e6c99d110a7c6e40e0671aa2f24d5e96a7060 /src
parentb78729638bf69dca9e0dd86eddd530d5fc1aef40 (diff)
downloadhdf5-89b4afd4b317c5131cbc8607c99d21b369d050eb.zip
hdf5-89b4afd4b317c5131cbc8607c99d21b369d050eb.tar.gz
hdf5-89b4afd4b317c5131cbc8607c99d21b369d050eb.tar.bz2
Fix loading plugin fails with missing directory GH issue #3248 (#3324)
Diffstat (limited to 'src')
-rw-r--r--src/H5PLint.c36
-rw-r--r--src/H5PLpath.c12
-rw-r--r--src/H5PLplugin_cache.c6
-rw-r--r--src/H5PLpublic.h9
4 files changed, 44 insertions, 19 deletions
diff --git a/src/H5PLint.c b/src/H5PLint.c
index e29bc10..1b58be1 100644
--- a/src/H5PLint.c
+++ b/src/H5PLint.c
@@ -258,11 +258,17 @@ H5PL_load(H5PL_type_t type, const H5PL_key_t *key)
/* If not found, try iterating through the path table to find an appropriate plugin */
if (!found)
if (H5PL__find_plugin_in_path_table(&search_params, &found, &plugin_info) < 0)
- HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, NULL, "search in path table failed")
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, NULL,
+ "can't find plugin in the paths either set by HDF5_PLUGIN_PATH, or default location, "
+ "or set by H5PLxxx functions")
/* Set the return value we found the plugin */
if (found)
ret_value = plugin_info;
+ else
+ HGOTO_ERROR(H5E_PLUGIN, H5E_NOTFOUND, NULL,
+ "can't find plugin. Check either HDF5_PLUGIN_PATH, default location, "
+ "or path set by H5PLxxx functions")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -273,9 +279,31 @@ done:
*
* Purpose: Opens a plugin.
*
- * The success parameter will be set to TRUE and the plugin_info
- * parameter will be filled in on success. Otherwise, they
- * will be FALSE and NULL, respectively.
+ * `path` specifies the path to the plugin library file.
+ *
+ * `type` specifies the type of plugin being searched for and
+ * will be used to verify that a loaded plugin matches the
+ * type requested. H5PL_TYPE_NONE may be passed, in which case
+ * no plugin type verification is performed. This is most
+ * useful when iterating over available plugins without regard
+ * to their types.
+ *
+ * `key` specifies the information that will be used to find a
+ * specific plugin. For filter plugins, this is typically an
+ * integer identifier. For VOL connectors, this
+ * is typically either an integer identifier or a name string.
+ * After a plugin has been opened, this information will be
+ * compared against the relevant information provided by the
+ * plugin to ensure that the plugin is a match. If
+ * H5PL_TYPE_NONE is provided for `type`, then `key` should be
+ * NULL.
+ *
+ * On successful open of a plugin, the `success` parameter
+ * will be set to TRUE and the `plugin_type` and `plugin_info`
+ * parameters will be filled appropriately. On failure, the
+ * `success` parameter will be set to FALSE, the `plugin_type`
+ * parameter will be set to H5PL_TYPE_ERROR and the
+ * `plugin_info` parameter will be set to NULL.
*
* Return: SUCCEED/FAIL
*
diff --git a/src/H5PLpath.c b/src/H5PLpath.c
index a6734cb..10a668c 100644
--- a/src/H5PLpath.c
+++ b/src/H5PLpath.c
@@ -615,9 +615,9 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type
HDassert(plugin_path);
HDassert(iter_op);
- /* Open the directory */
+ /* Open the directory - skip the path if the directory can't be opened */
if (!(dirp = HDopendir(plugin_path)))
- HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, H5_ITER_ERROR, "can't open directory: %s", plugin_path)
+ HGOTO_DONE(H5_ITER_CONT);
/* Iterate through all entries in the directory */
while (NULL != (dp = HDreaddir(dirp))) {
@@ -710,7 +710,7 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type
* skip the path if the directory can't be opened */
HDsnprintf(service, sizeof(service), "%s\\*.dll", plugin_path);
if ((hFind = FindFirstFileA(service, &fdFile)) == INVALID_HANDLE_VALUE)
- HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, H5_ITER_ERROR, "can't open directory")
+ HGOTO_DONE(H5_ITER_CONT);
/* Loop over all the files */
do {
@@ -799,8 +799,7 @@ H5PL__find_plugin_in_path_table(const H5PL_search_params_t *search_params, hbool
/* Search for the plugin in this path */
if (H5PL__find_plugin_in_path(search_params, found, H5PL_paths_g[u], plugin_info) < 0)
- HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in path %s encountered an error",
- H5PL_paths_g[u])
+ HERROR(H5E_PLUGIN, H5E_CANTGET, "search in path %s encountered an error", H5PL_paths_g[u]);
/* Break out if found */
if (*found) {
@@ -852,7 +851,8 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo
/* Open the directory */
if (!(dirp = HDopendir(dir)))
- HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, FAIL, "can't open directory: %s", dir)
+ HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, FAIL, "can't open directory (%s). Please verify its existence",
+ dir)
/* Iterate through all entries in the directory */
while (NULL != (dp = HDreaddir(dirp))) {
diff --git a/src/H5PLplugin_cache.c b/src/H5PLplugin_cache.c
index cf0fd23..b74f6a1 100644
--- a/src/H5PLplugin_cache.c
+++ b/src/H5PLplugin_cache.c
@@ -273,7 +273,7 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f
/* Get the "get plugin info" function from the plugin. */
if (NULL == (get_plugin_info_function = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC(
- (H5PL_cache_g[u]).handle, "H5PLget_plugin_info")))
+ H5PL_cache_g[u].handle, "H5PLget_plugin_info")))
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info")
/* Call the "get plugin info" function */
@@ -286,9 +286,7 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f
/* No need to continue processing */
break;
-
- } /* end if */
-
+ }
} /* end for */
done:
diff --git a/src/H5PLpublic.h b/src/H5PLpublic.h
index a886375..8ef1c3e 100644
--- a/src/H5PLpublic.h
+++ b/src/H5PLpublic.h
@@ -17,8 +17,7 @@
#ifndef H5PLpublic_H
#define H5PLpublic_H
-/* Public headers needed by this file */
-#include "H5public.h" /* Generic Functions */
+#include "H5public.h" /* Generic Functions */
/*******************/
/* Public Typedefs */
@@ -93,9 +92,9 @@ H5_DLL herr_t H5PLset_loading_state(unsigned int plugin_control_mask);
* \brief Queries the loadability of dynamic plugin types
*
* \param[out] plugin_control_mask List of dynamic plugin types that are enabled or disabled.\n
- * A plugin bit set to 0 (zero) indicates that that the dynamic plugin type is
+ * A plugin bit set to 0 (zero) indicates that the dynamic plugin type is
* disabled.\n
- * A plugin bit set to 1 (one) indicates that that the dynamic plugin type is
+ * A plugin bit set to 1 (one) indicates that the dynamic plugin type is
* enabled.\n
* If the value of \p plugin_control_mask is negative, all dynamic plugin
* types are enabled.\n
@@ -103,7 +102,7 @@ H5_DLL herr_t H5PLset_loading_state(unsigned int plugin_control_mask);
* are disabled.
* \return \herr_t
*
- * \details H5PLget_loading_state() retrieves the bitmask that controls whether a certain type of plugins
+ * \details H5PLget_loading_state() retrieves the bitmask that controls whether a certain type of plugin
* (e.g.: filters, VOL drivers) will be loaded by the HDF5 library.
*
* Bit positions allocated to date are specified in \ref H5PL_type_t as follows: