From f23911aa146ca15685802dfbc1686ac2bcaa76d8 Mon Sep 17 00:00:00 2001 From: wangrong Date: Fri, 6 Nov 2026 19:27:04 +0800 Subject: [PATCH] fix: remove auth check from USB hot-plug refresh methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Root cause: updateUsb()/updateUsbRemove() are called by udev scripts via fire-and-forget dbus-send; checkAuthorization() fails because the caller has already disconnected (NameHasNoOwner), so the method body never executes and the UI never refreshes 2. Fix: remove checkAuthorization() guard from updateUsb() and updateUsbRemove(), making Qt6 behavior equivalent to the Qt5 build where NO_DBUS_CALLER_AUTH_CHECK skips the check entirely 3. Impact: only USB hot-plug refresh path is affected; all other DBus methods retain their authorization checks; callers are limited to USBadd.sh/USBremove.sh udev scripts Influence: 1. Test USB device insertion triggers automatic UI refresh 2. Test USB device removal triggers automatic UI refresh 3. Verify other DBus methods still enforce authorization fix: 移除USB热插拔刷新方法的鉴权守卫 1. 根因:updateUsb()/updateUsbRemove() 由 udev 脚本通过 fire-and-forget dbus-send 调用,checkAuthorization() 因 caller 已断开连接(NameHasNoOwner)而失败,方法体从未执行,界面不刷新 2. 方案:从 updateUsb() 和 updateUsbRemove() 移除 checkAuthorization() 守卫,使 Qt6 行为与 Qt5 构建下 NO_DBUS_CALLER_AUTH_CHECK 跳过鉴权的行为等效 3. 影响:仅 USB 热插拔刷新路径受影响,其余 DBus 方法鉴权不变; 调用方仅 USBadd.sh/USBremove.sh udev 脚本 Influence: 1. 测试插入USB设备后界面自动刷新 2. 测试拔出USB设备后界面自动刷新 3. 验证其余DBus方法鉴权行为不受影响 PMS: BUG-362437 --- service/diskmanagerservice.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/service/diskmanagerservice.cpp b/service/diskmanagerservice.cpp index 66fe7b1..b7fef3d 100644 --- a/service/diskmanagerservice.cpp +++ b/service/diskmanagerservice.cpp @@ -472,16 +472,10 @@ bool DiskManagerService::onDeletePVList(QList devList) } void DiskManagerService::updateUsb() { - if (!checkAuthorization()) - return; - m_partedcore->updateUsb(); } void DiskManagerService::updateUsbRemove() { - if (!checkAuthorization()) - return; - m_partedcore->updateUsbRemove(); } void DiskManagerService::refreshFunc()