From: Ben Pfaff Date: Mon, 21 Jul 2025 16:29:35 +0000 (-0700) Subject: cleanups X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=193d1e7eec20eb4804e62a7722e82d259a4e7823;p=pspp cleanups --- diff --git a/rust/Cargo.lock b/rust/Cargo.lock index fb413463d9..fbaa4822c8 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -1193,9 +1193,9 @@ checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" [[package]] name = "libz-rs-sys" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6489ca9bd760fe9642d7644e827b0c9add07df89857b0416ee15c1cc1a3b8c5a" +checksum = "172a788537a2221661b480fee8dc5f96c580eb34fa88764d3205dc356c7e4221" dependencies = [ "zlib-rs", ] @@ -2876,9 +2876,9 @@ dependencies = [ [[package]] name = "zlib-rs" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "868b928d7949e09af2f6086dfc1e01936064cc7a819253bce650d4e2a2d63ba8" +checksum = "626bd9fa9734751fc50d6060752170984d7053f5a39061f524cda68023d4db8a" [[package]] name = "zopfli" diff --git a/rust/pspp/src/main.rs b/rust/pspp/src/main.rs index 8edd338f1e..dbd9be9f32 100644 --- a/rust/pspp/src/main.rs +++ b/rust/pspp/src/main.rs @@ -126,10 +126,10 @@ impl Convert { eprintln!("warning: {warning}"); } - let (dictionary, _, cases) = ReadOptions::new() + let (dictionary, _, cases) = ReadOptions::new(warn) .with_encoding(self.encoding) .with_password(self.password.clone()) - .open_file(&self.input, warn)? + .open_file(&self.input)? .into_parts(); // Take only the first `self.max_cases` cases. @@ -177,7 +177,7 @@ impl Convert { .with_compression(self.sys_options.compression) .write_file(&dictionary, output)?; for case in cases { - output.write_case(&case?)?; + output.write_case(case?.0.iter())?; } } } diff --git a/rust/pspp/src/sys/cooked.rs b/rust/pspp/src/sys/cooked.rs index 11a6c59a9e..2651f5fe5e 100644 --- a/rust/pspp/src/sys/cooked.rs +++ b/rust/pspp/src/sys/cooked.rs @@ -18,7 +18,7 @@ use std::{ collections::BTreeMap, fmt::{Debug, Display}, fs::File, - io::{Read, Seek}, + io::{BufRead, BufReader, Read, Seek}, ops::Range, path::Path, }; @@ -50,7 +50,7 @@ use crate::{ }, }; use anyhow::{anyhow, Error as AnyError}; -use binrw::{io::BufReader, BinRead, BinWrite}; +use binrw::{BinRead, BinWrite}; use chrono::{NaiveDate, NaiveDateTime, NaiveTime}; use encoding_rs::Encoding; use indexmap::set::MutableValues; @@ -477,8 +477,11 @@ pub enum Error { } /// Options for reading a system file. -#[derive(Default, Clone, Debug)] -pub struct ReadOptions { +#[derive(Clone, Debug)] +pub struct ReadOptions { + /// Function called to report warnings. + pub warn: F, + /// Character encoding for text in the system file. /// /// If not set, the character encoding will be determined from reading the @@ -494,11 +497,15 @@ pub struct ReadOptions { pub password: Option, } -impl ReadOptions { - /// Construct a new `ReadOptions` that initially does not specify an - /// encoding or password. - pub fn new() -> Self { - Self::default() +impl ReadOptions { + /// Construct a new `ReadOptions` that reports warnings by calling `warn` + /// and initially does not specify an encoding or password. + pub fn new(warn: F) -> Self { + Self { + warn, + encoding: None, + password: None, + } } /// Causes the file to be read using the specified `encoding`, or with a @@ -513,47 +520,56 @@ impl ReadOptions { Self { password, ..self } } - /// Opens the file at `path`, reporting warnings using `warn`. - pub fn open_file(self, path: P, warn: F) -> Result + /// Opens the file at `path`. + pub fn open_file

(mut self, path: P) -> Result where P: AsRef, F: FnMut(AnyError), { let file = File::open(path)?; - if self.password.is_some() { + if let Some(password) = self.password.take() { // Don't create `BufReader`, because [EncryptedReader] will buffer. - self.open_reader(file, warn) + self.open_reader_encrypted(file, password) } else { - self.open_reader(BufReader::new(file), warn) + Self::open_reader_inner(BufReader::new(file), self.encoding, self.warn) } } - /// Opens the file read from `reader`, reporting warnings using `warn`. - pub fn open_reader(self, reader: R, warn: F) -> Result + /// Opens the file read from `reader`. + fn open_reader_encrypted(self, reader: R, password: String) -> Result where R: Read + Seek + 'static, F: FnMut(AnyError), { - if let Some(password) = &self.password { - Self::open_reader_inner( - EncryptedFile::new(reader)? - .unlock(password.as_bytes()) - .map_err(|_| anyhow!("Incorrect password."))?, - self.encoding, - warn, - ) + Self::open_reader_inner( + EncryptedFile::new(reader)? + .unlock(password.as_bytes()) + .map_err(|_| anyhow!("Incorrect password."))?, + self.encoding, + self.warn, + ) + } + + /// Opens the file read from `reader`. + pub fn open_reader(mut self, reader: R) -> Result + where + R: BufRead + Seek + 'static, + F: FnMut(AnyError), + { + if let Some(password) = self.password.take() { + self.open_reader_encrypted(reader, password) } else { - Self::open_reader_inner(reader, self.encoding, warn) + Self::open_reader_inner(reader, self.encoding, self.warn) } } - fn open_reader_inner( + fn open_reader_inner( reader: R, encoding: Option<&'static Encoding>, mut warn: F, ) -> Result where - R: Read + Seek + 'static, + R: BufRead + Seek + 'static, F: FnMut(AnyError), { let mut reader = Reader::new(reader, |warning| warn(warning.into()))?; diff --git a/rust/pspp/src/sys/encoding.rs b/rust/pspp/src/sys/encoding.rs index 0a2bffcf9b..29a4f9e45f 100644 --- a/rust/pspp/src/sys/encoding.rs +++ b/rust/pspp/src/sys/encoding.rs @@ -15,6 +15,8 @@ // this program. If not, see . //! Character encodings in system files. +//! +//! These are useful for reading and writing system files at a low level. use std::sync::LazyLock; diff --git a/rust/pspp/src/sys/raw.rs b/rust/pspp/src/sys/raw.rs index f37c5a7faf..60b5619f4e 100644 --- a/rust/pspp/src/sys/raw.rs +++ b/rust/pspp/src/sys/raw.rs @@ -44,14 +44,14 @@ use crate::{ }; use encoding_rs::Encoding; -use flate2::read::ZlibDecoder; +use flate2::bufread::ZlibDecoder; use smallvec::SmallVec; use std::{ borrow::Cow, cell::RefCell, collections::VecDeque, fmt::{Debug, Display, Formatter, Result as FmtResult}, - io::{empty, Error as IoError, Read, Seek, SeekFrom}, + io::{empty, BufRead, Error as IoError, Read, Seek, SeekFrom}, iter::repeat_n, mem::take, num::NonZeroU8, @@ -610,7 +610,7 @@ impl Record { warn: &mut dyn FnMut(Warning), ) -> Result, Error> where - R: Read + Seek, + R: BufRead + Seek, { let rec_type: u32 = endian.parse(read_bytes(reader)?); match rec_type { @@ -1073,34 +1073,41 @@ impl Datum { struct ZlibDecodeMultiple where - R: Read + Seek, + R: BufRead + Seek, { reader: Option>, + limit: u64, } impl ZlibDecodeMultiple where - R: Read + Seek, + R: BufRead + Seek, { - fn new(reader: R) -> ZlibDecodeMultiple { + fn new(reader: R, limit: u64) -> ZlibDecodeMultiple { ZlibDecodeMultiple { reader: Some(ZlibDecoder::new(reader)), + limit, } } } impl Read for ZlibDecodeMultiple where - R: Read + Seek, + R: BufRead + Seek, { fn read(&mut self, buf: &mut [u8]) -> Result { loop { - match self.reader.as_mut().unwrap().read(buf)? { - 0 => { - let inner = self.reader.take().unwrap().into_inner(); + match self.reader.as_mut().unwrap().read(buf) { + Err(error) => return Err(error), + Ok(0) => { + let mut inner = self.reader.take().unwrap().into_inner(); + let position = inner.stream_position(); self.reader = Some(ZlibDecoder::new(inner)); + if position? >= self.limit { + return Ok(0); + } } - n => return Ok(n), + Ok(n) => return Ok(n), }; } } @@ -1108,7 +1115,7 @@ where impl Seek for ZlibDecodeMultiple where - R: Read + Seek, + R: BufRead + Seek, { fn seek(&mut self, pos: SeekFrom) -> Result { self.reader.as_mut().unwrap().get_mut().seek(pos) @@ -1125,7 +1132,7 @@ enum ReaderState { /// Reads records from a system file in their raw form. pub struct Reader<'a, R> where - R: Read + Seek + 'static, + R: BufRead + Seek + 'static, { reader: Option, warn: Box, @@ -1139,7 +1146,7 @@ where impl<'a, R> Reader<'a, R> where - R: Read + Seek + 'static, + R: BufRead + Seek + 'static, { /// Constructs a new [Reader] from the underlying `reader`. Any warnings /// encountered while reading the system file will be reported with `warn`. @@ -1182,18 +1189,19 @@ where /// Reads raw records from a system file. pub struct Records<'a, 'b, R>(&'b mut Reader<'a, R>) where - R: Read + Seek + 'static; + R: BufRead + Seek + 'static; impl<'a, 'b, R> Records<'a, 'b, R> where - R: Read + Seek + 'static, + R: BufRead + Seek + 'static, { - fn cases(&mut self) { + fn cases(&mut self, ztrailer_offset: Option) { self.0.state = ReaderState::End; self.0.cases = Some(Cases::new( self.0.reader.take().unwrap(), take(&mut self.0.var_types), &self.0.header, + ztrailer_offset, )); } @@ -1218,7 +1226,7 @@ where self.0.state = if let Some(Compression::ZLib) = self.0.header.compression { ReaderState::ZlibHeader } else { - self.cases(); + self.cases(None); ReaderState::End }; } @@ -1244,11 +1252,11 @@ where &mut self.0.warn, ) { Ok(None) => { - self.cases(); + self.cases(Some(zheader.inner.ztrailer_offset)); None } Ok(Some(ztrailer)) => { - self.cases(); + self.cases(Some(zheader.inner.ztrailer_offset)); Some(Ok(Record::ZTrailer(ztrailer))) } Err(error) => Some(Err(error)), @@ -1261,7 +1269,7 @@ where impl<'a, 'b, R> Iterator for Records<'a, 'b, R> where - R: Read + Seek + 'static, + R: BufRead + Seek + 'static, { type Item = Result; @@ -1386,13 +1394,18 @@ impl Default for Cases { } impl Cases { - fn new(reader: R, var_types: VarTypes, header: &FileHeader) -> Self + fn new( + reader: R, + var_types: VarTypes, + header: &FileHeader, + ztrailer_offset: Option, + ) -> Self where - R: Read + Seek + 'static, + R: BufRead + Seek + 'static, { Self { reader: if header.compression == Some(Compression::ZLib) { - Box::new(ZlibDecodeMultiple::new(reader)) + Box::new(ZlibDecodeMultiple::new(reader, ztrailer_offset.unwrap())) } else { Box::new(reader) }, diff --git a/rust/pspp/src/sys/raw/records.rs b/rust/pspp/src/sys/raw/records.rs index d0edb810fe..714f7b4af4 100644 --- a/rust/pspp/src/sys/raw/records.rs +++ b/rust/pspp/src/sys/raw/records.rs @@ -854,7 +854,7 @@ pub struct IntegerInfoRecord { pub inner: RawIntegerInfoRecord, } -/// Machine integer info record in [binrw] format. +/// Machine integer info record in [mod@binrw] format. #[derive(Clone, Debug, BinRead, BinWrite)] pub struct RawIntegerInfoRecord { /// Version number. @@ -2373,6 +2373,7 @@ pub struct ZHeader { pub inner: RawZHeader, } +/// A ZLIB header in a system file. #[derive(Clone, Debug, BinRead, BinWrite)] pub struct RawZHeader { /// File offset to the ZLIB data header. @@ -2417,6 +2418,7 @@ impl ZHeader { /// Error reading a [ZHeader]. #[derive(ThisError, Debug)] pub enum ZHeaderError { + /// I/O error via [mod@binrw]. #[error("{}", DisplayBinError(&.0, "ZLIB header"))] BinError(#[from] BinError), @@ -2427,9 +2429,8 @@ pub enum ZHeaderError { u64, ), - /// ZLIB header's zlib_offset is {actual:#x} instead of expected - /// {expected:#x}. - #[error("ZLIB header's zlib_offset is {actual:#x} instead of expected {expected:#x}.")] + /// zlib_offset is {actual:#x} instead of expected {expected:#x}. + #[error("zlib_offset is {actual:#x} instead of expected {expected:#x}.")] UnexpectedZHeaderOffset { /// Actual `zlib_offset`. actual: u64, @@ -2451,9 +2452,11 @@ pub struct ZTrailer { /// File offset to the start of the record. pub offset: u64, + /// The raw trailer. pub inner: RawZTrailer, } +/// A ZLIB trailer in a system file. #[binrw] #[derive(Clone, Debug)] pub struct RawZTrailer { @@ -2477,6 +2480,7 @@ pub struct RawZTrailer { } impl RawZTrailer { + /// Returns the length of the trailer when it is written, in bytes. pub fn len(&self) -> usize { 24 + self.blocks.len() * 24 } @@ -2487,7 +2491,7 @@ impl RawZTrailer { pub enum ZlibTrailerWarning { /// Wrong block size. #[error( - "ZLIB block descriptor {index} reported block size {actual:#x}, when {expected:#x} was expected." + "Block descriptor {index} reported block size {actual:#x}, when {expected:#x} was expected." )] ZlibTrailerBlockWrongSize { /// 0-based block descriptor index. @@ -2500,7 +2504,7 @@ pub enum ZlibTrailerWarning { /// Block too big. #[error( - "ZLIB block descriptor {index} reported block size {actual:#x}, when at most {max_expected:#x} was expected." + "Block descriptor {index} reported block size {actual:#x}, when at most {max_expected:#x} was expected." )] ZlibTrailerBlockTooBig { /// 0-based block descriptor index. @@ -2560,13 +2564,14 @@ impl<'a> Display for DisplayBinError<'a> { /// Error reading a [ZTrailer]. #[derive(ThisError, Debug)] pub enum ZTrailerError { + /// I/O error via [mod@binrw]. #[error("{}", DisplayBinError(&.0, "ZLIB trailer"))] BinError(#[from] BinError), /// ZLIB trailer bias {actual} is not {} as expected from file header bias. #[ error( - "ZLIB trailer bias {actual} is not {} as expected from file header bias.", + "Bias {actual} is not {} as expected from file header.", DisplayPlainF64(*expected) )] WrongZlibTrailerBias { @@ -2576,24 +2581,24 @@ pub enum ZTrailerError { expected: f64, }, - /// ZLIB trailer \"zero\" field has nonzero value {0}. - #[error("ZLIB trailer \"zero\" field has nonzero value {0}.")] + /// ZLIB trailer zero field has nonzero value {0}. + #[error("Expected zero field has nonzero value {0}.")] WrongZlibTrailerZero( /// Actual value that should have been zero. u64, ), /// ZLIB trailer specifies unexpected {0}-byte block size. - #[error("ZLIB trailer specifies unexpected {0}-byte block size.")] + #[error("Unexpected {0:x}-byte block size (expected 0x3ff000).")] WrongZlibTrailerBlockSize( /// Block size read from file. u32, ), - /// Block count in ZLIB trailer differs from expected block count calculated - /// from trailer length. + /// Block count differs from expected block count calculated from trailer + /// length. #[error( - "Block count {n_blocks} in ZLIB trailer differs from expected block count {expected_n_blocks} calculated from trailer length {ztrailer_len}." + "Block count {n_blocks} differs from expected block count {expected_n_blocks} calculated from trailer length {ztrailer_len}." )] BadZlibTrailerNBlocks { /// Number of blocks. @@ -2607,7 +2612,7 @@ pub enum ZTrailerError { /// ZLIB block descriptor reported uncompressed data offset different from /// expected. #[error( - "ZLIB block descriptor {index} reported uncompressed data offset {actual:#x}, when {expected:#x} was expected." + "Block descriptor {index} reported uncompressed data offset {actual:#x}, when {expected:#x} was expected." )] ZlibTrailerBlockWrongUncmpOfs { /// Block descriptor index. @@ -2618,10 +2623,10 @@ pub enum ZTrailerError { expected: u64, }, - /// ZLIB block descriptor {index} reported compressed data offset + /// Block descriptor {index} reported compressed data offset /// {actual:#x}, when {expected:#x} was expected. #[error( - "ZLIB block descriptor {index} reported compressed data offset {actual:#x}, when {expected:#x} was expected." + "Block descriptor {index} reported compressed data offset {actual:#x}, when {expected:#x} was expected." )] ZlibTrailerBlockWrongCmpOfs { /// Block descriptor index. @@ -2632,10 +2637,10 @@ pub enum ZTrailerError { expected: u64, }, - /// ZLIB block descriptor {index} reports compressed size {compressed_size} + /// Block descriptor {index} reports compressed size {compressed_size} /// and uncompressed size {uncompressed_size}. #[error( - "ZLIB block descriptor {index} reports compressed size {compressed_size} and uncompressed size {uncompressed_size}." + "Block descriptor {index} reports compressed size {compressed_size} and uncompressed size {uncompressed_size}." )] ZlibExpansion { /// Block descriptor index. diff --git a/rust/pspp/src/sys/test.rs b/rust/pspp/src/sys/test.rs index a5fd40b92b..722bcf04eb 100644 --- a/rust/pspp/src/sys/test.rs +++ b/rust/pspp/src/sys/test.rs @@ -16,7 +16,7 @@ use std::{ fs::File, - io::{Cursor, Read, Seek}, + io::{BufRead, BufReader, Cursor, Seek}, path::Path, sync::Arc, }; @@ -553,11 +553,11 @@ fn encrypted_file() { #[test] fn encrypted_file_without_password() { - let error = ReadOptions::new() - .open_file("src/crypto/testdata/test-encrypted.sav", |_| { - panic!(); - }) - .unwrap_err(); + let error = ReadOptions::new(|_| { + panic!(); + }) + .open_file("src/crypto/testdata/test-encrypted.sav") + .unwrap_err(); assert!(matches!( error.downcast::().unwrap().details, ErrorDetails::Encrypted @@ -569,7 +569,7 @@ fn test_raw_sysfile(name: &str) { .join("src/sys/testdata") .join(name) .with_extension("sav"); - let sysfile = File::open(&input_filename).unwrap(); + let sysfile = BufReader::new(File::open(&input_filename).unwrap()); let expected_filename = input_filename.with_extension("expected"); let expected = String::from_utf8(std::fs::read(&expected_filename).unwrap()).unwrap(); test_sysfile(sysfile, &expected, &expected_filename); @@ -612,10 +612,10 @@ fn test_sack_sysfile(name: &str) { fn test_sysfile(sysfile: R, expected: &str, expected_filename: &Path) where - R: Read + Seek + 'static, + R: BufRead + Seek + 'static, { let mut warnings = Vec::new(); - let output = match ReadOptions::new().open_reader(sysfile, |warning| warnings.push(warning)) { + let output = match ReadOptions::new(|warning| warnings.push(warning)).open_reader(sysfile) { Ok(system_file) => { let (dictionary, metadata, cases) = system_file.into_parts(); let (group, data) = metadata.to_pivot_rows(); diff --git a/rust/pspp/src/sys/testdata/zcompressed_data_bad_zheader_ofs.expected b/rust/pspp/src/sys/testdata/zcompressed_data_bad_zheader_ofs.expected index 6c8ffda947..ef5d97d1e8 100644 --- a/rust/pspp/src/sys/testdata/zcompressed_data_bad_zheader_ofs.expected +++ b/rust/pspp/src/sys/testdata/zcompressed_data_bad_zheader_ofs.expected @@ -1 +1 @@ -Error at file offsets 0x194 to 0x1a0: ZLIB header's zlib_offset is 0x0 instead of expected 0x194. +Error at file offsets 0x194 to 0x1a0: Error reading ZLIB header: zlib_offset is 0x0 instead of expected 0x194. diff --git a/rust/pspp/src/sys/testdata/zcompressed_data_bad_ztrailer_ofs.expected b/rust/pspp/src/sys/testdata/zcompressed_data_bad_ztrailer_ofs.expected index 83cbe679c8..ca2d02b3b9 100644 --- a/rust/pspp/src/sys/testdata/zcompressed_data_bad_ztrailer_ofs.expected +++ b/rust/pspp/src/sys/testdata/zcompressed_data_bad_ztrailer_ofs.expected @@ -1 +1 @@ -Error at file offsets 0x194 to 0x1a0: Impossible ztrailer_offset 0x0. +Error at file offsets 0x194 to 0x1a0: Error reading ZLIB header: Impossible ztrailer_offset 0x0. diff --git a/rust/pspp/src/sys/testdata/zcompressed_data_compressed_sizes_don_t_add_up.expected b/rust/pspp/src/sys/testdata/zcompressed_data_compressed_sizes_don_t_add_up.expected index 6b728bdfe4..b99f89055b 100644 --- a/rust/pspp/src/sys/testdata/zcompressed_data_compressed_sizes_don_t_add_up.expected +++ b/rust/pspp/src/sys/testdata/zcompressed_data_compressed_sizes_don_t_add_up.expected @@ -1 +1 @@ -Error at file offsets 0x1ac to 0x1dc: ZLIB trailer is at offset 0x205 but 0x204 would be expected from block descriptors. +Error at file offsets 0x1ac to 0x1dc: Error reading ZLIB trailer: ZLIB trailer is at offset 0x205 but 0x204 would be expected from block descriptors. diff --git a/rust/pspp/src/sys/testdata/zcompressed_data_compressed_sizes_dont_add_up.expected b/rust/pspp/src/sys/testdata/zcompressed_data_compressed_sizes_dont_add_up.expected index effe1768fb..e90459a4a9 100644 --- a/rust/pspp/src/sys/testdata/zcompressed_data_compressed_sizes_dont_add_up.expected +++ b/rust/pspp/src/sys/testdata/zcompressed_data_compressed_sizes_dont_add_up.expected @@ -1 +1 @@ -Error at file offsets 0x1dc to 0x1f4: ZLIB block descriptor 1 reported compressed data offset 0x12421, when 0x124f1 was expected. +Error at file offsets 0x1dc to 0x1f4: Error reading ZLIB trailer: Block descriptor 1 reported compressed data offset 0x12421, when 0x124f1 was expected. diff --git a/rust/pspp/src/sys/testdata/zcompressed_data_compression_expands_data_too_much.expected b/rust/pspp/src/sys/testdata/zcompressed_data_compression_expands_data_too_much.expected index 8196e26aca..3e46bb92a3 100644 --- a/rust/pspp/src/sys/testdata/zcompressed_data_compression_expands_data_too_much.expected +++ b/rust/pspp/src/sys/testdata/zcompressed_data_compression_expands_data_too_much.expected @@ -1 +1 @@ -Error at file offsets 0x1c4 to 0x1dc: ZLIB block descriptor 0 reports compressed size 100 and uncompressed size 50. +Error at file offsets 0x1c4 to 0x1dc: Error reading ZLIB trailer: Block descriptor 0 reports compressed size 100 and uncompressed size 50. diff --git a/rust/pspp/src/sys/testdata/zcompressed_data_invalid_ztrailer_len.expected b/rust/pspp/src/sys/testdata/zcompressed_data_invalid_ztrailer_len.expected index b70a425e02..d78157a697 100644 --- a/rust/pspp/src/sys/testdata/zcompressed_data_invalid_ztrailer_len.expected +++ b/rust/pspp/src/sys/testdata/zcompressed_data_invalid_ztrailer_len.expected @@ -1 +1 @@ -Error at file offsets 0x194 to 0x1a0: Invalid ZLIB trailer length 21. +Error at file offsets 0x194 to 0x1a0: Error reading ZLIB header: Invalid ZLIB trailer length 21. diff --git a/rust/pspp/src/sys/testdata/zcompressed_data_uncompressed_size_block_size.expected b/rust/pspp/src/sys/testdata/zcompressed_data_uncompressed_size_block_size.expected index 00be8d4267..c12460b4f5 100644 --- a/rust/pspp/src/sys/testdata/zcompressed_data_uncompressed_size_block_size.expected +++ b/rust/pspp/src/sys/testdata/zcompressed_data_uncompressed_size_block_size.expected @@ -1,4 +1,4 @@ -Warning at file offsets 0x1c4 to 0x1dc: In ZLIB trailer: ZLIB block descriptor 0 reported block size 0x400000, when at most 0x3ff000 was expected. +Warning at file offsets 0x1c4 to 0x1dc: In ZLIB trailer: Block descriptor 0 reported block size 0x400000, when at most 0x3ff000 was expected. ╭──────────────────────┬────────────────────────╮ │ Created │ 01-JAN-2011 20:53:52│ diff --git a/rust/pspp/src/sys/testdata/zcompressed_data_wrong_block_size.expected b/rust/pspp/src/sys/testdata/zcompressed_data_wrong_block_size.expected index 82c0c1b127..5af8bd1e20 100644 --- a/rust/pspp/src/sys/testdata/zcompressed_data_wrong_block_size.expected +++ b/rust/pspp/src/sys/testdata/zcompressed_data_wrong_block_size.expected @@ -1 +1 @@ -Error at file offsets 0x1ac to 0x1c4: ZLIB trailer specifies unexpected 4096-byte block size. +Error at file offsets 0x1ac to 0x1c4: Error reading ZLIB trailer: Unexpected 1000-byte block size (expected 0x3ff000). diff --git a/rust/pspp/src/sys/testdata/zcompressed_data_wrong_compressed_ofs.expected b/rust/pspp/src/sys/testdata/zcompressed_data_wrong_compressed_ofs.expected index a7e4b4b935..272feb052a 100644 --- a/rust/pspp/src/sys/testdata/zcompressed_data_wrong_compressed_ofs.expected +++ b/rust/pspp/src/sys/testdata/zcompressed_data_wrong_compressed_ofs.expected @@ -1 +1 @@ -Error at file offsets 0x1c4 to 0x1dc: ZLIB block descriptor 0 reported compressed data offset 0x191, when 0x1ac was expected. +Error at file offsets 0x1c4 to 0x1dc: Error reading ZLIB trailer: Block descriptor 0 reported compressed data offset 0x191, when 0x1ac was expected. diff --git a/rust/pspp/src/sys/testdata/zcompressed_data_wrong_n_blocks.expected b/rust/pspp/src/sys/testdata/zcompressed_data_wrong_n_blocks.expected index 37a9a2d422..eef81e946c 100644 --- a/rust/pspp/src/sys/testdata/zcompressed_data_wrong_n_blocks.expected +++ b/rust/pspp/src/sys/testdata/zcompressed_data_wrong_n_blocks.expected @@ -1 +1 @@ -Error at file offsets 0x1ac to 0x1c4: Block count 2 in ZLIB trailer differs from expected block count 1 calculated from trailer length 48. +Error at file offsets 0x205 to 0x235: Error reading ZLIB trailer: Unexpected end-of-file reading ZLIB trailer diff --git a/rust/pspp/src/sys/testdata/zcompressed_data_wrong_uncompressed_ofs.expected b/rust/pspp/src/sys/testdata/zcompressed_data_wrong_uncompressed_ofs.expected index ef1bb440f7..d363062077 100644 --- a/rust/pspp/src/sys/testdata/zcompressed_data_wrong_uncompressed_ofs.expected +++ b/rust/pspp/src/sys/testdata/zcompressed_data_wrong_uncompressed_ofs.expected @@ -1 +1 @@ -Error at file offsets 0x1c4 to 0x1dc: ZLIB block descriptor 0 reported uncompressed data offset 0x177, when 0x1ac was expected. +Error at file offsets 0x1c4 to 0x1dc: Error reading ZLIB trailer: Block descriptor 0 reported uncompressed data offset 0x177, when 0x1ac was expected. diff --git a/rust/pspp/src/sys/testdata/zcompressed_data_wrong_ztrailer_bias.expected b/rust/pspp/src/sys/testdata/zcompressed_data_wrong_ztrailer_bias.expected index d084ea5256..5017da8b03 100644 --- a/rust/pspp/src/sys/testdata/zcompressed_data_wrong_ztrailer_bias.expected +++ b/rust/pspp/src/sys/testdata/zcompressed_data_wrong_ztrailer_bias.expected @@ -1 +1 @@ -Error at file offsets 0x1ac to 0x1c4: ZLIB trailer bias 0 is not -100 as expected from file header bias. +Error at file offsets 0x1ac to 0x1c4: Error reading ZLIB trailer: Bias 0 is not -100 as expected from file header. diff --git a/rust/pspp/src/sys/testdata/zcompressed_data_wrong_ztrailer_len.expected b/rust/pspp/src/sys/testdata/zcompressed_data_wrong_ztrailer_len.expected index a9d98d29b5..ba66bc99c3 100644 --- a/rust/pspp/src/sys/testdata/zcompressed_data_wrong_ztrailer_len.expected +++ b/rust/pspp/src/sys/testdata/zcompressed_data_wrong_ztrailer_len.expected @@ -1 +1 @@ -Error at file offsets 0x1ac to 0x1c4: Block count 1 in ZLIB trailer differs from expected block count 2 calculated from trailer length 72. +Error at file offsets 0x1ac to 0x1c4: Error reading ZLIB trailer: Block count 1 differs from expected block count 2 calculated from trailer length 72. diff --git a/rust/pspp/src/sys/testdata/zcompressed_data_wrong_ztrailer_zero.expected b/rust/pspp/src/sys/testdata/zcompressed_data_wrong_ztrailer_zero.expected index 73f5cfd137..578775cc31 100644 --- a/rust/pspp/src/sys/testdata/zcompressed_data_wrong_ztrailer_zero.expected +++ b/rust/pspp/src/sys/testdata/zcompressed_data_wrong_ztrailer_zero.expected @@ -1 +1 @@ -Error at file offsets 0x1ac to 0x1c4: ZLIB trailer "zero" field has nonzero value 100. +Error at file offsets 0x1ac to 0x1c4: Error reading ZLIB trailer: Expected zero field has nonzero value 100.