From 9a53e42710d23a46e6de086b8b79971cb3a9fbf8 Mon Sep 17 00:00:00 2001 From: yeshanshan Date: Thu, 5 Mar 2026 16:35:06 +0800 Subject: [PATCH] fix: remove fallback to file mode in DConfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Removed the fallback mechanism from DBus mode to file mode in DConfig 2. DConfig now only supports DBus mode by default without falling back to file mode 3. This prevents applications from creating directories when calling interfaces during image building The change removes the automatic fallback to FileBackend when DBusBackend is unavailable. Previously, if DBus service wasn't available, DConfig would fall back to file mode which could cause directory creation during container/image building. Now it will only use DBus mode or fail if DBus is unavailable. Influence: 1. Test DConfig initialization when DBus service is available 2. Verify DConfig fails gracefully when DBus service is unavailable 3. Test that no directories are created during container/image building scenarios 4. Verify existing DBus-based configurations continue to work correctly 5. Test application behavior when DConfig cannot initialize due to missing DBus fix: 移除 DConfig 中回退到文件模式的机制 1. 移除了 DConfig 中从 DBus 模式回退到文件模式的机制 2. DConfig 现在默认只支持 DBus 模式,不会回退到文件模式 3. 这可以防止在构建镜像时,应用程序调用接口去创建目录 此更改移除了当 DBusBackend 不可用时自动回退到 FileBackend 的机制。之前, 如果 DBus 服务不可用,DConfig 会回退到文件模式,这可能导致在容器/镜像构 建期间创建目录。现在它只会使用 DBus 模式,或者在 DBus 不可用时失败。 Influence: 1. 测试当 DBus 服务可用时的 DConfig 初始化 2. 验证当 DBus 服务不可用时 DConfig 优雅地失败 3. 测试在容器/镜像构建场景下不会创建目录 4. 验证现有的基于 DBus 的配置继续正常工作 5. 测试由于缺少 DBus 导致 DConfig 无法初始化时的应用程序行为 PMS: BUG-312173 --- src/dconfig.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/dconfig.cpp b/src/dconfig.cpp index 5a1b4d22..5583d47c 100644 --- a/src/dconfig.cpp +++ b/src/dconfig.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2021 - 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2021 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: LGPL-3.0-or-later @@ -557,10 +557,6 @@ DConfigBackend *DConfigPrivate::getOrCreateBackend() qCDebug(cfLog, "Fallback to DBus mode"); backend.reset(new DBusBackend(this)); } - if (!backend) { - qCDebug(cfLog, "Can't use DBus config service, fallback to DConfigFile mode"); - backend.reset(new FileBackend(this)); - } #else backend.reset(new FileBackend(this)); #endif //D_DISABLE_DBUS_CONFIG