feat(format): follow soft links; explicit errors for external links and external raw data
- Path resolution follows soft links in both old-style (symbol table, cache
type 2) and new-style (compact and dense Link message) groups: absolute and
relative targets, links to groups, links through links, with a depth limit
so a link cycle is NestingDepthExceeded rather than a hang. A dangling link
reports the target it could not find. Previously every soft link was
PathNotFound.
- An external link is FormatError::ExternalLinkUnsupported { filename,
object_path } instead of a misleading PathNotFound.
- Message 0x0007 (External Data Files) is now a known MessageType, and a
dataset carrying it is FormatError::ExternalDataFilesUnsupported. Such a
dataset has no data address in this file, so it would otherwise be read as
"never written" and answered with fill values — wrong data, no error.
- Dense link iteration is shared between hard-link listing and the new
symbolic-link lookup; entry listing behaviour is unchanged.
- h5py interop test for both libver settings.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
12847c6c66
commit
e38c8133bc
@@ -117,6 +117,17 @@ pub enum FormatError {
|
||||
/// A message is marked shared but was parsed without access to the file,
|
||||
/// so the reference to the real message could not be followed.
|
||||
UnresolvedSharedMessage,
|
||||
/// The dataset's raw data is stored in external files (External Data
|
||||
/// Files message), which this reader does not follow.
|
||||
ExternalDataFilesUnsupported,
|
||||
/// The path goes through an external link (a link into another file),
|
||||
/// which this reader does not follow.
|
||||
ExternalLinkUnsupported {
|
||||
/// The file the link points into.
|
||||
filename: String,
|
||||
/// The object path within that file.
|
||||
object_path: String,
|
||||
},
|
||||
/// Invalid SOHM table version.
|
||||
InvalidSohmTableVersion(u8),
|
||||
/// Invalid SOHM table signature (expected "SMTB").
|
||||
@@ -310,6 +321,18 @@ impl fmt::Display for FormatError {
|
||||
FormatError::InvalidSharedMessageVersion(v) => {
|
||||
write!(f, "invalid shared message version: {v}")
|
||||
}
|
||||
FormatError::ExternalLinkUnsupported {
|
||||
filename,
|
||||
object_path,
|
||||
} => write!(
|
||||
f,
|
||||
"path goes through an external link to {object_path} in {filename}, which is \
|
||||
not supported"
|
||||
),
|
||||
FormatError::ExternalDataFilesUnsupported => write!(
|
||||
f,
|
||||
"dataset raw data is stored in external file(s), which is not supported"
|
||||
),
|
||||
FormatError::UnresolvedSharedMessage => write!(
|
||||
f,
|
||||
"message is shared but no file data was available to resolve it"
|
||||
|
||||
Reference in New Issue
Block a user