h5rs tools, browser reader, libhdf5 header checks, plugin filters, concurrency benchmark #14
@@ -197,7 +197,23 @@ fn unopenable(path: &std::path::Path, out: &mut Out) -> std::io::Result<i32> {
|
|||||||
"no HDF5 signature at offset 0 or any power of two from 512".to_string(),
|
"no HDF5 signature at offset 0 or any power of two from 512".to_string(),
|
||||||
),
|
),
|
||||||
Ok(off) => match clawhdf5_format::superblock::Superblock::parse(&data[off..], 0) {
|
Ok(off) => match clawhdf5_format::superblock::Superblock::parse(&data[off..], 0) {
|
||||||
|
Ok(sb) => match sb.data_end(off as u64, data.len() as u64) {
|
||||||
|
Err(clawhdf5_format::error::FormatError::TruncatedFile {
|
||||||
|
stored_eof,
|
||||||
|
actual_len,
|
||||||
|
}) => (
|
||||||
|
0,
|
||||||
|
format!(
|
||||||
|
"file is truncated: the superblock's end-of-file address is \
|
||||||
|
{stored_eof:#x} but the file is {actual_len:#x} bytes long"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Say what the library refused, not just that it did.
|
||||||
|
_ => match clawhdf5::File::from_bytes(data.clone()) {
|
||||||
|
Err(e) => (off as u64, format!("file cannot be opened: {e}")),
|
||||||
Ok(_) => (off as u64, "file cannot be opened".to_string()),
|
Ok(_) => (off as u64, "file cannot be opened".to_string()),
|
||||||
|
},
|
||||||
|
},
|
||||||
Err(e) => (off as u64, format!("superblock: {e}")),
|
Err(e) => (off as u64, format!("superblock: {e}")),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -741,8 +741,11 @@ fn check_flags_a_misaligned_chunk() {
|
|||||||
let o = h5rs(&["check", &bad.to_string_lossy()]);
|
let o = h5rs(&["check", &bad.to_string_lossy()]);
|
||||||
let s = stdout(&o);
|
let s = stdout(&o);
|
||||||
assert_eq!(code(&o), 1, "{s}");
|
assert_eq!(code(&o), 1, "{s}");
|
||||||
|
// The library's chunk-index reader refuses the key first (as libhdf5
|
||||||
|
// does); either way the problem is reported against the dataset.
|
||||||
assert!(
|
assert!(
|
||||||
s.contains("/grp/gz: chunk at [103, 0] offset 103 in dimension 0 is not a multiple of the chunk size 100"),
|
s.contains("/grp/gz: chunk at [103, 0] offset 103 in dimension 0 is not a multiple of the chunk size 100")
|
||||||
|
|| s.contains("/grp/gz: chunk index (v1 B-tree): chunked read error: bad coordinate offset [103, 0] for chunk dimensions [100, 4]"),
|
||||||
"{s}"
|
"{s}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user