Skip to content

fix: fix fd marshaling in QtDBus#1716

Merged
dengbo11 merged 1 commit into
OpenAtom-Linyaps:release/1.13from
dengbo11:release-1.13
Jul 1, 2026
Merged

fix: fix fd marshaling in QtDBus#1716
dengbo11 merged 1 commit into
OpenAtom-Linyaps:release/1.13from
dengbo11:release-1.13

Conversation

@dengbo11

@dengbo11 dengbo11 commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Call Ping() to trigger QtDBus's file descriptor passing capability update.

Call Ping() to trigger QtDBus's file descriptor passing capability
update.

Signed-off-by: reddevillg <reddevillg@gmail.com>
@deepin-ci-robot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dengbo11

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

@dengbo11 dengbo11 merged commit a5a99c1 into OpenAtom-Linyaps:release/1.13 Jul 1, 2026
13 checks passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the Cli::getPkgMan method to consolidate the D-Bus peer connection setup and PackageManager initialization, reducing duplication. It also adds a check in Cli::installFromFile to ensure the D-Bus connection supports Unix File Descriptor passing before proceeding. The review feedback suggests two improvements: first, avoiding a redundant and inefficient initialization of pkgManConn by using its default constructor; second, generalizing the error message when Unix FD passing is unsupported, as the connection may be via the system bus rather than a peer connection.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

}

QString service;
QDBusConnection pkgManConn{ "ll-package-manager" };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Initializing pkgManConn with "ll-package-manager" is redundant and inefficient because it is immediately overwritten in both branches of the if-else statement (either by QDBusConnection::connectToPeer or QDBusConnection::systemBus). Additionally, constructing a QDBusConnection with a name that has not been registered yet triggers an unnecessary connection lookup in the Qt D-Bus registry.\n\nUsing the default constructor QDBusConnection pkgManConn; is cleaner, more efficient, and avoids any confusion.

    QDBusConnection pkgManConn;


auto caps = (*pkgMan)->connection().connectionCapabilities();
if (!(caps & QDBusConnection::UnixFileDescriptorPassing)) {
this->printer.printErr(LINGLONG_ERRV("peer connection does not support Unix FD passing"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The error message refers specifically to a "peer connection", but this function can also be called when connected via the system bus (when peerMode is false). To avoid confusion, it is better to use a more general error message such as "D-Bus connection does not support Unix FD passing".

        this->printer.printErr(LINGLONG_ERRV("D-Bus connection does not support Unix FD passing"));

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 18 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
libs/linglong/src/linglong/cli/cli.cpp 0.00% 18 Missing ⚠️
Files with missing lines Coverage Δ
libs/linglong/src/linglong/cli/cli.cpp 1.76% <0.00%> (-0.01%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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