Skip to content

fix(dfm-mount): stop GMountOperation signal emission to prevent premature UNHANDLED reply - #391

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
Johnson-zs:agent/pms-bug-bot/62bc98c46d76
Sep 8, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
Johnson-zs:agent/pms-bug-bot/62bc98c46d76

Conversation

@Johnson-zs

@Johnson-zs Johnson-zs commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Cherry-pick of PR #389 to master.

Cherry-pick of commit 8081779 to the master branch.

Changes: In src/dfm-mount/private/dnetworkmounter.cpp, add g_signal_stop_emission_by_name() calls at the entry of mountByGvfsAskQuestion and mountByGvfsAskPasswd to prevent premature UNHANDLED reply when mounting SFTP for the first time.

Compilation verified: cmake -B build -DCMAKE_BUILD_TYPE=Release + cmake --build build --target dfm6-mount passes with no new errors or warnings.

Summary by Sourcery

Bug Fixes:

  • Prevent premature GMountOperation UNHANDLED replies during initial SFTP mounting, avoiding spurious password-dialog cancellation after host-key confirmation.

…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
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Johnson-zs

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai

sourcery-ai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates GVFS question and password handlers to stop GMountOperation’s default signal emission, preventing stale idle UNHANDLED responses from racing with SFTP authentication dialogs and causing first-time mounts to fail as cancelled.

Sequence diagram for preventing premature SFTP mount cancellation

sequenceDiagram
    participant GVFS
    participant GMountOperation
    participant DNetworkMounter
    participant Dialog as AuthenticationDialog

    GVFS->>GMountOperation: emit ask-question or ask-password
    GMountOperation->>DNetworkMounter: mountByGvfsAskQuestion() / mountByGvfsAskPasswd()
    DNetworkMounter->>GMountOperation: g_signal_stop_emission_by_name()
    DNetworkMounter->>Dialog: show host-key or password dialog
    Dialog-->>DNetworkMounter: explicit reply
    DNetworkMounter-->>GVFS: handled reply
    Note over GMountOperation,GVFS: Default UNHANDLED idle is not scheduled
Loading

File-Level Changes

Change Details Files
Prevent GMountOperation’s default signal handlers from scheduling premature UNHANDLED replies during GVFS authentication prompts.
  • Stop default emission of the ask-question signal before custom handling.
  • Stop default emission of the ask-password signal before custom handling.
  • Retain explicit reply handling across callback and fallback paths.
src/dfm-mount/private/dnetworkmounter.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@Johnson-zs

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

This pr force merged! (status: blocked)

@deepin-bot
deepin-bot Bot merged commit 3ae1a4d into linuxdeepin:master Sep 8, 2026
44 of 45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants