Source: netavark Version: 1.12.1-8 Severity: normal Tags: patch X-Debbugs-Cc: [email protected]
Hi, zbus v5 was recently uploaded to experimental and we intend to downlift it to unstable in the near future. In attachment you'll find a patch (to be applied in git) to update src:netavark's dependency on zbus. All changes are trivial except for one: zvariant (re-exported as zbus::zvariant) introduced a new zvariant::signature::Error which must be mapped to a NetavarkError enum variant; instead of defining a new error which the rest of the code would be unaware of, I mapped zvariant::signature::Error to NetavarkError::DbusVariant, which is the same one zvariant::Error is mapped to. Cheers!
>From b85c110193b759061d170163c5bbe2dc7dca7b63 Mon Sep 17 00:00:00 2001 From: NoisyCoil <[email protected]> Date: Tue, 21 Jan 2025 01:23:45 +0100 Subject: [PATCH] Bump zbus dependency to v5 --- debian/control | 2 +- .../patches/0007-relax-url-dependency.patch | 4 +- .../0010-relax-serde-json-dependency.patch | 4 +- .../patches/0011-relax-nix-dependency.patch | 4 +- debian/patches/relax-zbus.patch | 76 ++++++++++++++++--- 5 files changed, 72 insertions(+), 18 deletions(-) diff --git a/debian/control b/debian/control index c44a058..c3d51e1 100644 --- a/debian/control +++ b/debian/control @@ -40,7 +40,7 @@ Build-Depends: cargo:native <!nocheck>, librust-tonic-build-dev, librust-tonic-dev, librust-url-dev, - librust-zbus-4-dev (>= 4.3.1), + librust-zbus-5-dev (>= 5), librust-zvariant-dev, libstd-rust-dev, rustc:native <!nocheck> diff --git a/debian/patches/0007-relax-url-dependency.patch b/debian/patches/0007-relax-url-dependency.patch index 644ffe8..cdc285a 100644 --- a/debian/patches/0007-relax-url-dependency.patch +++ b/debian/patches/0007-relax-url-dependency.patch @@ -7,7 +7,7 @@ Subject: relax url dependency 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml -index 41523bf..a91cdfc 100644 +index eccb3b5..bbace7a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,7 @@ serde = { version = "1.0.199", features = ["derive"], optional = true } @@ -16,6 +16,6 @@ index 41523bf..a91cdfc 100644 sysctl = "0.5.5" -url = "2.5.2" +url = "2.5" - zbus = { version = ">= 4.3" } + zbus = { version = ">= 5" } nix = { version = "0.29.0", features = ["sched", "signal", "user"] } rand = "0.8.5" diff --git a/debian/patches/0010-relax-serde-json-dependency.patch b/debian/patches/0010-relax-serde-json-dependency.patch index e613cf3..7c05c55 100644 --- a/debian/patches/0010-relax-serde-json-dependency.patch +++ b/debian/patches/0010-relax-serde-json-dependency.patch @@ -7,7 +7,7 @@ Subject: relax serde-json dependency 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml -index 6d4601e..aca0d3c 100644 +index cc5d077..841428e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,7 @@ libc = "0.2.154" @@ -18,4 +18,4 @@ index 6d4601e..aca0d3c 100644 +serde_json = { version = ">= 1.0" } sysctl = "0.5.5" url = "2.5" - zbus = { version = ">= 4.3" } + zbus = { version = ">= 5" } diff --git a/debian/patches/0011-relax-nix-dependency.patch b/debian/patches/0011-relax-nix-dependency.patch index 4469637..c1f927d 100644 --- a/debian/patches/0011-relax-nix-dependency.patch +++ b/debian/patches/0011-relax-nix-dependency.patch @@ -7,13 +7,13 @@ Subject: relax nix dependency 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml -index aca0d3c..e9097cf 100644 +index 841428e..41e25af 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,7 @@ serde_json = { version = ">= 1.0" } sysctl = "0.5.5" url = "2.5" - zbus = { version = ">= 4.3" } + zbus = { version = ">= 5" } -nix = { version = "0.29.0", features = ["sched", "signal", "user"] } +nix = { version = ">= 0.27", features = ["sched", "signal", "user"] } rand = "0.8.5" diff --git a/debian/patches/relax-zbus.patch b/debian/patches/relax-zbus.patch index 0916596..30fa044 100644 --- a/debian/patches/relax-zbus.patch +++ b/debian/patches/relax-zbus.patch @@ -1,19 +1,24 @@ From: Blair Noctis <[email protected]> Date: Fri, 12 Jul 2024 21:52:07 +0800 -Subject: fix(deps): update zbus to 4.3.1 +Subject: fix(deps): update zbus to v5 Forwarded: https://github.com/containers/netavark/pull/1025/ -Signed-off-by: Blair Noctis <[email protected]> +zvariant v5 introduced a new zvariant::signature::Error which needs +to be mapped to a NetavarkError. Instead of defining a new enum +variant, we reuse NetavarkError::DbusVariant. + +Updated-by: NoisyCoil <[email protected]> --- Cargo.toml | 2 +- src/commands/firewalld_reload.rs | 6 +- src/dhcp_proxy/lib.rs | 5 +- - src/firewall/firewalld.rs | 185 ++++++++++++++++----------------------- - 4 files changed, 79 insertions(+), 119 deletions(-) + src/error/mod.rs | 8 ++ + src/firewall/firewalld.rs | 193 ++++++++++++++++----------------------- + 5 files changed, 91 insertions(+), 123 deletions(-) diff --git a/Cargo.toml b/Cargo.toml -index 30952ba..c2ac980 100644 +index 30952ba..59b0413 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,7 @@ serde-value = "0.7.0" @@ -21,12 +26,12 @@ index 30952ba..c2ac980 100644 sysctl = "0.5.5" url = "2.5.2" -zbus = { version = "3.15.2" } -+zbus = { version = ">= 4.3" } ++zbus = { version = ">= 5" } nix = { version = "0.29.0", features = ["sched", "signal", "user"] } rand = "0.8.5" sha2 = "0.10.8" diff --git a/src/commands/firewalld_reload.rs b/src/commands/firewalld_reload.rs -index 0e1d884..5f3e00c 100644 +index 0e1d884..5a72386 100644 --- a/src/commands/firewalld_reload.rs +++ b/src/commands/firewalld_reload.rs @@ -3,7 +3,7 @@ use std::{ @@ -34,7 +39,7 @@ index 0e1d884..5f3e00c 100644 }; -use zbus::{blocking::Connection, dbus_proxy, CacheProperties}; -+use zbus::{blocking::Connection, proxy, CacheProperties}; ++use zbus::{blocking::Connection, proxy, proxy::CacheProperties}; use crate::{ error::{ErrorWrap, NetavarkResult}, @@ -72,8 +77,27 @@ index 848b76b..cb35bc0 100644 let mtu = l.mtu.unwrap_or(0) as u32; Lease { +diff --git a/src/error/mod.rs b/src/error/mod.rs +index bb6bbb6..ade216d 100644 +--- a/src/error/mod.rs ++++ b/src/error/mod.rs +@@ -192,6 +192,14 @@ impl From<zbus::zvariant::Error> for NetavarkError { + } + } + ++// Debian: map the new zvariant::signature::Error to a ++// NetavarkError::DbusVariant, like zvariant::Error ++impl From<zbus::zvariant::signature::Error> for NetavarkError { ++ fn from(err: zbus::zvariant::signature::Error) -> NetavarkError { ++ NetavarkError::DbusVariant(err.into()) ++ } ++} ++ + impl From<sysctl::SysctlError> for NetavarkError { + fn from(err: sysctl::SysctlError) -> NetavarkError { + NetavarkError::Sysctl(err) diff --git a/src/firewall/firewalld.rs b/src/firewall/firewalld.rs -index 635b262..4c4623d 100644 +index 635b262..7bfb15b 100644 --- a/src/firewall/firewalld.rs +++ b/src/firewall/firewalld.rs @@ -1,8 +1,8 @@ @@ -128,6 +152,15 @@ index 635b262..4c4623d 100644 None => { // No existing rules // Make us a new array. +@@ -163,7 +158,7 @@ impl firewall::FirewallDriver for FirewallD { + } + }; + +- port_forwarding_rules = Array::new(sig); ++ port_forwarding_rules = Array::new(&sig); + } + } + @@ -199,15 +194,16 @@ impl firewall::FirewallDriver for FirewallD { let mut rich_rules_option: Option<Array> = None; if setup_portfw.dns_port != 53 && !setup_portfw.dns_server_ips.is_empty() { @@ -152,6 +185,15 @@ index 635b262..4c4623d 100644 None => { // No existing rules // Make us a new array. +@@ -220,7 +216,7 @@ impl firewall::FirewallDriver for FirewallD { + )) + } + }; +- rich_rules = Array::new(sig); ++ rich_rules = Array::new(&sig); + } + } + for dns_ip in setup_portfw.dns_server_ips { @@ -277,28 +273,23 @@ impl firewall::FirewallDriver for FirewallD { "getPolicySettings", &(PORTPOLICYNAME), @@ -193,6 +235,15 @@ index 635b262..4c4623d 100644 None => { // No existing rules - skip None +@@ -316,7 +307,7 @@ impl firewall::FirewallDriver for FirewallD { + )) + } + }; +- let mut port_forwarding_rules = Array::new(sig); ++ let mut port_forwarding_rules = Array::new(&sig); + // use an invalid string if we don't have a valid v4 or v6 address. + // This is ugly, but easiest code-wise. + let ipv4 = match teardown_pf.config.container_ip_v4 { @@ -333,19 +324,22 @@ impl firewall::FirewallDriver for FirewallD { for port_tuple in old_port_forwarding_rules.iter() { match port_tuple { @@ -243,9 +294,12 @@ index 635b262..4c4623d 100644 } } if let Some(old_rich_rules) = old_rich_rules_option { -@@ -397,17 +390,13 @@ impl firewall::FirewallDriver for FirewallD { +@@ -395,19 +388,15 @@ impl firewall::FirewallDriver for FirewallD { + )) + } }; - let mut rich_rules = Array::new(sig); +- let mut rich_rules = Array::new(sig); ++ let mut rich_rules = Array::new(&sig); for rule in old_rich_rules.iter() { - match rule { - Value::Str(old_rule) => { -- 2.45.2

