From 85e9b8ae5b71d553ee77d864491f9e5344f8d58a Mon Sep 17 00:00:00 2001 From: renoseven Date: Sat, 30 Aug 2025 15:18:49 +0800 Subject: [PATCH 1/4] common: fix compile failure on rust 1.89 Signed-off-by: renoseven --- syscare-common/src/ffi/os_str.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syscare-common/src/ffi/os_str.rs b/syscare-common/src/ffi/os_str.rs index 0c414e18..1e61fe93 100644 --- a/syscare-common/src/ffi/os_str.rs +++ b/syscare-common/src/ffi/os_str.rs @@ -141,7 +141,7 @@ pub trait OsStrExt: AsRef { }) } - fn split_whitespace(&self) -> Filter, FilterFn> { + fn split_whitespace(&self) -> Filter, FilterFn> { self.split(SplitFn::from(char::is_whitespace)) .filter(|s| !s.is_empty()) } -- Gitee From 67d3d118835d58d7ab03c13ba0ffa2fe951ba70f Mon Sep 17 00:00:00 2001 From: renoseven Date: Sat, 30 Aug 2025 15:17:54 +0800 Subject: [PATCH 2/4] upatch-build: fix build failure on rust 1.89 Signed-off-by: renoseven --- upatch-build/src/dwarf.rs | 2 +- upatch-build/src/elf/read/elfs.rs | 6 +++--- upatch-build/src/elf/write/elfs.rs | 2 +- upatch-build/src/file_relation.rs | 6 ------ 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/upatch-build/src/dwarf.rs b/upatch-build/src/dwarf.rs index fe0821c6..a643556d 100644 --- a/upatch-build/src/dwarf.rs +++ b/upatch-build/src/dwarf.rs @@ -304,7 +304,7 @@ pub struct ProducerIterator { } impl> ProducerIterator { - fn current(&self) -> Result, DebuggingInformationEntry)>> { + fn current(&self) -> Result, DebuggingInformationEntry<'_, '_, R>)>> { if let Some((unit, offsets)) = &self.state { if let Some(offset) = offsets.last() { return Ok(Some((unit, unit.entry(*offset)?))); diff --git a/upatch-build/src/elf/read/elfs.rs b/upatch-build/src/elf/read/elfs.rs index 52c5e6b6..e6c65bbd 100644 --- a/upatch-build/src/elf/read/elfs.rs +++ b/upatch-build/src/elf/read/elfs.rs @@ -41,11 +41,11 @@ impl Elf { Ok(Self { mmap, endian }) } - pub fn header(&self) -> Result
{ + pub fn header(&self) -> Result> { Ok(Header::from(&self.mmap, self.endian)) } - pub fn sections(&self) -> Result { + pub fn sections(&self) -> Result> { let header = self.header()?; let offset = header.get_e_shoff() as usize; let num = header.get_e_shnum() as usize; @@ -59,7 +59,7 @@ impl Elf { )) } - pub fn symbols(&self) -> Result { + pub fn symbols(&self) -> Result> { let sections = self.sections()?; for section in sections.clone() { if section.get_sh_type().eq(&SHT_SYMTAB) { diff --git a/upatch-build/src/elf/write/elfs.rs b/upatch-build/src/elf/write/elfs.rs index 9ce28478..c2ea121b 100644 --- a/upatch-build/src/elf/write/elfs.rs +++ b/upatch-build/src/elf/write/elfs.rs @@ -70,7 +70,7 @@ impl Elf { Ok(res) } - pub fn symbols(&mut self) -> Result { + pub fn symbols(&mut self) -> Result> { let sections = &self.sections()?; for section in sections { if section.get_sh_type().eq(&SHT_SYMTAB) { diff --git a/upatch-build/src/file_relation.rs b/upatch-build/src/file_relation.rs index 677cb8bc..c7d941e4 100644 --- a/upatch-build/src/file_relation.rs +++ b/upatch-build/src/file_relation.rs @@ -32,12 +32,6 @@ const UPATCH_ID_PREFIX: &str = ".upatch_"; const NON_EXIST_PATH: &str = "/dev/null"; -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct ObjectRelation { - pub original_object: PathBuf, - pub patched_object: PathBuf, -} - /* * The task of this class is to find out: * 1. relationship between binary and debuginfo -- Gitee From 2b29699d88b8cf932cc30c628ce111cbf43ecd84 Mon Sep 17 00:00:00 2001 From: renoseven Date: Sat, 30 Aug 2025 15:19:20 +0800 Subject: [PATCH 3/4] syscare-build: fix compile failure on rust 1.89 Signed-off-by: renoseven --- syscare-build/src/package/rpm/tags/attr.rs | 24 ---------------------- 1 file changed, 24 deletions(-) diff --git a/syscare-build/src/package/rpm/tags/attr.rs b/syscare-build/src/package/rpm/tags/attr.rs index ef226d77..b836e027 100644 --- a/syscare-build/src/package/rpm/tags/attr.rs +++ b/syscare-build/src/package/rpm/tags/attr.rs @@ -29,32 +29,8 @@ impl std::fmt::Display for RpmDefAttr { } } -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)] -pub struct RpmAttr { - pub mode: u32, - pub user: String, - pub group: String, -} - -impl std::fmt::Display for RpmAttr { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.write_fmt(format_args!( - "%attr({:o},{},{})", - self.mode, self.user, self.group - )) - } -} - #[test] fn test() { - let attr = RpmAttr { - mode: 0o755, - user: String::from("root"), - group: String::from("nobody"), - }; - println!("RpmAttr::new()\n{}\n", attr); - assert_eq!(attr.to_string(), "%attr(755,root,nobody)"); - let def_attr = RpmDefAttr { file_mode: 0o755, user: String::from("root"), -- Gitee From b939ca33d8aaf29eac297d9379964278059d54cf Mon Sep 17 00:00:00 2001 From: renoseven Date: Sat, 30 Aug 2025 15:19:37 +0800 Subject: [PATCH 4/4] syscared: apply cargo fmt suggestions Signed-off-by: renoseven --- syscared/src/patch/driver/upatch/target.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syscared/src/patch/driver/upatch/target.rs b/syscared/src/patch/driver/upatch/target.rs index be5aabcd..ff35d2fb 100644 --- a/syscared/src/patch/driver/upatch/target.rs +++ b/syscared/src/patch/driver/upatch/target.rs @@ -24,8 +24,8 @@ use crate::patch::entity::UserPatch; #[derive(Debug, Default)] pub struct PatchTarget { - process_map: HashMap>, // pid -> patch list - patch_map: IndexMap, // uuid -> patch file + process_map: HashMap>, // pid -> patch list + patch_map: IndexMap, // uuid -> patch file collision_map: HashMap>, // function old addr -> patch collision list } -- Gitee