-
-
Notifications
You must be signed in to change notification settings - Fork 75
chore: release v0.20.1 #617
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
Conversation
bb514b1 to
20ac1eb
Compare
20ac1eb to
9cd0b33
Compare
|
@amboar @wcampbell0x2a technically #614 doesn't break old code/compatibility right? would you agree in a patch bump or should we do a 0.21 release |
|
@sharksforarms nothing should break, no. The test suite changes were mainly to accommodate changes to reported formatted strings in errors, and the reduction in allocation count. |
Should be semver compatible. |
|
I think there might be an unintended change in behaviour between v0.20.0 and master for |
|
This fails after #614 but passes if it's reverted: #[test]
fn test_misaligned_pad_bits_aaelf32_flags() {
#[derive(Debug, DekuRead, DekuWrite, PartialEq)]
#[deku(endian = "little", bit_order = "lsb")]
pub struct AaElf32Flags {
#[deku(bits = "1", pad_bits_before = "9")]
ef_arm_abi_float_soft: bool,
#[deku(bits = "1")]
ef_arm_abi_float_hard: bool,
#[deku(bits = "1", pad_bits_before = "11")]
ef_arm_gccmask: bool,
#[deku(bits = "1")]
ef_arm_be8: bool,
ef_arm_abimask: u8,
}
let word = 83886592u32;
let bytes = word.to_le_bytes();
let (_, flags) = AaElf32Flags::from_bytes((&bytes, 0)).unwrap();
assert_eq!(
AaElf32Flags {
ef_arm_abi_float_soft: true,
ef_arm_abi_float_hard: false,
ef_arm_gccmask: false,
ef_arm_be8: false,
ef_arm_abimask: 5,
},
flags
);
}Looks like I missed specifying some invariants when using seek: After the current position is not byte-aligned - we've only read 14 bits, so it's incorrect to seek at that point. The requested padding is 11 bits and is incorrectly split into 3 and 8; it should rather be 5 (to become byte-aligned with respect to the already-consumed bits) and then 6, which cannot be seeked, however a read is needed to satisfy the request. |
[I] 1 andrew@heihei ~/s/g/s/deku (bit-order-lsb) [101]> git diff
diff --git a/src/reader.rs b/src/reader.rs
index 22b212fb8e1d..bbe0ebc4784e 100644
--- a/src/reader.rs
+++ b/src/reader.rs
@@ -207,6 +207,7 @@ impl<R: Read + Seek> Reader<R> {
// first, seek with bytes
if bytes_amt != 0 {
+ debug_assert_eq!(self.bits_read % 8, 0);
self.seek(SeekFrom::Current(
i64::try_from(bytes_amt).expect("could not convert seek usize into i64"),
))[I] 1 andrew@heihei ~/s/g/s/deku (bit-order-lsb)> cargo test --no-default-features --features=alloc,bits,logging --test test_lsb_le -- test_misaligned_pad_bits_aaelf32_flags
Finished `test` profile [unoptimized + debuginfo] target(s) in 0.03s
Running tests/test_lsb_le.rs (target/debug/deps/test_lsb_le-f72cea0c554eeb76)
running 1 test
test test_misaligned_pad_bits_aaelf32_flags ... FAILED
failures:
---- test_misaligned_pad_bits_aaelf32_flags stdout ----
thread 'test_misaligned_pad_bits_aaelf32_flags' (131091) panicked at /home/andrew/src/github.com/sharksforarms/deku/src/reader.rs:210:17:
assertion `left == right` failed
left: 6
right: 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
test_misaligned_pad_bits_aaelf32_flags
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 8 filtered out; finished in 0.00s
error: test failed, to rerun pass `--test test_lsb_le` |
🤖 New release
deku_derive: 0.20.0 -> 0.20.1deku: 0.20.0 -> 0.20.1 (✓ API compatible changes)Changelog
dekuThis PR was generated with release-plz.