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

H5Ovisit2 change of behavior between 1.10.11 and v1.14.4.3 #4941

Closed
abhibaruah opened this issue Oct 9, 2024 · 0 comments · Fixed by #5022
Closed

H5Ovisit2 change of behavior between 1.10.11 and v1.14.4.3 #4941

abhibaruah opened this issue Oct 9, 2024 · 0 comments · Fixed by #5022
Assignees
Labels
Component - C Library Core C library issues (usually in the src directory) Confirmed 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
Milestone

Comments

@abhibaruah
Copy link

Platform (please complete the following information)

  • HDF5 version - 1.14.4.3
  • OS and version - Debian 12
  • Compiler and version - gcc

I noticed that there is a change of behavior in H5Ovisit2 between HDF5 versions 1.10.11 and 1.14.4.3.
I wanted to check if this is intended behavior, or a bug introduced in any of the versions after 1.10.11.

I also see the same behavior with H5Ovisit_by_name2.
We are also compiling the application with the compatibility flag “-DH5_USE_18_API” to preserve 1.8 function mapping.
I have created a simplified reproduction of the tests on our end and am attaching it. The h5 file I used for the repro can be found here.

Output from 1.10.11:
H5Ovisit_func
.
144115188075855873
H5Ovisit_func
g1
144115188075855873
H5Ovisit_func
g1/g2
144115188075855873
H5Ovisit_func
g1/g2/myDataset
144115188075855873
Status: 0

Output from 1.14.4.3
H5Ovisit_func
.
144115188075855873
Status: 0

Even though the H5Ovisit2 documentation mentions it is “a recursive iteration function to visit the object obj_id and, if obj_id is a group, all objects in and below it in an HDF5 file,…”, for 1.14.4.3, it seems like the function visits only the root group and not all the nested groups.

#include "hdf5.h"
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include "string.h"

#define FILE1           "testfile.h5"

herr_t H5Ovisit_func(hid_t obj_id, const char* name, const H5O_info_t *info, void* opdata) {
    std::cout << "H5Ovisit_func" << std::endl;
    std::cout << name << std::endl;

    std::cout << obj_id << std::endl;
    return (0);
}

int main() {
  hid_t           file_id;    /* Handles */
  herr_t          status;
  

  /*
    * Create a new file using the default properties.
    */
  file_id = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT);

// Open root object
  hid_t obj_id = H5Oopen(file_id, "/", H5P_DEFAULT);

  // Visit root
  H5_index_t idx_type = H5_INDEX_NAME;
  H5_iter_order_t order = H5_ITER_DEC;
  void* opdata = (void*)0;
  unsigned fields = H5O_INFO_META_SIZE;

  // Visit the root group
  status = H5Ovisit2(obj_id, idx_type, order, H5Ovisit_func, opdata, fields);
  std::cout << "Status: " << status << std::endl;



  // Close objects
  H5Oclose(obj_id);
  status = H5Fclose(file_id);

	return 0;
}


@bmribler bmribler added Priority - 0. Blocker ⛔ This MUST be merged for the release to happen Component - C Library Core C library issues (usually in the src directory) UNCONFIRMED New issues are unconfirmed until a maintainer can duplicate them labels Oct 9, 2024
@bmribler bmribler self-assigned this Oct 9, 2024
@bmribler bmribler added Confirmed Merge - To 2.0 and removed UNCONFIRMED New issues are unconfirmed until a maintainer can duplicate them labels Oct 12, 2024
@derobins derobins added Priority - 1. High 🔼 These are important issues that should be resolved in the next release and removed Merge - To 2.0 Priority - 0. Blocker ⛔ This MUST be merged for the release to happen labels Oct 15, 2024
@derobins derobins added this to the 2.0.0 milestone Oct 15, 2024
bmribler added a commit to bmribler/hdf5_bmr23 that referenced this issue Oct 28, 2024
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
bmribler added a commit to bmribler/hdf5_bmr23 that referenced this issue Oct 30, 2024
@derobins derobins added the Type - Bug / Bugfix Please report security issues to [email protected] instead of creating an issue on GitHub label Nov 4, 2024
brtnfld pushed a commit to brtnfld/hdf5 that referenced this issue 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 issue 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) Confirmed 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 a pull request may close this issue.

3 participants