Skip to content

Commit

Permalink
Fixed H5Ovisit2() change of behavior between 1.10.11 and v1.14.4.3
Browse files Browse the repository at this point in the history
H5O__visit() uses the object information to be returned to the                 application, so when the application did not request for certain               information, they were not available to H5O__visit.  This lack of              information caused incorrect behavior down the road.                                                                                                          We now call H5O_get_info again providing H5O_INFO_BASIC for "fields",          so we can obtain correct object information for H5O__visit to use.                                                                                            Fixes HDFGroupGH-4941
  • Loading branch information
bmribler committed Oct 28, 2024
1 parent 97420ea commit fbd2ffd
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/H5Oint.c
Original file line number Diff line number Diff line change
Expand Up @@ -2623,6 +2623,7 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_or
H5O_loc_t obj_oloc; /* Opened object object location */
bool loc_found = false; /* Entry at 'name' found */
H5O_info2_t oinfo; /* Object info struct */
H5O_info2_t int_oinfo; /* Internal object info */
void *obj = NULL; /* Object */
H5I_type_t opened_type; /* ID type of object */
hid_t obj_id = H5I_INVALID_HID; /* ID of object */
Expand Down Expand Up @@ -2650,6 +2651,10 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_or
if (H5O_get_info(&obj_oloc, &oinfo, fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info");

/* Get the object's basic info for local use */
if (H5O_get_info(&obj_oloc, &int_oinfo, H5O_INFO_BASIC) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object's basic info");

/* Open the object */
/* (Takes ownership of the obj_loc information) */
if (NULL == (obj = H5O_open_by_loc(&obj_loc, &opened_type)))
Expand All @@ -2668,7 +2673,7 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_or
HGOTO_DONE(ret_value);

/* Check for object being a group */
if (oinfo.type == H5O_TYPE_GROUP) {
if (int_oinfo.type == H5O_TYPE_GROUP) {
H5G_loc_t start_loc; /* Location of starting group */
H5G_loc_t vis_loc; /* Location of visited group */

Expand All @@ -2689,18 +2694,18 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_or

/* If its ref count is > 1, we add it to the list of visited objects */
/* (because it could come up again during traversal) */
if (oinfo.rc > 1) {
if (int_oinfo.rc > 1) {
H5_obj_t *obj_pos; /* New object node for visited list */

/* Allocate new object "position" node */
if ((obj_pos = H5FL_MALLOC(H5_obj_t)) == NULL)
HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "can't allocate object node");

/* Construct unique "position" for this object */
obj_pos->fileno = oinfo.fileno;
obj_pos->fileno = int_oinfo.fileno;

/* De-serialize object token into an object address */
if (H5VL_native_token_to_addr(loc->oloc->file, H5I_FILE, oinfo.token, &(obj_pos->addr)) < 0)
if (H5VL_native_token_to_addr(loc->oloc->file, H5I_FILE, int_oinfo.token, &(obj_pos->addr)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL,
"can't deserialize object token into address");

Expand Down

0 comments on commit fbd2ffd

Please sign in to comment.