Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Conversation

@1uc
Copy link
Collaborator

@1uc 1uc commented Nov 2, 2024

See #1054. Essentially, it seems that fixed-length strings that have a padding mode that suggests they're null-terminated are in fact not required to be null-terminated. HDF5 will create such string, h5dump will display the file and h5py will read the string.

HighFive will continue to not allow writing null-terminated strings that aren't. This PR proposes that it should allow reading such strings into std::string.

@codecov
Copy link

codecov bot commented Nov 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.09%. Comparing base (9d4c77e) to head (f3885ca).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1056      +/-   ##
==========================================
+ Coverage   87.06%   87.09%   +0.03%     
==========================================
  Files         101      101              
  Lines        6091     6108      +17     
==========================================
+ Hits         5303     5320      +17     
  Misses        788      788              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@1uc 1uc force-pushed the 1uc/not-so-null-terminated branch from 07f5db1 to f3885ca Compare November 3, 2024 11:23
@1uc 1uc marked this pull request as ready for review November 4, 2024 09:13
@1uc 1uc merged commit 61f5152 into master Nov 4, 2024
@1uc 1uc deleted the 1uc/not-so-null-terminated branch November 4, 2024 09:22
1uc added a commit that referenced this pull request Nov 28, 2024
For fixed-length strings that have a padding mode that suggests they're
null-terminated are in fact not required to be null-terminated, we (silently)
fail to read the last character. Since, HDF5 will create such string, h5dump
will display the file and h5py will read the string; we opted to allow it and
also read the string into and `std::string` (which is variable length and already
not guaranteed to have the same length as the fixed length string).

HighFive will continue to not allow writing null-terminated strings that aren't
via `write`.

Backports: (#1056)
1uc added a commit that referenced this pull request Nov 28, 2024
For fixed-length strings that have a padding mode that suggests they're
null-terminated are in fact not required to be null-terminated, we (silently)
fail to read the last character. Since, HDF5 will create such string, h5dump
will display the file and h5py will read the string; we opted to allow it and
also read the string into and `std::string` (which is variable length and already
not guaranteed to have the same length as the fixed length string).

HighFive will continue to not allow writing null-terminated strings that aren't
via `write`.

Backports: (#1056)
1uc added a commit that referenced this pull request Dec 2, 2024
* backport: Allow reading not-quite null-terminated strings.

For fixed-length strings that have a padding mode that suggests they're
null-terminated are in fact not required to be null-terminated, we (silently)
fail to read the last character. Since, HDF5 will create such string, h5dump
will display the file and h5py will read the string; we opted to allow it and
also read the string into and `std::string` (which is variable length and already
not guaranteed to have the same length as the fixed length string).

HighFive will continue to not allow writing null-terminated strings that aren't
via `write`.

* backport:  Fix off-by-one in char_buffer_length.

Backports: (#1056), ( #1060)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants