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

