!90 sync patches from upstream

From: @jiayi0118 
Reviewed-by: @licunlong 
Signed-off-by: @licunlong
This commit is contained in:
openeuler-ci-bot 2024-04-19 01:25:34 +00:00 committed by Gitee
commit deb88caec6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 113 additions and 1 deletions

View File

@ -0,0 +1,36 @@
From 78e39ccc831dcc3e2ceb365df492a544ae84ff5f Mon Sep 17 00:00:00 2001
From: chenjiayi <chenjiayi22@huawei.com>
Date: Tue, 9 Apr 2024 19:27:45 +0800
Subject: [PATCH 1/3] fix(devmaster): correct the database path
The database is not cleaned up after remove uevent, as the database
path is incorrect.
---
exts/devmaster/src/lib/utils/commons.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/exts/devmaster/src/lib/utils/commons.rs b/exts/devmaster/src/lib/utils/commons.rs
index 700caf2d..80e37b3a 100644
--- a/exts/devmaster/src/lib/utils/commons.rs
+++ b/exts/devmaster/src/lib/utils/commons.rs
@@ -19,7 +19,7 @@ use std::{
use crate::{error::*, log_dev, rules::FormatSubstitutionType, utils::trie::*};
use basic::{error::errno_is_privilege, IN_SET};
-use device::{Device, DB_BASE_DIR};
+use device::{Device, DB_BASE_DIR, DEFAULT_BASE_DIR};
use lazy_static::lazy_static;
use nix::{errno::Errno, unistd::unlink};
use snafu::ResultExt;
@@ -575,7 +575,7 @@ pub(crate) fn device_update_tag(
pub(crate) fn cleanup_db(dev: Rc<Device>) -> Result<()> {
let id = dev.get_device_id().context(DeviceSnafu)?;
- let db_path = format!("{}{}", DB_BASE_DIR, id);
+ let db_path = format!("{}/{}/{}", DEFAULT_BASE_DIR, DB_BASE_DIR, id);
match unlink(db_path.as_str()) {
Ok(_) => log_dev!(debug, dev, format!("unlinked '{}'", db_path)),
--
2.33.0

View File

@ -0,0 +1,43 @@
From 90bab54b6648407577082c6baf80e766a6ad8c61 Mon Sep 17 00:00:00 2001
From: chenjiayi <chenjiayi22@huawei.com>
Date: Wed, 17 Apr 2024 18:41:39 +0800
Subject: [PATCH 2/3] fix(devmaster): fix incorrect cmdline parameter value due
to previous refactor
Previous 87234aafd1ab7a82588e45b8d104bda2d708ef90 changed the procedure on how to
get a cmdline parameter. The logic in devmaster was not modified synchronously.
---
exts/devmaster/src/lib/rules/exec_mgr.rs | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/exts/devmaster/src/lib/rules/exec_mgr.rs b/exts/devmaster/src/lib/rules/exec_mgr.rs
index 22b9a2ad..54e0093e 100644
--- a/exts/devmaster/src/lib/rules/exec_mgr.rs
+++ b/exts/devmaster/src/lib/rules/exec_mgr.rs
@@ -903,20 +903,16 @@ impl ExecuteManager {
}
MatchImportCmdline => {
let cmdline = basic::cmdline::Cmdline::default();
- let s = cmdline.get_param(&token_value);
- if s.is_none() {
+ if !cmdline.has_param(&token_value) {
return Ok(token.read().unwrap().as_ref().unwrap().op == OperatorType::Nomatch);
}
- let value = match s.as_ref().unwrap().split_once('=') {
- Some(ret) => ret.1,
- None => "",
- };
+ let value = cmdline.get_param(&token_value);
execute_err!(
token.read().unwrap().as_ref().unwrap(),
- device.add_property(&token_value, if value.is_empty() { "1" } else { value })
+ device.add_property(&token_value, &value.unwrap_or_default())
)?;
Ok(token.read().unwrap().as_ref().unwrap().op == OperatorType::Match)
--
2.33.0

View File

@ -0,0 +1,27 @@
From c486f1c60dbf56fc174f3c488484fc6e0a8b903d Mon Sep 17 00:00:00 2001
From: chenjiayi <chenjiayi22@huawei.com>
Date: Wed, 17 Apr 2024 18:52:58 +0800
Subject: [PATCH 3/3] fix(devmaster): supply log messages on loading .link
config files
Supply missed log messages.
---
exts/devmaster/src/lib/config/netif_conf.rs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/exts/devmaster/src/lib/config/netif_conf.rs b/exts/devmaster/src/lib/config/netif_conf.rs
index 9c593902..44ae7f72 100644
--- a/exts/devmaster/src/lib/config/netif_conf.rs
+++ b/exts/devmaster/src/lib/config/netif_conf.rs
@@ -132,6 +132,8 @@ impl NetifConfigCtx {
if name.ends_with(".link") {
let conf_path = dir_path.join(&name);
+ log::debug!("loading .link config: {:?}", conf_path);
+
let s = match std::fs::read_to_string(&conf_path) {
Ok(content) => content,
Err(e) => {
--
2.33.0

View File

@ -12,7 +12,7 @@
Name: sysmaster
Version: 1.0.0
Release: 5
Release: 6
Summary: redesign and reimplement process1.
License: Mulan PSL v2
@ -23,6 +23,9 @@ Patch0: backport-feature-devmaster-add-net_driver-builtin-to-be-compa.pa
Patch1: backport-fix-resolve-wantedby-invalid.patch
Patch2: backport-fix-read-pid-cmdline-incorrect.patch
Patch3: backport-fix-resolve-not-mount-home.patch
Patch4: backport-fix-devmaster-correct-the-database-path.patch
Patch5: backport-fix-devmaster-fix-incorrect-cmdline-parameter-value-.patch
Patch6: backport-fix-devmaster-supply-log-messages-on-loading-.link-c.patch
ExclusiveArch: x86_64 aarch64
@ -164,6 +167,9 @@ if [ $1 -eq 0 ] ; then
fi
%changelog
* Thu Apr 18 2024 chenjiayi<chenjiayi22@huawei.com> - 1.0.0-6
- sync patches from upstream
* Wed Apr 17 2024 zhangyao<zhangyao108@huawei.com> - 1.0.0-5
- resolve not mounted home