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

Fixed H5Ovisit2() change of behavior between 1.10.11 and v1.14.4.3 #5022

Merged
merged 16 commits into from
Nov 4, 2024

Conversation

bmribler
Copy link
Contributor

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 GH-4941

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
@derobins
Copy link
Member

Does this need a note in RELEASE.txt?

@bmribler bmribler added Component - C Library Core C library issues (usually in the src directory) Merge - To 2.0 labels Oct 28, 2024
@bmribler bmribler marked this pull request as draft October 28, 2024 20:40
@bmribler bmribler requested a review from qkoziol October 30, 2024 18:23
@bmribler bmribler marked this pull request as ready for review October 30, 2024 18:24
src/H5Oint.c Outdated
@@ -2684,15 +2694,17 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_or
HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register visited object");

/* Make callback for starting object */
if ((ret_value = op(obj_id, ".", &oinfo, op_data)) < 0)
/* if ((ret_value = op(obj_id, ".", oinfop, op_data)) < 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented code

src/H5Oint.c Outdated
if ((ret_value = op(obj_id, ".", &oinfo, op_data)) < 0)
/* if ((ret_value = op(obj_id, ".", oinfop, op_data)) < 0)
*/
if ((ret_value = op(obj_id, ".", oinfop, op_data)) < 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work when the application's fields don't include BASIC. The oinfop will be pointing at the wrong struct.

You can fix it by moving the block of code with the query on the internal oinfo below this point. (I suggest below the check for H5_ITER_CONT)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, actually, it was oinfo there before I switched to oinfop, but now I see that oinfo would be the correct one. I'll switch it back unless you disagree.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would also work :-)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll note that no tests were failing when this was wrong. You should probably add a test that fails (now), so you can be certain it's working after you correct it.

Copy link
Contributor Author

@bmribler bmribler Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I did add one test that used H5O_INFO_META_SIZE, so no BASIC..., but no failure. OK, back to work... :)

lrknox
lrknox previously approved these changes Nov 1, 2024
@lrknox lrknox dismissed their stale review November 1, 2024 13:02

I think Binh-Minh is still working

@bmribler bmribler closed this Nov 2, 2024
@bmribler
Copy link
Contributor Author

bmribler commented Nov 2, 2024

Oops, I didn't mean to close it. I need to fix a mistake but I'm out right now.

@bmribler bmribler reopened this Nov 3, 2024
@derobins derobins added Priority - 1. High 🔼 These are important issues that should be resolved in the next release Type - Bug / Bugfix Please report security issues to [email protected] instead of creating an issue on GitHub and removed Merge - To 2.0 labels Nov 4, 2024
@@ -1929,6 +2088,8 @@ cleanup_h5o(void H5_ATTR_UNUSED *params)
{
h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename);
H5Fdelete(filename, H5P_DEFAULT);
h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename);
H5Fdelete(filename, H5P_DEFAULT);
Copy link
Member

@derobins derobins Nov 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this duplicated? Should this second statement be VISIT2_FILENAME?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@derobins derobins merged commit 49935f8 into HDFGroup:develop Nov 4, 2024
brtnfld pushed a commit to brtnfld/hdf5 that referenced this pull request Nov 4, 2024
…DFGroup#5022)

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 HDFGroup#4941
brtnfld pushed a commit to brtnfld/hdf5 that referenced this pull request Nov 4, 2024
…DFGroup#5022)

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 HDFGroup#4941
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - C Library Core C library issues (usually in the src directory) Priority - 1. High 🔼 These are important issues that should be resolved in the next release Type - Bug / Bugfix Please report security issues to [email protected] instead of creating an issue on GitHub
Projects
None yet
Development

Successfully merging this pull request may close these issues.

H5Ovisit2 change of behavior between 1.10.11 and v1.14.4.3
5 participants