diff --git a/0001-fix-kernel-patch-ACCEPTED-change-to-DEACTIVED-after-.patch b/0001-fix-kernel-patch-ACCEPTED-change-to-DEACTIVED-after-.patch index 026dde4cb60b436d0f78800fd1bad48c56129b29..6870278c75898bc3f7657a89d4e38c17598aefbc 100644 --- a/0001-fix-kernel-patch-ACCEPTED-change-to-DEACTIVED-after-.patch +++ b/0001-fix-kernel-patch-ACCEPTED-change-to-DEACTIVED-after-.patch @@ -1,4 +1,4 @@ -From e7ea4a32db656a1419fe60e4eaca7ce74cc4c0b6 Mon Sep 17 00:00:00 2001 +From abefa18605dd7ec20419e8061739357d2a4d67a4 Mon Sep 17 00:00:00 2001 From: liqiang Date: Wed, 28 Aug 2024 02:24:59 +0800 Subject: [PATCH] fix kernel patch ACCEPTED change to DEACTIVED after reboot diff --git a/0002-fix-some-clean-code-problem.patch b/0002-fix-some-clean-code-problem.patch index 036a72138576971f9886cd28ca24ec6193cea23a..7f14c6071b177d7242b4128a4c39c60bc9f41834 100644 --- a/0002-fix-some-clean-code-problem.patch +++ b/0002-fix-some-clean-code-problem.patch @@ -1,4 +1,4 @@ -From 2f41eb92cb97ba980ac4d9d7b6b39d001687c111 Mon Sep 17 00:00:00 2001 +From 224df412c95bf4ac95200b6af44927ad2ef2abac Mon Sep 17 00:00:00 2001 From: liqiang Date: Thu, 29 Aug 2024 03:56:58 +0800 Subject: [PATCH] fix some clean code problem diff --git a/0003-syscared-fix-active-accepted-patch-failure-issue.patch b/0003-syscared-fix-active-accepted-patch-failure-issue.patch new file mode 100644 index 0000000000000000000000000000000000000000..21beac2375feb2f2269d3ae81e4c396a8ca5e503 --- /dev/null +++ b/0003-syscared-fix-active-accepted-patch-failure-issue.patch @@ -0,0 +1,49 @@ +From 5a65a46bfe8671ea38710d0fbd230fe6a86ea508 Mon Sep 17 00:00:00 2001 +From: renoseven +Date: Fri, 18 Oct 2024 03:10:05 +0800 +Subject: [PATCH] syscared: fix active accepted patch failure issue + +Signed-off-by: renoseven +--- + syscared/src/patch/manager.rs | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/syscared/src/patch/manager.rs b/syscared/src/patch/manager.rs +index 3a724db..a17703c 100644 +--- a/syscared/src/patch/manager.rs ++++ b/syscared/src/patch/manager.rs +@@ -47,6 +47,7 @@ const PATCH_REMOVE: TransitionAction = &PatchManager::driver_remove_patch; + const PATCH_ACTIVE: TransitionAction = &PatchManager::driver_active_patch; + const PATCH_DEACTIVE: TransitionAction = &PatchManager::driver_deactive_patch; + const PATCH_ACCEPT: TransitionAction = &PatchManager::driver_accept_patch; ++const PATCH_DECLINE: TransitionAction = &PatchManager::driver_decline_patch; + + lazy_static! { + static ref STATUS_TRANSITION_MAP: IndexMap> = indexmap! { +@@ -59,9 +60,9 @@ lazy_static! { + (PatchStatus::Actived, PatchStatus::NotApplied) => vec![PATCH_DEACTIVE, PATCH_REMOVE], + (PatchStatus::Actived, PatchStatus::Deactived) => vec![PATCH_DEACTIVE], + (PatchStatus::Actived, PatchStatus::Accepted) => vec![PATCH_ACCEPT], +- (PatchStatus::Accepted, PatchStatus::NotApplied) => vec![PATCH_ACCEPT, PATCH_DEACTIVE, PATCH_REMOVE], +- (PatchStatus::Accepted, PatchStatus::Deactived) => vec![PATCH_ACCEPT, PATCH_DEACTIVE], +- (PatchStatus::Accepted, PatchStatus::Actived) => vec![PATCH_ACCEPT], ++ (PatchStatus::Accepted, PatchStatus::NotApplied) => vec![PATCH_DECLINE, PATCH_DEACTIVE, PATCH_REMOVE], ++ (PatchStatus::Accepted, PatchStatus::Deactived) => vec![PATCH_DECLINE, PATCH_DEACTIVE], ++ (PatchStatus::Accepted, PatchStatus::Actived) => vec![PATCH_DECLINE], + }; + } + +@@ -471,6 +472,10 @@ impl PatchManager { + fn driver_accept_patch(&mut self, patch: &Patch, _flag: PatchOpFlag) -> Result<()> { + self.set_patch_status(patch, PatchStatus::Accepted) + } ++ ++ fn driver_decline_patch(&mut self, patch: &Patch, _flag: PatchOpFlag) -> Result<()> { ++ self.set_patch_status(patch, PatchStatus::Actived) ++ } + } + + impl Drop for PatchManager { +-- +2.34.1 + diff --git a/0003-upatch-helper-fix-object-upatch-id-duplicated-issue.patch b/0004-upatch-helper-fix-object-upatch-id-duplicated-issue.patch similarity index 96% rename from 0003-upatch-helper-fix-object-upatch-id-duplicated-issue.patch rename to 0004-upatch-helper-fix-object-upatch-id-duplicated-issue.patch index 2ff01616d77364d8863d4a0247ed166c570ed5d6..e491876bc4a5098d56ef4855febbbc058719b595 100644 --- a/0003-upatch-helper-fix-object-upatch-id-duplicated-issue.patch +++ b/0004-upatch-helper-fix-object-upatch-id-duplicated-issue.patch @@ -1,4 +1,4 @@ -From 4efb5455073c23a6a90845eb541910eba6dc76f3 Mon Sep 17 00:00:00 2001 +From ab6bc4697532862a9cec3483ce1e24e268ea3a8f Mon Sep 17 00:00:00 2001 From: renoseven Date: Fri, 6 Sep 2024 22:14:11 +0800 Subject: [PATCH] upatch-helper: fix object upatch id duplicated issue diff --git a/0005-syscare-build-update-README.md.patch b/0005-syscare-build-update-README.md.patch new file mode 100644 index 0000000000000000000000000000000000000000..54860be1723ab05207490851f649bf07db708c2a --- /dev/null +++ b/0005-syscare-build-update-README.md.patch @@ -0,0 +1,170 @@ +From 5e878d9fd7c56591a42e851a3821fdcbd72becab Mon Sep 17 00:00:00 2001 +From: renoseven +Date: Mon, 23 Sep 2024 15:34:34 +0800 +Subject: [PATCH] syscare-build: update README.md + +Signed-off-by: renoseven +--- + syscare-build/README.md | 80 ++++++++++++++++++++--------------------- + 1 file changed, 40 insertions(+), 40 deletions(-) + +diff --git a/syscare-build/README.md b/syscare-build/README.md +index e0cf66e..1f05c74 100644 +--- a/syscare-build/README.md ++++ b/syscare-build/README.md +@@ -9,34 +9,29 @@ syscare build为纯CLI工具,提供从RPM包生成热补丁包的功能,补 + ## 命令行参数 + + ```bash +-Usage: syscare build [OPTIONS] --patch-name --source --debuginfo ... +- +-Arguments: +- ... Patch file(s) +- +-Options: +- -n, --patch-name Patch name +- --patch-arch Patch architecture [default: x86_64] +- --patch-version Patch version [default: 1] +- --patch-release Patch release [default: 1] +- --patch-description Patch description [default: (none)] +- -s, --source Source package +- -d, --debuginfo Debuginfo package +- --workdir Working directory [default: .] +- -o, --output Generated patch output directory [default: .] +- --jobs Parallel build jobs [default: 96] +- --skip-compiler-check Skip compiler version check (not recommended) +- --skip-cleanup Skip post-build cleanup +- -v, --verbose Provide more detailed info +- -h, --help Print help information +- -V, --version Print version information ++USAGE: ++ syscare build [OPTIONS] --patch-name --source ... --debuginfo ... --patch ... ++ ++OPTIONS: ++ -n, --patch-name Patch name ++ --patch-arch Patch architecture [default: x86_64] ++ --patch-version Patch version [default: 1] ++ --patch-release Patch release [default: 1] ++ --patch-description Patch description [default: (none)] ++ --patch-requires ... Patch requirements ++ -s, --source ... Source package(s) ++ -d, --debuginfo ... Debuginfo package(s) ++ -p, --patch ... Patch file(s) ++ --build-root Build directory [default: .] ++ -o, --output Output directory [default: .] ++ -j, --jobs Parallel build jobs [default: 20] ++ --skip-compiler-check Skip compiler version check (not recommended) ++ --skip-cleanup Skip post-build cleanup ++ -v, --verbose Provide more detailed info ++ -h, --help Print help information ++ -V, --version Print version information + ``` + +-### 参数 +-|名称|描述|类型|备注| +-| ---- | ---- | ---- | ---- | +-| ``````... |补丁文件路径|字符串|必选参数,可指定多个,需为合法路径| +- + ### 选项 + |名称|描述|类型|备注| + | ---- | ---- | ---- | ---- | +@@ -45,9 +40,11 @@ Options: + |--patch-version ``````|补丁版本号|字符串|默认值为1,需符合RPM命名规范| + |--patch-release ``````|补丁release|数字|默认值为1,需符合RPM命名规范| + |--patch-description ``````|补丁描述|字符串|默认为(none)| ++|--patch-requires ``````|补丁依赖|字符串|默认为(none)| + |-s, --source ``````|目标软件src.rpm源码包路径|字符串|必选参数,需为合法路径| + |-d, --debuginfo ``````|目标软件debuginfo包路径|字符串|必选参数,需为合法路径| +-|--workdir ``````|临时文件夹路径|字符串|默认为当前执行目录,需为合法路径| ++|-p, --patch ``````|目标软件debuginfo包路径|字符串|必选参数,需为合法路径| ++|--build-root ``````|编译临时目录|字符串|默认为当前执行目录| + |-o, --output ``````|补丁输出文件夹|字符串|默认为当前执行目录,需为合法路径| + |-j, --jobs ``````|并行编译线程数|数字|默认为cpu线程数| + |--skip-compiler-check|跳过编译器检查|标识|-| +@@ -103,17 +100,19 @@ syscare build \ + | arch | 补丁架构 | + | type | 补丁类型 | + | target | 目标软件名 | +-| target_elf | 目标软件可执行文件名称 | +-| digest | 补丁指纹 | + | license | 目标软件许可证 | + | description | 补丁描述 | +-| patch| 补丁文件列表 | ++| entities | 补丁实体列表 | ++| patch | 补丁文件列表 | + + + 示例: + + ```bash +-dev@openeuler-dev:[output]$ syscare info redis-6.2.5-1/HP001 ++dev@dev-x86:[output]$ syscare info redis-6.2.5-1/HP001-1-1 ++--------------------------------------------------- ++Patch: redis-6.2.5-1/HP001-1-1 ++--------------------------------------------------- + uuid: ec503257-aa75-4abc-9045-c4afdd7ae0f2 + name: HP001 + version: 1 +@@ -121,12 +120,15 @@ release: 1 + arch: x86_64 + type: UserPatch + target: redis-6.2.5-1 +-target_elf: redis-cli, redis-server, redis-benchmark +-digest: 31fc7544 + license: BSD and MIT + description: CVE-2021-32675 - When parsing an incoming Redis Standard Protocol (RESP) request, Redis allocates memory according to user-specified values which determine the number of elements (in the multi-bulk header) and size of each element (in the bulk header). An attacker delivering specially crafted requests over multiple connections can cause the server to allocate significant amount of memory. Because the same parsing mechanism is used to handle authentication requests, this vulnerability can also be exploited by unauthenticated users. ++entities: ++* redis-server ++* redis-cli ++* redis-benchmark + patch: +-31fc7544 0001-Prevent-unauthenticated-client-from-easily-consuming.patch ++* 0001-Prevent-unauthenticated-client-from-easily-consuming.patch ++--------------------------------------------------- + ``` + + +@@ -156,7 +158,7 @@ patch: + 示例: + + ```bash +- syscare-build \ ++ syscare build \ + --patch-name HP001 \ + --source kernel-5.10.0-60.66.0.91.oe2203.src.rpm \ + --debuginfo kernel-debuginfo-5.10.0-60.66.0.91.oe2203.x86_64.rpm \ +@@ -164,12 +166,10 @@ patch: + 001-kernel-patch-test.patch + ``` + +- 补丁制作过程将会在由`--workdir`参数所指定的目录中(默认为当前目录)创建以```syscare-build```开头的临时文件夹,用于存放临时文件及编译日志。 +- + 示例: + + ```bash +- dev@openeuler-dev:[kernel_patch]$ ls -l syscare-build.111602/ ++ dev@dev-x86:[kernel_patch]$ ls -l syscare-build.111602/ + total 100 + -rw-r--r--. 1 dev dev 92303 Nov 12 00:00 build.log + drwxr-xr-x. 6 dev dev 4096 Nov 12 00:00 package +@@ -177,7 +177,7 @@ patch: + ``` + 编译日志将会生成在临时文件夹中,名称为```build.log``` + ```bash +- dev@openeuler-dev:[kernel_patch]$ cat syscare-build.111602/build.log | less ++ dev@dev-x86:[kernel_patch]$ cat syscare-build.111602/build.log | less + ... + ``` + 若补丁制作成功,将不会保留该临时文件夹。 +@@ -187,7 +187,7 @@ patch: + 示例: + + ```bash +- dev@openeuler-dev:[output]$ ll ++ dev@dev-x86:[output]$ ll + total 372M + -rw-r--r--. 1 dev dev 186M Nov 12 00:00 kernel-5.10.0-60.80.0.104.oe2203-HP001-1-1.x86_64.src.rpm + -rw-r--r--. 1 dev dev 11K Nov 12 00:00 patch-kernel-5.10.0-60.80.0.104.oe2203-HP001-1-1.x86_64.rpm +-- +2.34.1 + diff --git a/0006-syscared-support-saving-restoring-patch-status-by-op.patch b/0006-syscared-support-saving-restoring-patch-status-by-op.patch new file mode 100644 index 0000000000000000000000000000000000000000..9699cd80093ffc95f39362fcd81971f1243417ed --- /dev/null +++ b/0006-syscared-support-saving-restoring-patch-status-by-op.patch @@ -0,0 +1,162 @@ +From d98892b0452499284fc577388cf8045af0ffa071 Mon Sep 17 00:00:00 2001 +From: renoseven +Date: Thu, 17 Oct 2024 22:24:21 +0800 +Subject: [PATCH] syscared: support saving & restoring patch status by + operation order + +Signed-off-by: renoseven +--- + syscared/Cargo.toml | 2 +- + syscared/src/patch/manager.rs | 84 ++++++++++++----------------------- + 2 files changed, 30 insertions(+), 56 deletions(-) + +diff --git a/syscared/Cargo.toml b/syscared/Cargo.toml +index 1bfd43f..2eecea8 100644 +--- a/syscared/Cargo.toml ++++ b/syscared/Cargo.toml +@@ -16,7 +16,7 @@ clap = { version = "3.2", features = ["cargo", "derive"] } + daemonize = { version = "0.5" } + flexi_logger = { version = "0.24", features = ["compress"] } + inotify = { version = "0.9" } +-indexmap = { version = "1.9" } ++indexmap = { version = "1.9", features = ["serde"] } + jsonrpc-core = { version = "18.0" } + jsonrpc-derive = { version = "18.0" } + jsonrpc-ipc-server = { version = "18.0" } +diff --git a/syscared/src/patch/manager.rs b/syscared/src/patch/manager.rs +index a17703c..48c583a 100644 +--- a/syscared/src/patch/manager.rs ++++ b/syscared/src/patch/manager.rs +@@ -13,8 +13,6 @@ + */ + + use std::{ +- cmp::Ordering, +- collections::HashMap, + path::{Path, PathBuf}, + str::FromStr, + sync::Arc, +@@ -221,19 +219,16 @@ impl PatchManager { + pub fn save_patch_status(&mut self) -> Result<()> { + info!("Saving all patch status..."); + +- debug!("Updating all patch status..."); ++ debug!("Updating patch status..."); + for patch in self.get_patch_list() { +- debug!("Update patch '{}' status", patch); + self.get_patch_status(&patch)?; + } + +- let mut status_map = HashMap::new(); ++ debug!("Writing patch status..."); + for (uuid, status) in &self.status_map { +- status_map.insert(uuid, status); ++ debug!("Patch '{}' status: {}", uuid, status); + } +- +- debug!("Writing patch status file"); +- serde::serialize(&status_map, &self.patch_status_file) ++ serde::serialize(&self.status_map, &self.patch_status_file) + .context("Failed to write patch status file")?; + + fs::sync(); +@@ -244,57 +239,35 @@ impl PatchManager { + + pub fn restore_patch_status(&mut self, accepted_only: bool) -> Result<()> { + info!("Restoring all patch status..."); ++ if !self.patch_status_file.exists() { ++ return Ok(()); ++ } + + debug!("Reading patch status..."); +- let status_file = &self.patch_status_file; +- let status_map: HashMap = if status_file.exists() { +- serde::deserialize(status_file).context("Failed to read patch status")? +- } else { +- warn!("Cannot find patch status file"); +- return Ok(()); +- }; ++ let status_map: IndexMap = ++ serde::deserialize(&self.patch_status_file).context("Failed to read patch status")?; ++ for (uuid, status) in &status_map { ++ debug!("Patch '{}' status: {}", uuid, status); ++ } + +- /* +- * To ensure that we won't load multiple patches for same target at the same time, +- * we take a sort operation of the status to make sure do REMOVE operation at first +- */ +- let mut restore_list = status_map ++ let restore_list = status_map + .into_iter() +- .filter_map(|(uuid, status)| match self.find_patch_by_uuid(&uuid) { ++ .filter(|(_, status)| !accepted_only || (*status == PatchStatus::Accepted)); ++ for (uuid, status) in restore_list { ++ match self.find_patch_by_uuid(&uuid) { + Ok(patch) => { +- if accepted_only && (status != PatchStatus::Accepted) { +- debug!( +- "Skipped patch '{}', status is not '{}'", +- patch, +- PatchStatus::Accepted +- ); +- return None; ++ debug!("Restore patch '{}' status to '{}'", patch, status); ++ if let Err(e) = self.do_status_transition(&patch, status, PatchOpFlag::Force) { ++ error!("{}", e); + } +- Some((patch, status)) + } + Err(e) => { +- error!("{:?}", e); +- None ++ error!("{}", e); + } +- }) +- .collect::>(); +- +- restore_list.sort_by(|(lhs_patch, lhs_status), (rhs_patch, rhs_status)| { +- match lhs_status.cmp(rhs_status) { +- Ordering::Less => Ordering::Less, +- Ordering::Equal => lhs_patch.cmp(rhs_patch), +- Ordering::Greater => Ordering::Greater, +- } +- }); +- +- for (patch, target_status) in restore_list { +- debug!("Restore patch '{}' status to '{}'", patch, target_status); +- if let Err(e) = self.do_status_transition(&patch, target_status, PatchOpFlag::Force) { +- error!("{}", e); + } + } +- info!("All patch status were restored"); + ++ info!("All patch status were restored"); + Ok(()) + } + +@@ -426,13 +399,14 @@ impl PatchManager { + bail!("Cannot set patch '{}' status to '{}'", patch, value); + } + +- let status_map = &mut self.status_map; +- match status_map.get_mut(patch.uuid()) { +- Some(status) => { +- *status = value; +- } +- None => { +- status_map.insert(*patch.uuid(), value); ++ let (index, _) = self.status_map.insert_full(*patch.uuid(), value); ++ if let Some(last_index) = self ++ .status_map ++ .last() ++ .and_then(|(key, _)| self.status_map.get_index_of(key)) ++ { ++ if index != last_index { ++ self.status_map.move_index(index, last_index); + } + } + +-- +2.34.1 + diff --git a/0007-project-update-Cargo.lock.patch b/0007-project-update-Cargo.lock.patch new file mode 100644 index 0000000000000000000000000000000000000000..4649e6cac8cd04475e758827ec6c705344ad7af1 --- /dev/null +++ b/0007-project-update-Cargo.lock.patch @@ -0,0 +1,34 @@ +From ad418b6d9f30bda58488da27257efe10ca2906e3 Mon Sep 17 00:00:00 2001 +From: renoseven +Date: Thu, 17 Oct 2024 23:15:46 +0800 +Subject: [PATCH] project: update Cargo.lock + +Signed-off-by: renoseven +--- + Cargo.lock | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/Cargo.lock b/Cargo.lock +index 48ca061..30f2015 100644 +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -511,6 +511,7 @@ checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" + dependencies = [ + "autocfg", + "hashbrown", ++ "serde", + ] + + [[package]] +@@ -1337,7 +1338,7 @@ name = "upatch-helper" + version = "1.2.2" + dependencies = [ + "anyhow", +- "syscare-common", ++ "uuid", + ] + + [[package]] +-- +2.34.1 + diff --git a/0008-all-remove-signal-handler.patch b/0008-all-remove-signal-handler.patch new file mode 100644 index 0000000000000000000000000000000000000000..d5980eacdf00d4ad9cb2a3c19648e51cc07c7c70 --- /dev/null +++ b/0008-all-remove-signal-handler.patch @@ -0,0 +1,74 @@ +From 5daf18084f8d2865db24b6627d2d28d9234bcf5c Mon Sep 17 00:00:00 2001 +From: renoseven +Date: Mon, 10 Feb 2025 10:49:49 +0800 +Subject: [PATCH] all: remove signal handler + +Signed-off-by: renoseven +--- + syscare-build/Cargo.toml | 1 - + syscare-build/src/main.rs | 6 ------ + upatch-build/Cargo.toml | 1 - + upatch-build/src/main.rs | 6 ------ + 4 files changed, 14 deletions(-) + +diff --git a/syscare-build/Cargo.toml b/syscare-build/Cargo.toml +index 558b2bc..ba4d1c8 100644 +--- a/syscare-build/Cargo.toml ++++ b/syscare-build/Cargo.toml +@@ -14,7 +14,6 @@ syscare-common = { package = "syscare-common", path = "../syscare-common" } + anyhow = { version = "1.0" } + clap = { version = "3.2", features = ["derive"] } + chrono = { version = "0.4" } +-ctrlc = { version = "3.3" } + flexi_logger = { version = "0.24" } + lazy_static = { version = "1.0" } + log = { version = "0.4" } +diff --git a/syscare-build/src/main.rs b/syscare-build/src/main.rs +index 2fb714d..64363bf 100644 +--- a/syscare-build/src/main.rs ++++ b/syscare-build/src/main.rs +@@ -103,12 +103,6 @@ impl SyscareBuild { + .start() + .context("Failed to initialize logger")?; + +- // Initialize signal handler +- ctrlc::set_handler(|| { +- eprintln!("Interrupt"); +- }) +- .context("Failed to initialize signal handler")?; +- + Ok(Self { + args, + logger, +diff --git a/upatch-build/Cargo.toml b/upatch-build/Cargo.toml +index 5123149..88d88b3 100644 +--- a/upatch-build/Cargo.toml ++++ b/upatch-build/Cargo.toml +@@ -12,7 +12,6 @@ build = "build.rs" + syscare-common = { package = "syscare-common", path = "../syscare-common" } + anyhow = { version = "1.0" } + clap = { version = "3.2", features = ["cargo", "derive"] } +-ctrlc = { version = "3.3" } + flexi_logger = { version = "0.24" } + function_name = { version = "0.3" } + gimli = { version = "0.26" } +diff --git a/upatch-build/src/main.rs b/upatch-build/src/main.rs +index 77b256a..09f907b 100644 +--- a/upatch-build/src/main.rs ++++ b/upatch-build/src/main.rs +@@ -98,12 +98,6 @@ impl UpatchBuild { + .start() + .context("Failed to initialize logger")?; + +- // Initialize signal handler +- ctrlc::set_handler(|| { +- eprintln!("Interrupt"); +- }) +- .context("Failed to initialize signal handler")?; +- + Ok(Self { + args, + logger, +-- +2.34.1 + diff --git a/0009-project-update-Cargo.lock.patch b/0009-project-update-Cargo.lock.patch new file mode 100644 index 0000000000000000000000000000000000000000..d1bcc1844d402762201fcb7df04cf26c4c47d53e --- /dev/null +++ b/0009-project-update-Cargo.lock.patch @@ -0,0 +1,66 @@ +From bed35b84e7cbeaafd16c9c01650243ae548a9c14 Mon Sep 17 00:00:00 2001 +From: renoseven +Date: Mon, 10 Feb 2025 11:49:40 +0800 +Subject: [PATCH] project: update Cargo.lock + +Signed-off-by: renoseven +--- + Cargo.lock | 21 --------------------- + 1 file changed, 21 deletions(-) + +diff --git a/Cargo.lock b/Cargo.lock +index 30f2015..6ae9f36 100644 +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -210,16 +210,6 @@ dependencies = [ + "typenum", + ] + +-[[package]] +-name = "ctrlc" +-version = "3.3.0" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-checksum = "04d778600249295e82b6ab12e291ed9029407efee0cfb7baf67157edc65964df" +-dependencies = [ +- "nix", +- "windows-sys", +-] +- + [[package]] + name = "daemonize" + version = "0.5.0" +@@ -1140,7 +1130,6 @@ dependencies = [ + "anyhow", + "chrono", + "clap", +- "ctrlc", + "flexi_logger", + "lazy_static", + "log", +@@ -1317,7 +1306,6 @@ version = "1.2.2" + dependencies = [ + "anyhow", + "clap", +- "ctrlc", + "flexi_logger", + "function_name", + "gimli", +@@ -1474,15 +1462,6 @@ dependencies = [ + "windows-targets", + ] + +-[[package]] +-name = "windows-sys" +-version = "0.48.0" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +-dependencies = [ +- "windows-targets", +-] +- + [[package]] + name = "windows-targets" + version = "0.48.5" +-- +2.34.1 + diff --git a/0010-syscare-remove-working-directory-check.patch b/0010-syscare-remove-working-directory-check.patch new file mode 100644 index 0000000000000000000000000000000000000000..a4a9e1a056864bc895c98bae8bd0859fb55b1ab2 --- /dev/null +++ b/0010-syscare-remove-working-directory-check.patch @@ -0,0 +1,52 @@ +From 707475a7361b6f16ca2b9e62f222b1982a57e506 Mon Sep 17 00:00:00 2001 +From: renoseven +Date: Mon, 10 Feb 2025 14:21:29 +0800 +Subject: [PATCH] syscare: remove working directory check + +Signed-off-by: renoseven +--- + syscare/src/args.rs | 14 ++------------ + 1 file changed, 2 insertions(+), 12 deletions(-) + +diff --git a/syscare/src/args.rs b/syscare/src/args.rs +index 4f034a0..5e7299d 100644 +--- a/syscare/src/args.rs ++++ b/syscare/src/args.rs +@@ -14,7 +14,7 @@ + + use std::path::PathBuf; + +-use anyhow::{ensure, Result}; ++use anyhow::Result; + use clap::{AppSettings, ColorChoice, Parser, Subcommand}; + + use syscare_common::fs; +@@ -131,7 +131,7 @@ pub enum SubCommand { + + impl Arguments { + pub fn new() -> Result { +- Self::parse().normalize_path().and_then(Self::check) ++ Self::parse().normalize_path() + } + + fn normalize_path(mut self) -> Result { +@@ -139,16 +139,6 @@ impl Arguments { + + Ok(self) + } +- +- fn check(self) -> Result { +- let work_dir = &self.work_dir; +- ensure!( +- work_dir.is_dir(), +- format!("Cannot find directory {}", work_dir.display()) +- ); +- +- Ok(self) +- } + } + + impl std::fmt::Display for Arguments { +-- +2.34.1 + diff --git a/0011-all-fix-cargo-clippy-warnings.patch b/0011-all-fix-cargo-clippy-warnings.patch new file mode 100644 index 0000000000000000000000000000000000000000..3f8ef8e36611a31784b056dbb5ed28b65d10c344 --- /dev/null +++ b/0011-all-fix-cargo-clippy-warnings.patch @@ -0,0 +1,162 @@ +From 2af03514afcc797cac3125c7b04ee0f5eae43aa0 Mon Sep 17 00:00:00 2001 +From: renoseven +Date: Mon, 10 Feb 2025 10:29:00 +0800 +Subject: [PATCH] all: fix cargo clippy warnings + +Signed-off-by: renoseven +--- + syscare-common/src/ffi/os_str.rs | 2 +- + syscare-common/src/fs/fs_impl.rs | 4 ++-- + syscare-common/src/os_str/iter.rs | 2 +- + syscare-common/src/process/stdio.rs | 4 ++-- + syscared/src/args.rs | 1 - + syscared/src/patch/resolver/kpatch.rs | 2 +- + syscared/src/patch/resolver/upatch.rs | 2 +- + upatch-build/src/dwarf/mod.rs | 6 +++--- + upatch-build/src/dwarf/relocate.rs | 4 ++-- + 9 files changed, 13 insertions(+), 14 deletions(-) + +diff --git a/syscare-common/src/ffi/os_str.rs b/syscare-common/src/ffi/os_str.rs +index 375ef82..0c414e1 100644 +--- a/syscare-common/src/ffi/os_str.rs ++++ b/syscare-common/src/ffi/os_str.rs +@@ -119,7 +119,7 @@ pub trait OsStrExt: AsRef { + } + } + +- fn split<'a, P: Pattern<'a>>(&'a self, pat: P) -> Split

{ ++ fn split<'a, P: Pattern<'a>>(&'a self, pat: P) -> Split<'a, P> { + let haystack = self.as_ref().as_bytes(); + + Split(SplitImpl { +diff --git a/syscare-common/src/fs/fs_impl.rs b/syscare-common/src/fs/fs_impl.rs +index 23f8493..30c11b7 100644 +--- a/syscare-common/src/fs/fs_impl.rs ++++ b/syscare-common/src/fs/fs_impl.rs +@@ -379,10 +379,10 @@ where + if !file_type.is_file() { + return false; + } +- return file_path ++ file_path + .extension() + .map(|s| s == ext.as_ref()) +- .unwrap_or(false); ++ .unwrap_or(false) + }) + } + +diff --git a/syscare-common/src/os_str/iter.rs b/syscare-common/src/os_str/iter.rs +index 2868c2e..e472d0c 100644 +--- a/syscare-common/src/os_str/iter.rs ++++ b/syscare-common/src/os_str/iter.rs +@@ -165,7 +165,7 @@ impl<'a, P: Pattern<'a>> SplitImpl<'a, P> { + } + + self.finished = true; +- return Some(OsStr::from_bytes(&haystack[self.position..])); ++ Some(OsStr::from_bytes(&haystack[self.position..])) + } + } + +diff --git a/syscare-common/src/process/stdio.rs b/syscare-common/src/process/stdio.rs +index 450019a..9a93e56 100644 +--- a/syscare-common/src/process/stdio.rs ++++ b/syscare-common/src/process/stdio.rs +@@ -160,10 +160,10 @@ impl Stdio { + } + } + } +- if stdout_buf.ends_with(&[b'\n']) { ++ if stdout_buf.ends_with(b"\n") { + stdout_buf.pop(); + } +- if stderr_buf.ends_with(&[b'\n']) { ++ if stderr_buf.ends_with(b"\n") { + stderr_buf.pop(); + } + +diff --git a/syscared/src/args.rs b/syscared/src/args.rs +index 4c28dff..f98b54b 100644 +--- a/syscared/src/args.rs ++++ b/syscared/src/args.rs +@@ -37,7 +37,6 @@ const DEFAULT_LOG_LEVEL: &str = "info"; + global_setting(AppSettings::DeriveDisplayOrder), + term_width(120), + )] +- + pub struct Arguments { + /// Run as a daemon + #[clap(short, long)] +diff --git a/syscared/src/patch/resolver/kpatch.rs b/syscared/src/patch/resolver/kpatch.rs +index 85ec18e..863f65b 100644 +--- a/syscared/src/patch/resolver/kpatch.rs ++++ b/syscared/src/patch/resolver/kpatch.rs +@@ -86,7 +86,7 @@ mod ffi { + } + } + +- impl<'data, 'file, Elf: FileHeader> Iterator for KpatchRelocationIterator<'data, 'file, Elf> { ++ impl Iterator for KpatchRelocationIterator<'_, '_, Elf> { + type Item = KpatchRelocation; + + fn next(&mut self) -> Option { +diff --git a/syscared/src/patch/resolver/upatch.rs b/syscared/src/patch/resolver/upatch.rs +index e8c2f2c..e49dff9 100644 +--- a/syscared/src/patch/resolver/upatch.rs ++++ b/syscared/src/patch/resolver/upatch.rs +@@ -73,7 +73,7 @@ mod ffi { + } + } + +- impl<'data, 'file, Elf: FileHeader> Iterator for UpatchRelocationIterator<'data, 'file, Elf> { ++ impl Iterator for UpatchRelocationIterator<'_, '_, Elf> { + type Item = UpatchRelocation; + + fn next(&mut self) -> Option { +diff --git a/upatch-build/src/dwarf/mod.rs b/upatch-build/src/dwarf/mod.rs +index 0c172c5..4399b51 100644 +--- a/upatch-build/src/dwarf/mod.rs ++++ b/upatch-build/src/dwarf/mod.rs +@@ -233,13 +233,13 @@ impl Dwarf { + while let Some(attr) = attrs.next()? { + match attr.name() { + constants::DW_AT_comp_dir => { +- element.compile_dir.push(&Self::attr_value(&attr, dwarf)); ++ element.compile_dir.push(Self::attr_value(&attr, dwarf)); + } + constants::DW_AT_name => { +- element.file_name.push(&Self::attr_value(&attr, dwarf)); ++ element.file_name.push(Self::attr_value(&attr, dwarf)); + } + constants::DW_AT_producer => { +- element.producer.push(&Self::attr_value(&attr, dwarf)); ++ element.producer.push(Self::attr_value(&attr, dwarf)); + } + _ => continue, + } +diff --git a/upatch-build/src/dwarf/relocate.rs b/upatch-build/src/dwarf/relocate.rs +index e8c7cdf..a6e8fb9 100644 +--- a/upatch-build/src/dwarf/relocate.rs ++++ b/upatch-build/src/dwarf/relocate.rs +@@ -25,7 +25,7 @@ pub struct Relocate<'a, R: gimli::Reader> { + pub reader: R, + } + +-impl<'a, R: gimli::Reader> Relocate<'a, R> { ++impl> Relocate<'_, R> { + pub fn relocate(&self, offset: usize, value: u64) -> u64 { + if let Some(relocation) = self.relocations.get(&offset) { + if relocation.kind() == object::RelocationKind::Absolute { +@@ -41,7 +41,7 @@ impl<'a, R: gimli::Reader> Relocate<'a, R> { + } + } + +-impl<'a, R: gimli::Reader> gimli::Reader for Relocate<'a, R> { ++impl> gimli::Reader for Relocate<'_, R> { + type Endian = R::Endian; + type Offset = R::Offset; + +-- +2.34.1 + diff --git a/syscare.spec b/syscare.spec index 199220dbaf0ef68502e8ff21b1032b3f374782eb..91148bec97e1e4f71cac28da4d3ea73f6048708e 100644 --- a/syscare.spec +++ b/syscare.spec @@ -5,7 +5,7 @@ ############################################ Name: syscare Version: 1.2.2 -Release: 2 +Release: 4 Summary: System hot-fix service License: MulanPSL-2.0 and GPL-2.0-only URL: https://gitee.com/openeuler/syscare @@ -21,7 +21,15 @@ Excludearch: loongarch64 Patch0001: 0001-fix-kernel-patch-ACCEPTED-change-to-DEACTIVED-after-.patch Patch0002: 0002-fix-some-clean-code-problem.patch -Patch0003: 0003-upatch-helper-fix-object-upatch-id-duplicated-issue.patch +Patch0003: 0003-syscared-fix-active-accepted-patch-failure-issue.patch +Patch0004: 0004-upatch-helper-fix-object-upatch-id-duplicated-issue.patch +Patch0005: 0005-syscare-build-update-README.md.patch +Patch0006: 0006-syscared-support-saving-restoring-patch-status-by-op.patch +Patch0007: 0007-project-update-Cargo.lock.patch +Patch0008: 0008-all-remove-signal-handler.patch +Patch0009: 0009-project-update-Cargo.lock.patch +Patch0010: 0010-syscare-remove-working-directory-check.patch +Patch0011: 0011-all-fix-cargo-clippy-warnings.patch ############### Description ################ %description @@ -128,6 +136,15 @@ Syscare patch building toolset. ################ Change log ################ ############################################ %changelog +* Thu Feb 20 2025 renoseven - 1.2.2-4 +- all: fix rust 1.84 compile failure +- syscare: fix cannot find working directory +- syscare-build: fix set signal handler failure +- syscared: fix active accepted patch failure + +* Mon Nov 11 2024 renoseven - 1.2.2-3 +- syscared: support saving & restoring patch status by operation order + * Wed Sep 18 2024 renoseven - 1.2.2-2 - syscared: fix kernel patch apply failure issue - upatch-helper: fix object upatch id duplicated issue