fix(dfm-mount): stop GMountOperation signal emission to prevent premature UNHANDLED reply - #389
Merged
deepin-bot[bot] merged 1 commit intoSep 8, 2026
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe PR fixes a GLib signal-handler race in GVFS mounting by stopping the default ask-question and ask-password emissions, ensuring custom handlers explicitly reply and preventing stale UNHANDLED responses from prematurely aborting first-time SFTP mounts. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
…ture UNHANDLED reply Root cause: gio's GMountOperation default class handlers (G_SIGNAL_RUN_LAST) schedule an idle reply of G_MOUNT_OPERATION_UNHANDLED after instance handlers return. On first-time SFTP login, gvfs sends ask-question (host key) followed by ask-password. The stale UNHANDLED idle queued by the question stage may still be pending when the AskPassword DBus call is dispatched (priority race: G_PRIORITY_DEFAULT dispatch vs G_PRIORITY_DEFAULT_IDLE idle); it then fires inside the modal password dialog's nested event loop, completes the pending AskPassword invocation as handled=FALSE, and gvfs fails the mount with "Password dialog cancelled" (密码对话框被取消) — reproducible when the UI is busy/event-starved on the password dialog, exactly matching the reported first-login SFTP mount failure. Fix: call g_signal_stop_emission_by_name() in both mountByGvfsAskQuestion and mountByGvfsAskPasswd, same as gvfs' own client implementation (gmountsource.c op_ask_password/op_ask_question). All reply paths already call g_mount_operation_reply explicitly, so stopping the default handler is safe. Verified with a minimal gio reproducer against a local SFTP server: - busy mode (stale idle + nested dialog loop): mount fails with "密码对话框被取消" (G_IO_ERROR_FAILED_HANDLED) before the fix - with stop_emission: mount succeeds under identical conditions Log: 修复首次登录挂载sftp点击仍然登录后提示挂载失败密码对话框被取消 Influence: sftp/ftp/smb 挂载过程中密码与主机密钥确认对话框交互不再被 gio 默认处理器竞态打断 Bug: https://pms.uniontech.com/bug-view-376305.html Change-Id: I1f9e2d6c4b7a48e3952f0a1d8e6c5b3a7f2d4e8c
pppanghu77
force-pushed
the
fix/sftp-mount-password-dialog-cancelled
branch
from
September 8, 2026 05:57
12c96dd to
a7e3350
Compare
Johnson-zs
approved these changes
Sep 8, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Johnson-zs, pppanghu77 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Contributor
Author
|
/merge |
deepin-bot
Bot
merged commit Sep 8, 2026
8081779
into
linuxdeepin:develop/meagle-20260526
17 checks passed
This was referenced Sep 8, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题现象
首次登录挂载 SFTP 时,在主机密钥确认框点击「仍然登录」后,挂载失败并弹窗提示:挂载失败,密码对话框被取消(gvfs: "Password dialog cancelled"),用户实际从未取消任何对话框。低性能/界面繁忙环境(如 FT-D2000)上稳定复现。
根因
gio 的
GMountOperation默认类处理器(G_SIGNAL_RUN_LAST)会在实例处理器返回后,通过 idle(G_PRIORITY_DEFAULT_IDLE)异步回复G_MOUNT_OPERATION_UNHANDLED(glib/gio/gmountoperation.creply_non_handled_in_idle)。首次登录 SFTP 的完整触发链:
G_PRIORITY_DEFAULT)会先于残留 idle 执行,弹出密码对话框(嵌套事件循环);g_mount_operation_reply(op, UNHANDLED)命中此刻已连接的临时 reply 处理器(gmountoperationdbus.c)→ 挂载操作以handled=FALSE被提前作答;aborted=TRUE→G_IO_ERROR_FAILED_HANDLED+ "Password dialog cancelled"。只有首次登录才有主机密钥询问(残留 idle 的唯一来源),与缺陷「前置条件:未登录过 sftp」完全吻合。
修复
在
mountByGvfsAskQuestion/mountByGvfsAskPasswd入口调用g_signal_stop_emission_by_name(),与 gvfs 官方客户端实现(gmountsource.cop_ask_password/op_ask_question)做法一致。两个处理器的所有返回路径均已显式调用g_mount_operation_reply(HANDLED/ABORTED),停止默认处理器不会留下未应答的 DBus 调用;对 SMB/FTP 非首次登录流程无行为影响。验证
最小 gio 复现程序(本机 UOS 20 + gvfs 1.38 + glib 2.58.3,paramiko 模拟 SFTP 服务器)三组对照:
Log: 修复首次登录挂载sftp点击仍然登录后提示挂载失败密码对话框被取消
Influence: sftp/ftp/smb 挂载过程中密码与主机密钥确认对话框交互不再被 gio 默认处理器竞态打断
Summary by Sourcery
Prevent GIO mount-operation signal races from prematurely aborting interactive SFTP mounts.
Bug Fixes:
Bug: https://pms.uniontech.com/bug-view-376305.html