Skip to content

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

Closed
Johnson-zs wants to merge 1 commit into
masterfrom
agent/pms-bug-bot/62bc98c46d76
Closed

Johnson-zs wants to merge 1 commit into
masterfrom
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 PR #389 (commit 8081779) to master branch.

Fix: first SFTP login, after clicking "Still Login", the mount fails with a "password dialog cancelled" error. Root cause: GMountOperation signal emission is not stopped, causing a premature UNHANDLED reply.

Changes: src/dfm-mount/private/dnetworkmounter.cpp — add g_signal_stop_emission_by_name() calls in mountByGvfsAskQuestion and mountByGvfsAskPasswd entry points.

Summary by Sourcery

Prevent default GMountOperation signal handling from issuing premature unhandled replies during interactive SFTP authentication.

Bug Fixes:

  • Prevent premature GMountOperation responses that caused first-time SFTP mounts to fail with a "password dialog cancelled" error after host-key confirmation.

Enhancements:

  • Ensure custom question and password handlers fully control mount-operation signal replies by suppressing the default unhandled response.

…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

Fixes the first SFTP login race by stopping default GMountOperation signal emission for question and password prompts, preventing a stale asynchronous UNHANDLED reply from being delivered during the subsequent authentication dialog and reported as “password dialog cancelled.”

Sequence diagram for preventing stale GMountOperation replies

sequenceDiagram
    participant GVFS
    participant GMountOperation
    participant DNetworkMounter
    participant Dialog

    GVFS->>GMountOperation: emit ask-question
    GMountOperation->>DNetworkMounter: mountByGvfsAskQuestion()
    DNetworkMounter->>GMountOperation: g_signal_stop_emission_by_name(self, ask-question)
    DNetworkMounter->>Dialog: show host-key question
    Dialog-->>DNetworkMounter: explicit reply
    DNetworkMounter-->>GVFS: handled response

    GVFS->>GMountOperation: emit ask-password
    GMountOperation->>DNetworkMounter: mountByGvfsAskPasswd()
    DNetworkMounter->>GMountOperation: g_signal_stop_emission_by_name(self, ask-password)
    DNetworkMounter->>Dialog: show authentication dialog
    Dialog-->>DNetworkMounter: explicit reply
    DNetworkMounter-->>GVFS: handled response
Loading

File-Level Changes

Change Details Files
Prevent GMountOperation’s default signal handlers from scheduling premature UNHANDLED replies during GVFS authentication prompts.
  • Stop emission of the ask-question signal before custom host-key question handling.
  • Stop emission of the ask-password signal before custom password handling.
  • Rely on the existing explicit reply paths to complete each mount interaction.
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 Johnson-zs closed this Sep 8, 2026
@Johnson-zs
Johnson-zs deleted the agent/pms-bug-bot/62bc98c46d76 branch September 8, 2026 06:45
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