diff --git a/.gitignore b/.gitignore index c70f326..e7e0cf2 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /safe-transmute-0.10.1.crate +/safe-transmute-0.11.0.crate diff --git a/0001-Fix-tests-on-big-endian-platforms-tested-on-s390x.patch b/0001-Fix-tests-on-big-endian-platforms-tested-on-s390x.patch new file mode 100644 index 0000000..090151d --- /dev/null +++ b/0001-Fix-tests-on-big-endian-platforms-tested-on-s390x.patch @@ -0,0 +1,33 @@ +From 057931a23883967cbcb06c85d7ce2a7734fbc4a1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= +Date: Wed, 30 Dec 2020 01:05:06 +0100 +Subject: [PATCH] Fix tests on big-endian platforms, tested on s390x + +Ref: #64 +--- + tests/test_util/le_to_native.rs | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/tests/test_util/le_to_native.rs b/tests/test_util/le_to_native.rs +index 03e9923..662ecd0 100644 +--- a/tests/test_util/le_to_native.rs ++++ b/tests/test_util/le_to_native.rs +@@ -1,3 +1,6 @@ ++extern crate core as le_to_native_core; ++ ++ + /// Verify: http://play.integer32.com/?gist=4cd795d6f45898c876a754cd3f3c2aaa&version=stable + trait LeToNative { + fn le_to_native(self) -> Self; +@@ -11,7 +14,7 @@ impl<'a> LeToNative for &'a mut [u8] { + + #[cfg(target_endian = "big")] + fn le_to_native(self) -> Self { +- use core::mem::size_of; ++ use le_to_native_core::mem::size_of; + + for elem in self.chunks_mut(size_of::()) { + elem.reverse(); +-- +2.30.0 + diff --git a/0001-i686-has-4-byte-aligned-iu-64s-so-fix-comment-out-bi.patch b/0001-i686-has-4-byte-aligned-iu-64s-so-fix-comment-out-bi.patch new file mode 100644 index 0000000..850e32c --- /dev/null +++ b/0001-i686-has-4-byte-aligned-iu-64s-so-fix-comment-out-bi.patch @@ -0,0 +1,52 @@ +From 2e5694ac0dadd85d6f99661f2530194732ba8fd1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= +Date: Tue, 29 Dec 2020 17:46:51 +0100 +Subject: [PATCH] i686 has 4-byte-aligned [iu]64s, so fix/comment out bits of + tests that need that + +Ref: #64 +--- + tests/error/unaligned.rs | 6 ++++++ + tests/util/mod.rs | 2 +- + 2 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/tests/error/unaligned.rs b/tests/error/unaligned.rs +index fcd6d5b..779c6a6 100644 +--- a/tests/error/unaligned.rs ++++ b/tests/error/unaligned.rs +@@ -1,6 +1,8 @@ + use safe_transmute::{transmute_many_permissive, transmute_to_bytes}; + use safe_transmute::error::{UnalignedError, Error}; + #[cfg(feature = "alloc")] ++use core::mem::align_of; ++#[cfg(feature = "alloc")] + use alloc::vec::Vec; + + +@@ -66,6 +68,10 @@ fn unaligned_slicing_integers() { + + #[cfg(feature = "alloc")] + fn unaligned_slicing_integers_with_try_copy<'a>(bytes: &'a [u8]) -> Result<(), Error<'a, u8, u64>> { ++ if align_of::() != 8 { // i686 ++ return Ok(()); ++ } ++ + for i in 4..8 { + // transmute unaligned content by copying + let outcome = transmute_many_permissive::(&bytes[i..]); +diff --git a/tests/util/mod.rs b/tests/util/mod.rs +index 362642d..381e702 100644 +--- a/tests/util/mod.rs ++++ b/tests/util/mod.rs +@@ -36,7 +36,7 @@ fn smoke_check_alignment_from_4() { + #[test] + fn smoke_check_alignment_from_8() { + let x: [i64; 5] = [0x5555_5555_5555_5555; 5]; +- assert_eq!(align_of::<[i64; 5]>(), 8); ++ // assert_eq!(align_of::<[i64; 5]>(), 8); // False on i686, holds on amd64. + assert_eq!(check_alignment::<_, u8>(&x[..]), Ok(())); + assert_eq!(check_alignment::<_, i8>(&x[..]), Ok(())); + assert_eq!(check_alignment::<_, u16>(&x[..]), Ok(())); +-- +2.30.0 + diff --git a/rust-safe-transmute.spec b/rust-safe-transmute.spec index cbd8c58..88ead19 100644 --- a/rust-safe-transmute.spec +++ b/rust-safe-transmute.spec @@ -1,18 +1,21 @@ # Generated by rust2rpm 17 -%bcond_with check +%bcond_without check %global debug_package %{nil} %global crate safe-transmute Name: rust-%{crate} -Version: 0.10.1 -Release: 4%{?dist} +Version: 0.11.0 +Release: 1%{?dist} Summary: Safeguarded transmute() for Rust # Upstream license specification: MIT License: MIT URL: https://crates.io/crates/safe-transmute Source: %{crates_source} +# https://github.com/nabijaczleweli/safe-transmute-rs/issues/64 +Patch0001: 0001-i686-has-4-byte-aligned-iu-64s-so-fix-comment-out-bi.patch +Patch0002: 0001-Fix-tests-on-big-endian-platforms-tested-on-s390x.patch ExclusiveArch: %{rust_arches} %if %{__cargo_skip_build} @@ -52,28 +55,28 @@ which use "default" feature of "%{crate}" crate. %files -n %{name}+default-devel %ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml -%package -n %{name}+std-devel +%package -n %{name}+alloc-devel Summary: %{summary} BuildArch: noarch -%description -n %{name}+std-devel %{_description} +%description -n %{name}+alloc-devel %{_description} This package contains library source intended for building other packages -which use "std" feature of "%{crate}" crate. +which use "alloc" feature of "%{crate}" crate. -%files -n %{name}+std-devel +%files -n %{name}+alloc-devel %ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml -%package -n %{name}+test-unaligned-devel +%package -n %{name}+std-devel Summary: %{summary} BuildArch: noarch -%description -n %{name}+test-unaligned-devel %{_description} +%description -n %{name}+std-devel %{_description} This package contains library source intended for building other packages -which use "test-unaligned" feature of "%{crate}" crate. +which use "std" feature of "%{crate}" crate. -%files -n %{name}+test-unaligned-devel +%files -n %{name}+std-devel %ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml %prep @@ -95,6 +98,9 @@ which use "test-unaligned" feature of "%{crate}" crate. %endif %changelog +* Wed Dec 30 15:32:49 CET 2020 Igor Raits - 0.11.0-1 +- Update to 0.11.0 + * Wed Jul 29 2020 Fedora Release Engineering - 0.10.1-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild diff --git a/sources b/sources index 15ee987..7cbd140 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (safe-transmute-0.10.1.crate) = 0298c9c2fd24e8d8e28d49228fc3f1d929477d2f35fa5ad2b0819afe031fe5361ecd45c64e5b28235f46a5ca109f99f330575d1bb003e5a59d8a73ac6482fceb +SHA512 (safe-transmute-0.11.0.crate) = 5f14c0b3534123c25804b20b54ce965f981b8aaf8ff2df639f3f2c0b77699edd05eb2c97129edc6e84a86882ff86ffe0e7c90e23b5cbd1b3ba08ed7fd1c93a56