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

Link creation order not stored for file #5183

Open
MarDiehl opened this issue Dec 17, 2024 · 5 comments
Open

Link creation order not stored for file #5183

MarDiehl opened this issue Dec 17, 2024 · 5 comments
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

@MarDiehl
Copy link

Bug
The information whether a file was created with h5p_crt_order_indexed and h5p_crt_order_tracked is not (or only partially) stored. This means that H5Pget_link_creation_order does not report those values to be set if a file is re-opened. For groups, the information is stored. Note that HDFView still sorts the data in the file/base_group if it was created with order_tracked/order_indexed but in agreement with the Fortran library reports that order was not tracked.

Expected behavior
I would expect the same behavior as for groups: If a file was created with with h5p_crt_order_indexed and h5p_crt_order_tracked, this information should be stored and H5Pget_link_creation_order reports that the flags are set when opening the file again later.

Platform (please complete the following information)

Additional context
Initially, I thought that this was an HDFView issue and opened HDFGroup/hdfview#347

Code to Reproduce

sort_file_f90.txt: run to create 2 files
print_file_py.txt: print order in Python
get_status_file_f90.txt: get status in Fortran

sort_group_f90.txt: run to create 2 groups
print_group_py.txt: print order in Python
get_status_group_f90.txt: get status in Fortran

@fortnern
Copy link
Member

Does this problem occur if you only use one language? If so would you be able to send a reproducer in a single language (ideally C)?

@MarDiehl
Copy link
Author

yes, it occurs for Fortran only. Writing and reading to file is just split over two programs. Unfortunately, my C skills are not that good, but I can merge the code into one reproducer if that helps.

@MarDiehl
Copy link
Author

Here's a small reproducer. I compile with

gfortran write_file_and_check.f90 -lhdf5_fortran -I/usr/include

write_file_and_check_f90.txt

MarDiehl added a commit to damask-multiphysics/DAMASK that referenced this issue Dec 19, 2024
this results in correct ordering for increments in HDFView (which are by default
mixed up due to alphanumeric ordering). Note that the status is wrongly
reported:
- HDFGroup/hdfview#347
- HDFGroup/hdf5#5183
@hyoklee hyoklee added the Component - Fortran Fortran wrappers label Dec 19, 2024
@brtnfld brtnfld added Priority - 1. High 🔼 These are important issues that should be resolved in the next release Component - C Library Core C library issues (usually in the src directory) Type - Bug / Bugfix Please report security issues to [email protected] instead of creating an issue on GitHub Confirmed and removed Component - Fortran Fortran wrappers labels Dec 23, 2024
@brtnfld brtnfld assigned vchoi-hdfgroup and unassigned brtnfld Dec 23, 2024
@brtnfld
Copy link
Contributor

brtnfld commented Dec 23, 2024

Thank you for the report and reproducer; they were very helpful. I've confirmed this is a bug in the C library, but it was not because the information was not stored in the file. If you would like a workaround, you can instead do:

 CALL H5Fopen_f(filename, H5F_ACC_RDWR_F, file_id, error)
 CALL H5Gopen_f(file_id, ".", group_id, error)
 CALL H5Gget_create_plist_f(group_id, plist_id, error)
 CALL H5Pget_link_creation_order_f(plist_id, corder,error)

@brtnfld brtnfld added this to the 2.0.0 milestone Dec 23, 2024
@MarDiehl
Copy link
Author

Thank you for the report and reproducer; they were very helpful. I've confirmed this is a bug in the C library ..

Thank you. For picking this up and HDF5 in general!

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

No branches or pull requests

5 participants