Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package agama-cli for openSUSE:Factory checked in at 2023-10-26 17:13:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/agama-cli (Old) and /work/SRC/openSUSE:Factory/.agama-cli.new.24901 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "agama-cli" Thu Oct 26 17:13:22 2023 rev:4 rq:1120208 version:0 Changes: -------- --- /work/SRC/openSUSE:Factory/agama-cli/agama-cli.changes 2023-10-23 23:41:34.872871393 +0200 +++ /work/SRC/openSUSE:Factory/.agama-cli.new.24901/agama-cli.changes 2023-10-26 17:14:10.055714904 +0200 @@ -1,0 +2,7 @@ +Mon Oct 23 14:43:59 UTC 2023 - Michal Filka <mfi...@suse.com> + +- Improved "agama logs store" (gh#openSUSE/agama#812) + - the archive file owner is root:root + - the permissions is set to r/w for the owner + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ agama.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agama/agama-cli/src/logs.rs new/agama/agama-cli/src/logs.rs --- old/agama/agama-cli/src/logs.rs 2023-10-23 14:02:31.000000000 +0200 +++ new/agama/agama-cli/src/logs.rs 2023-10-25 09:16:08.000000000 +0200 @@ -6,6 +6,7 @@ use std::fs::File; use std::io; use std::io::Write; +use std::os::unix::fs::PermissionsExt; use std::path::{Path, PathBuf}; use std::process::Command; use tempdir::TempDir; @@ -295,7 +296,7 @@ .status()?; if res.success() { - Ok(()) + set_archive_permissions(result) } else { Err(io::Error::new( io::ErrorKind::Other, @@ -304,6 +305,25 @@ } } +// Sets the archive owner to root:root. Also sets the file permissions to read/write for the +// owner only. +fn set_archive_permissions(archive: &String) -> io::Result<()> { + let attr = fs::metadata(archive)?; + let mut permissions = attr.permissions(); + + // set the archive file permissions to -rw------- + permissions.set_mode(0o600); + fs::set_permissions(archive, permissions)?; + + // set the archive owner to root:root + // note: std::os::unix::fs::chown is unstable for now + Command::new("chown") + .args(["root:root", archive.as_str()]) + .status()?; + + Ok(()) +} + // Handler for the "agama logs store" subcommand fn store(options: LogOptions) -> Result<(), io::Error> { if !Uid::effective().is_root() { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agama/agama-dbus-server/src/network/dbus/interfaces/ip_config.rs new/agama/agama-dbus-server/src/network/dbus/interfaces/ip_config.rs --- old/agama/agama-dbus-server/src/network/dbus/interfaces/ip_config.rs 2023-10-23 14:02:31.000000000 +0200 +++ new/agama/agama-dbus-server/src/network/dbus/interfaces/ip_config.rs 2023-10-25 09:16:08.000000000 +0200 @@ -6,7 +6,7 @@ //! to the `Ip<T>` struct. use crate::network::{ action::Action, - model::{Connection as NetworkConnection, IpConfig, IpMethod}, + model::{Connection as NetworkConnection, IpConfig, Ipv4Method, Ipv6Method}, }; use async_std::{channel::Sender, sync::Arc}; use cidr::IpInet; @@ -95,7 +95,7 @@ /// /// Possible values: "disabled", "auto", "manual" or "link-local". /// - /// See [crate::network::model::IpMethod]. + /// See [crate::network::model::Ipv4Method]. #[dbus_interface(property)] pub async fn method4(&self) -> String { let ip_config = self.get_ip_config().await; @@ -104,15 +104,15 @@ #[dbus_interface(property)] pub async fn set_method4(&mut self, method: &str) -> zbus::fdo::Result<()> { - let method: IpMethod = method.parse()?; + let method: Ipv4Method = method.parse()?; self.update_config(|ip| ip.method4 = method).await } /// IPv6 configuration method. /// - /// Possible values: "disabled", "auto", "manual" or "link-local". + /// Possible values: "disabled", "auto", "manual", "link-local", "ignore" or "dhcp". /// - /// See [crate::network::model::IpMethod]. + /// See [crate::network::model::Ipv6Method]. #[dbus_interface(property)] pub async fn method6(&self) -> String { let ip_config = self.get_ip_config().await; @@ -121,7 +121,7 @@ #[dbus_interface(property)] pub async fn set_method6(&mut self, method: &str) -> zbus::fdo::Result<()> { - let method: IpMethod = method.parse()?; + let method: Ipv6Method = method.parse()?; self.update_config(|ip| ip.method6 = method).await } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agama/agama-dbus-server/src/network/model.rs new/agama/agama-dbus-server/src/network/model.rs --- old/agama/agama-dbus-server/src/network/model.rs 2023-10-23 14:02:31.000000000 +0200 +++ new/agama/agama-dbus-server/src/network/model.rs 2023-10-25 09:16:08.000000000 +0200 @@ -331,8 +331,8 @@ #[derive(Default, Debug, PartialEq, Clone)] pub struct IpConfig { - pub method4: IpMethod, - pub method6: IpMethod, + pub method4: Ipv4Method, + pub method6: Ipv6Method, pub addresses: Vec<IpInet>, pub nameservers: Vec<IpAddr>, pub gateway4: Option<IpAddr>, @@ -352,34 +352,76 @@ pub struct UnknownIpMethod(String); #[derive(Debug, Default, Copy, Clone, PartialEq)] -pub enum IpMethod { +pub enum Ipv4Method { #[default] Disabled = 0, Auto = 1, Manual = 2, LinkLocal = 3, } -impl fmt::Display for IpMethod { + +impl fmt::Display for Ipv4Method { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let name = match &self { + Ipv4Method::Disabled => "disabled", + Ipv4Method::Auto => "auto", + Ipv4Method::Manual => "manual", + Ipv4Method::LinkLocal => "link-local", + }; + write!(f, "{}", name) + } +} + +impl FromStr for Ipv4Method { + type Err = UnknownIpMethod; + + fn from_str(s: &str) -> Result<Self, Self::Err> { + match s { + "disabled" => Ok(Ipv4Method::Disabled), + "auto" => Ok(Ipv4Method::Auto), + "manual" => Ok(Ipv4Method::Manual), + "link-local" => Ok(Ipv4Method::LinkLocal), + _ => Err(UnknownIpMethod(s.to_string())), + } + } +} + +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub enum Ipv6Method { + #[default] + Disabled = 0, + Auto = 1, + Manual = 2, + LinkLocal = 3, + Ignore = 4, + Dhcp = 5, +} + +impl fmt::Display for Ipv6Method { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let name = match &self { - IpMethod::Disabled => "disabled", - IpMethod::Auto => "auto", - IpMethod::Manual => "manual", - IpMethod::LinkLocal => "link-local", + Ipv6Method::Disabled => "disabled", + Ipv6Method::Auto => "auto", + Ipv6Method::Manual => "manual", + Ipv6Method::LinkLocal => "link-local", + Ipv6Method::Ignore => "ignore", + Ipv6Method::Dhcp => "dhcp", }; write!(f, "{}", name) } } -impl FromStr for IpMethod { +impl FromStr for Ipv6Method { type Err = UnknownIpMethod; fn from_str(s: &str) -> Result<Self, Self::Err> { match s { - "disabled" => Ok(IpMethod::Disabled), - "auto" => Ok(IpMethod::Auto), - "manual" => Ok(IpMethod::Manual), - "link-local" => Ok(IpMethod::LinkLocal), + "disabled" => Ok(Ipv6Method::Disabled), + "auto" => Ok(Ipv6Method::Auto), + "manual" => Ok(Ipv6Method::Manual), + "link-local" => Ok(Ipv6Method::LinkLocal), + "ignore" => Ok(Ipv6Method::Ignore), + "dhcp" => Ok(Ipv6Method::Dhcp), _ => Err(UnknownIpMethod(s.to_string())), } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agama/agama-dbus-server/src/network/nm/dbus.rs new/agama/agama-dbus-server/src/network/nm/dbus.rs --- old/agama/agama-dbus-server/src/network/nm/dbus.rs 2023-10-23 14:02:31.000000000 +0200 +++ new/agama/agama-dbus-server/src/network/nm/dbus.rs 2023-10-25 09:16:08.000000000 +0200 @@ -518,8 +518,8 @@ "::ffff:c0a8:102".parse::<IpAddr>().unwrap() ] ); - assert_eq!(ip_config.method4, IpMethod::Auto); - assert_eq!(ip_config.method6, IpMethod::Auto); + assert_eq!(ip_config.method4, Ipv4Method::Auto); + assert_eq!(ip_config.method6, Ipv6Method::Auto); } #[test] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agama/agama-dbus-server/src/network/nm/model.rs new/agama/agama-dbus-server/src/network/nm/model.rs --- old/agama/agama-dbus-server/src/network/nm/model.rs 2023-10-23 14:02:31.000000000 +0200 +++ new/agama/agama-dbus-server/src/network/nm/model.rs 2023-10-25 09:16:08.000000000 +0200 @@ -7,11 +7,12 @@ /// Using the newtype pattern around an String is enough. For proper support, we might replace this /// struct with an enum. use crate::network::{ - model::{IpMethod, SecurityProtocol, WirelessMode}, + model::{Ipv4Method, Ipv6Method, SecurityProtocol, WirelessMode}, nm::error::NmError, }; use agama_lib::network::types::DeviceType; use std::fmt; +use std::str::FromStr; #[derive(Debug, PartialEq)] pub struct NmWirelessMode(pub String); @@ -150,15 +151,23 @@ } } -impl TryFrom<NmMethod> for IpMethod { +impl TryFrom<NmMethod> for Ipv4Method { type Error = NmError; fn try_from(value: NmMethod) -> Result<Self, Self::Error> { - match value.as_str() { - "auto" => Ok(IpMethod::Auto), - "manual" => Ok(IpMethod::Manual), - "disabled" => Ok(IpMethod::Disabled), - "link-local" => Ok(IpMethod::LinkLocal), + match Ipv4Method::from_str(value.as_str()) { + Ok(method) => Ok(method), + _ => Err(NmError::UnsupportedIpMethod(value.to_string())), + } + } +} + +impl TryFrom<NmMethod> for Ipv6Method { + type Error = NmError; + + fn try_from(value: NmMethod) -> Result<Self, Self::Error> { + match Ipv6Method::from_str(value.as_str()) { + Ok(method) => Ok(method), _ => Err(NmError::UnsupportedIpMethod(value.to_string())), } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agama/agama-dbus-server/tests/network.rs new/agama/agama-dbus-server/tests/network.rs --- old/agama/agama-dbus-server/tests/network.rs 2023-10-23 14:02:31.000000000 +0200 +++ new/agama/agama-dbus-server/tests/network.rs 2023-10-25 09:16:08.000000000 +0200 @@ -3,7 +3,7 @@ use self::common::DBusServer; use agama_dbus_server::network::{ self, - model::{self, IpMethod}, + model::{self, Ipv4Method, Ipv6Method}, Adapter, NetworkService, NetworkState, }; use agama_lib::network::{settings, types::DeviceType, NetworkClient}; @@ -91,9 +91,9 @@ assert_eq!(conn.device_type(), DeviceType::Wireless); assert_eq!(&conn.addresses, &addresses); let method4 = conn.method4.as_ref().unwrap(); - assert_eq!(method4, &IpMethod::Auto.to_string()); + assert_eq!(method4, &Ipv4Method::Auto.to_string()); let method6 = conn.method6.as_ref().unwrap(); - assert_eq!(method6, &IpMethod::Disabled.to_string()); + assert_eq!(method6, &Ipv6Method::Disabled.to_string()); } #[test] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agama/package/agama-cli.changes new/agama/package/agama-cli.changes --- old/agama/package/agama-cli.changes 2023-10-23 14:02:31.000000000 +0200 +++ new/agama/package/agama-cli.changes 2023-10-25 09:16:08.000000000 +0200 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Mon Oct 23 14:43:59 UTC 2023 - Michal Filka <mfi...@suse.com> + +- Improved "agama logs store" (gh#openSUSE/agama#812) + - the archive file owner is root:root + - the permissions is set to r/w for the owner + +------------------------------------------------------------------- Mon Oct 23 11:33:40 UTC 2023 - Imobach Gonzalez Sosa <igonzalezs...@suse.com> - Version 5 ++++++ agama.obsinfo ++++++ --- /var/tmp/diff_new_pack.OMGulZ/_old 2023-10-26 17:14:11.291760300 +0200 +++ /var/tmp/diff_new_pack.OMGulZ/_new 2023-10-26 17:14:11.295760447 +0200 @@ -1,5 +1,5 @@ name: agama version: 5 -mtime: 1698062551 -commit: 0b494c95fa1fa38d3d358131e2e2bb2e1c659714 +mtime: 1698218168 +commit: 0d609c768afe4ae360a4e1b766e8701ea0177065 ++++++ vendor.tar.zst ++++++ Binary files /var/tmp/diff_new_pack.OMGulZ/_old and /var/tmp/diff_new_pack.OMGulZ/_new differ