Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove another couple of H5E_clear_stack calls #4968

Merged
merged 15 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions release_docs/RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ Bug Fixes since HDF5-1.16.0 release
===================================
Library
-------
- Fixed a bug in the H5Oexists and H5Oexists_by_name API routines that
would cause those routines to return FAIL instead of FALSE when checking
the existence of a non-existent object with a file ID instead of a
group ID.

- Only clear FE_INVALID when that symbol is present on the system

When we initialize the floating-point types at library startup, it's
Expand Down
26 changes: 15 additions & 11 deletions src/H5Dvirtual.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,25 +890,26 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *vir

if (src_file) {
H5G_loc_t src_root_loc; /* Object location of source file root group */
bool exists = false;

/* Set up the root group in the destination file */
if (NULL == (src_root_loc.oloc = H5G_oloc(H5G_rootof(src_file))))
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to get object location for root group");
if (NULL == (src_root_loc.path = H5G_nameof(H5G_rootof(src_file))))
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to get path for root group");

/* Try opening the source dataset */
source_dset->dset = H5D__open_name(&src_root_loc, source_dset->dset_name,
vdset->shared->layout.storage.u.virt.source_dapl);
/* Check if the source dataset exists */
if (H5G_loc_exists(&src_root_loc, source_dset->dset_name, &exists /*out*/) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFIND, FAIL, "can't check object's existence");

/* Dataset does not exist */
if (NULL == source_dset->dset) {
/* Reset the error stack */
H5E_clear_stack();
/* Dataset exists */
if (exists) {
/* Try opening the source dataset */
if (NULL ==
(source_dset->dset = H5D__open_name(&src_root_loc, source_dset->dset_name,
vdset->shared->layout.storage.u.virt.source_dapl)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset");

source_dset->dset_exists = false;
} /* end if */
else {
/* Dataset exists */
source_dset->dset_exists = true;

Expand All @@ -919,7 +920,10 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *vir
virtual_ent->source_space_status = H5O_VIRTUAL_STATUS_CORRECT;
} /* end if */
} /* end else */
} /* end if */
else
/* Dataset does not exist */
source_dset->dset_exists = false;
} /* end if */

done:
/* Release resources */
Expand Down
13 changes: 4 additions & 9 deletions src/H5Gloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,26 +581,21 @@ H5G__loc_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_
const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/,
H5G_own_loc_t *own_loc /*out*/)
{
bool *exists = (bool *)_udata; /* User data passed in */
herr_t ret_value = SUCCEED; /* Return value */
bool *exists = (bool *)_udata; /* User data passed in */

FUNC_ENTER_PACKAGE
FUNC_ENTER_PACKAGE_NOERR

/* Check if the name in this group resolved to a valid object */
if (obj_loc == NULL)
if (lnk)
*exists = false;
else
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "no object or link info?");
*exists = false;
else
*exists = true;

/* Indicate that this callback didn't take ownership of the group *
* location for the object */
*own_loc = H5G_OWN_NONE;

done:
FUNC_LEAVE_NOAPI(ret_value)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5G__loc_exists_cb() */

/*-------------------------------------------------------------------------
Expand Down
13 changes: 9 additions & 4 deletions src/H5Gtraverse.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc /*in,out*/, const H5O_link_t *lnk, H5G
if ((cur_grp = H5VL_wrap_register(H5I_GROUP, grp, false)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group");

/* User-defined callback function */
/* Pause recording errors, if we are just checking for object's existence */
if (target & H5G_TARGET_EXISTS)
H5E_pause_stack();

/* Invoke user-defined callback function */
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* (Backwardly compatible with v0 H5L_class_t traversal callback) */
if (link_class->version == H5L_LINK_CLASS_T_VERS_0)
Expand All @@ -194,13 +198,14 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc /*in,out*/, const H5O_link_t *lnk, H5G
H5CX_get_dxpl());
#endif /* H5_NO_DEPRECATED_SYMBOLS */

/* Resume recording errors, if we were just checking for object's existence */
if (target & H5G_TARGET_EXISTS)
H5E_resume_stack();

/* Check for failing to locate the object */
if (cb_return < 0) {
/* Check if we just needed to know if the object exists */
if (target & H5G_TARGET_EXISTS) {
/* Clear any errors from the stack */
H5E_clear_stack();

/* Indicate that the object doesn't exist */
*obj_exists = false;

Expand Down
Loading
Loading