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

Setting strict libver bounds in FAPL causes unexpected H5Fopen failures that do not occur with file switch #4849

Open
markcmiller86 opened this issue Sep 18, 2024 · 2 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

Comments

@markcmiller86
Copy link
Contributor

markcmiller86 commented Sep 18, 2024

In the code below, I compare setting setting libver bounds in FAPL used in H5Fopen to using switch to change libver bounds after the file is open.

Since the libver bounds in the fapl is intended to effect only the objects created thereafter, I am puzzled why the attempts to open a file created with libver set to LATEST then fail when FAPL sets libver to v18. I mean, shouldn't the open succeed and then behave as if H5Fset_libver_bounds() was called. Its particularly strange in the read-only case because no objects will be created under those conditions and the libver setting is kinda meaningless.

#include <hdf5.h>
  
int main(int argc, char **argv)
{
    hid_t fapl1 = H5Pcreate(H5P_FILE_ACCESS);
    hid_t fapl2 = H5Pcreate(H5P_FILE_ACCESS);
    hid_t fapl3 = H5Pcreate(H5P_FILE_ACCESS);

    H5Pset_libver_bounds(fapl1, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
    hid_t fid = H5Fcreate("foo.hdf5", H5F_ACC_TRUNC, H5P_DEFAULT, fapl1);
    H5Pclose(fapl1);
    H5Fclose(fid);

    /* fails in read-write mode */
    H5Pset_libver_bounds(fapl2, H5F_LIBVER_V18, H5F_LIBVER_V18);
    fid = H5Fopen("foo.hdf5", H5F_ACC_RDWR, fapl2);
    H5Fclose(fid);

    /* fails in read-only mode */
    fid = H5Fopen("foo.hdf5", H5F_ACC_RDONLY, fapl2);
    H5Fclose(fid);
    H5Pclose(fapl2);

    /* But, this works fine */
    fid = H5Fopen("foo.hdf5", H5F_ACC_RDWR, fapl3);
    H5Fset_libver_bounds(fid, H5F_LIBVER_V18, H5F_LIBVER_V18);
    H5Pclose(fapl3);
    H5Fclose(fid);

    return 0;
}
@markcmiller86 markcmiller86 changed the title Setting strict libver bounds in FAPL causes unexpected H5Fopen failures that do not occur with Setting strict libver bounds in FAPL causes unexpected H5Fopen failures that do not occur with file switch Sep 18, 2024
@markcmiller86
Copy link
Contributor Author

I believe that if you reverse the ordering of the libver settings and instead create file using a fapl with libver v18 in both high and low and then attempt to open it with a fapl that sets libver to latest, that also fails.

@bmribler bmribler 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) Confirmed labels Sep 18, 2024
@markcmiller86
Copy link
Contributor Author

Just one other observation to share here and that is that the libver bounds property is associated with file access, not file creation properties. Therefere, I would NOT expect it to have affected the file creation. Furthermore, the documentation regarding setting of libver bounds (in props or on an open file) does not speak specifically to file creation...only object creation in a file.

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
Projects
None yet
Development

No branches or pull requests

3 participants