HDFGroup / vol-rest

HDF5 REST VOL Connector
Other
5 stars 8 forks source link

CTest: H5Ovisit bug - soft links #93

Closed jwsblokland closed 10 months ago

jwsblokland commented 11 months ago

Hello,

I found a bug in testing H5Ovisit() function. Here are the steps to reproduce the bug:

  1. I extended the H5Ovisit test by adding the following test:
        if (H5Ovisit3(file_id, H5_INDEX_NAME, H5_ITER_DEC, object_visit_callback, NULL, H5O_INFO_ALL) < 0) {
            H5_FAILED();
            printf("    H5Ovisit using file_id failed!\n");
            goto error;
        }
  2. Compile and run tests. As far I can tell, this test should not fail however it does. It fails for both the static as well as the shared version of VOL-REST.

After some investigation I found out that the call to function RV_parse_response() in the switch (iter_object_type) code block in the function RV_object_specific() (rest_vol_object.c) fails. I have the impression this RV_parse_response() fails when there are one or soft links in the links lists. If I remove the test_copy_link and test_move_link test from the link_tests tests everything works including the above mentioned H5Ovisit3(file_id, ...) test.

OS: RHEL 7.9 HDF5: 1.14.0 build using CMake VOL-REST: Build using CMake 3.26.4

jwsblokland commented 11 months ago

A moment ago, I found the problem. It turns out that the link target path in the call to H5Lcreate_soft() did not exist in both test_copy_link and test_move_link tests. After I corrected the path now the all (including the newly added test) H5Ovisit tests work. I will create a PR with this fix.

Would it be an idea to actually verify that the specified link target path exist before creating the link to it?

mattjala commented 11 months ago

H5Ovisit is expected to fail when given dangling links, but it appears that the dangling soft links in those two tests were unintentional, so this should be fixed.

Would it be an idea to actually verify that the specified link target path exist before creating the link to it?

From the Link reference page: "Unlike hard links, a soft link in an HDF5 file is allowed to dangle, meaning that the target object need not exist at the time that the link is created."

jwsblokland commented 11 months ago

Ah, thanks for the information. Clearly, my idea is not a good idea.

mattjala commented 10 months ago

Resolved by #94