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

Issue With VNAMELENMAX Constant in PDL::IO::HDF #500

Closed
a-shahba opened this issue Oct 4, 2024 · 9 comments
Closed

Issue With VNAMELENMAX Constant in PDL::IO::HDF #500

a-shahba opened this issue Oct 4, 2024 · 9 comments

Comments

@a-shahba
Copy link

a-shahba commented Oct 4, 2024

I was trying to open an HDF4 file using PDL::IO::HDF::VS package. I observed that sometime that package failed to open the file (i.e. after calling new()) method and program aborted with the this message

corrupted size vs. prev_size
Abort (core dumped)

Recognizing that this is a memory issue, after some tests, I found out that this is related to VNAMELENMAX constant defined in PDL::IO::HDF package. Old versions of HDF4 library set a 64-character limit on lengths of some names, such as vgroup class names. However, this limitation has been lifted. For instance, starting HDF4 v4.2r5, vgroup class names are no longer limited to 64 characters.

@mohawk2
Copy link
Member

mohawk2 commented Oct 4, 2024

Thanks for the report! Is there a recommended way in HDF4 to get the right size to use? And, similar to the HDF5 issue - feel like making a pull request? I'm busy fixing #498 right now.

@a-shahba
Copy link
Author

a-shahba commented Oct 4, 2024

No worries! I will work on a PR

@mohawk2
Copy link
Member

mohawk2 commented Oct 4, 2024

Great! Let me know if you need any help. Please feel free to join the IRC channel (#pdl on irc.perl.org) also.

@mohawk2
Copy link
Member

mohawk2 commented Oct 8, 2024

A thing I should have asked for when you initially reported this was for a test case. As it is, I'm guessing. Please always provide that in future.

@mohawk2
Copy link
Member

mohawk2 commented Oct 9, 2024

There is no equivalent problem with VSsetname etc, which truncates names to VSNAMELENMAX (see https://github.com/HDFGroup/hdf4/blob/d7915df8eabb39879418d546d28362975345cb8c/hdf/src/vg.c#L480-L525).

I believe the above commit fixes the problem you identified. Please could you try the latest master and see if it works OK? If not, please provide data/code so I can reproduce it here.

@mohawk2
Copy link
Member

mohawk2 commented Oct 9, 2024

Closing this. Please comment if there are problems.

@mohawk2 mohawk2 closed this as completed Oct 9, 2024
@a-shahba
Copy link
Author

@mohawk2 I tried to compile the master branch, but looks like I am missing some libraries. The unfortunate thing is that I cannot install anything on this machine. I have to ask the sys admin to do so. When the next PDL is released, I will ask the sys admin to install it and will test it out to see if the issue is truly fixed.

@mohawk2
Copy link
Member

mohawk2 commented Oct 14, 2024

@a-shahba Please can you put here a cut-down test case so I can see on my machine if the problem is rectified?

If you say what libraries are missing locally I might be able to assist. I'm a bit surprised because I am expecting you ran the code that had problems, and the library requirements for HDF haven't changed in a long time?

@a-shahba
Copy link
Author

@mohawk2 Sorry for the late reply. I could manage to compile and install the master branch and can confirm that your fix addressed the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants