On 25/03/2021 01:17, peter green wrote:> The second is to fix the autopkgtest. It's currently "neutral"> due to a dependency on rust-boxxy which is not present in> Debian. From taking a quick look it looks to me like any> tests that rely on boxxy could probablly be patched out and> the dev-dependency dropped to allow the remainder of the> testsuite to run. I started investigating this approach.
Unfortunately the only way I could find to prevent the build of examples/boxxy.rs was to remove the file completely. I then ran into a couple of issues in bench.rs, Firstly IPv4Protocol had been renamed to IPProtocol and moved to pktparse::ip as part of adding ipv6 support to pktparse. https://github.com/bestouff/pktparse-rs/commit/ebb468ace109339b9833e0e633494a410549fb41 Secondly centrifuge::parse was renamed to centrifuge::parse_eth in https://github.com/kpcyrd/sniffglue/commit/2bf3785b275fc2b52ba039fc6a11c91bb4b069f8 After fixing these issues the autopkgtest parses. I've attatched a diff to this mail, should I go ahead and push/ upload it? (If I get no response I will upload it in a week or so)
commit fbb9a8f3bd4d7181d1f858897905a04788a4ca71 Author: Peter Michael Green <plugw...@debian.org> Date: Thu Mar 25 19:39:24 2021 +0000 fix sniffglue autopkgtest diff --git a/src/sniffglue/debian/changelog b/src/sniffglue/debian/changelog index 9f828e33..0ac7fcd5 100644 --- a/src/sniffglue/debian/changelog +++ b/src/sniffglue/debian/changelog @@ -1,8 +1,15 @@ rust-sniffglue (0.11.1-6) UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; urgency=medium + * Team upload. + * Package sniffglue 0.11.1 from crates.io using debcargo 2.4.0 + * Drop dev-dependency on boxxy and remove examples/boxxy.rs + to allow the rest of the tests to run. + * Fix a couple of compile errors in benches/bench.rs + + [ kpcyrd ] * Add missing syscalls to seccomp filter (Closes: #985858) - -- kpcyrd <g...@rxv.cc> Tue, 23 Mar 2021 02:42:26 +0100 + -- Peter Michael Green <plugw...@debian.org> Thu, 25 Mar 2021 19:15:48 +0000 rust-sniffglue (0.11.1-5) unstable; urgency=medium diff --git a/src/sniffglue/debian/patches/fix-bench.patch b/src/sniffglue/debian/patches/fix-bench.patch new file mode 100644 index 00000000..4ec255ca --- /dev/null +++ b/src/sniffglue/debian/patches/fix-bench.patch @@ -0,0 +1,49 @@ +Index: sniffglue/benches/bench.rs +=================================================================== +--- sniffglue.orig/benches/bench.rs ++++ sniffglue/benches/bench.rs +@@ -43,7 +43,8 @@ mod tests { + use structs::tcp::TCP::Text; + + use pktparse::ethernet::{MacAddress, EtherType, EthernetFrame}; +- use pktparse::ipv4::{IPv4Header, IPv4Protocol}; ++ use pktparse::ipv4::IPv4Header; ++ use pktparse::ip::IPProtocol; + use pktparse::tcp::TcpHeader; + + let mut pkt = Vec::new(); +@@ -72,7 +73,7 @@ mod tests { + flags: 2, + fragment_offset: 0, + ttl: 55, +- protocol: IPv4Protocol::TCP, ++ protocol: IPProtocol::TCP, + chksum: 64371, + source_addr: "93.184.216.34".parse().unwrap(), + dest_addr: "192.168.44.55".parse().unwrap(), +@@ -98,14 +99,14 @@ mod tests { + Text(String::from_utf8(HTML.to_vec()).unwrap()) + )))); + +- let x = centrifuge::parse(&pkt); ++ let x = centrifuge::parse_eth(&pkt); + assert_eq!(expected, x); + } + + #[bench] + fn bench_empty(b: &mut Bencher) { + b.iter(|| { +- centrifuge::parse(&[]).ok(); ++ centrifuge::parse_eth(&[]).ok(); + }); + } + +@@ -123,7 +124,7 @@ mod tests { + pkt.extend(HTML.iter()); + + b.iter(|| { +- centrifuge::parse(&pkt).ok(); ++ centrifuge::parse_eth(&pkt).ok(); + }); + } + } diff --git a/src/sniffglue/debian/patches/remove-boxxy.patch b/src/sniffglue/debian/patches/remove-boxxy.patch new file mode 100644 index 00000000..5df3a596 --- /dev/null +++ b/src/sniffglue/debian/patches/remove-boxxy.patch @@ -0,0 +1,48 @@ +Index: sniffglue/Cargo.toml +=================================================================== +--- sniffglue.orig/Cargo.toml ++++ sniffglue/Cargo.toml +@@ -102,8 +102,6 @@ version = "0.5" + + [dependencies.users] + version = "0.10" +-[dev-dependencies.boxxy] +-version = "0.11" + [target."cfg(target_os=\"linux\")".dependencies.syscallz] + version = "0.15.0" + [badges.travis-ci] +Index: sniffglue/examples/boxxy.rs +=================================================================== +--- sniffglue.orig/examples/boxxy.rs ++++ /dev/null +@@ -1,30 +0,0 @@ +-#[macro_use] extern crate boxxy; +-extern crate sniffglue; +-extern crate env_logger; +- +-fn stage1(sh: &mut boxxy::Shell, _args: Vec<String>) -> Result<(), boxxy::Error> { +- shprintln!(sh, "[*] starting stage1"); +- sniffglue::sandbox::activate_stage1().unwrap(); +- shprintln!(sh, "[+] activated!"); +- Ok(()) +-} +- +-fn stage2(sh: &mut boxxy::Shell, _args: Vec<String>) -> Result<(), boxxy::Error> { +- shprintln!(sh, "[*] starting stage2"); +- sniffglue::sandbox::activate_stage2().unwrap(); +- shprintln!(sh, "[+] activated!"); +- Ok(()) +-} +- +-fn main() { +- env_logger::init(); +- +- println!("stage1 activate sandbox stage1/2"); +- println!("stage2 activate sandbox stage2/2"); +- +- let toolbox = boxxy::Toolbox::new().with(vec![ +- ("stage1", stage1), +- ("stage2", stage2), +- ]); +- boxxy::Shell::new(toolbox).run() +-} diff --git a/src/sniffglue/debian/patches/series b/src/sniffglue/debian/patches/series index 5bb873a7..7f811d8f 100644 --- a/src/sniffglue/debian/patches/series +++ b/src/sniffglue/debian/patches/series @@ -1,3 +1,5 @@ relax-deps.patch fix-dep.diff seccomp.patch +remove-boxxy.patch +fix-bench.patch