Skip to content

Conversation

@LiHua000
Copy link
Contributor

@LiHua000 LiHua000 commented May 14, 2025

Log: The abnormal execution of QProcess resulted in empty fuser output, causing port availability verification to fail, which ultimately led to connection failures with the correct debugging backend and freeze ide

Bug: https://pms.uniontech.com/bug-view-315851.html

Summary by Sourcery

Bug Fixes:

  • Invoke fuser via bash -c instead of directly passing the command to QProcess to capture its output correctly.

Log: The abnormal execution of QProcess resulted in empty fuser output, causing port availability verification to fail, which ultimately led to connection failures with the correct debugging backend and freeze ide

Bug: https://pms.uniontech.com/bug-view-315851.html
@deepin-ci-robot
Copy link

deepin pr auto review

关键摘要:

  • 在修改后的代码中,使用了 bash -c 来执行命令,这可能会增加命令执行的复杂性和潜在的安全风险。
  • process.readAll() 可能会读取到错误信息,但没有对读取到的内容进行进一步处理或检查。

是否建议立即修改:

建议的修改措施:

  • 考虑使用更安全的方法来检查端口是否被占用,例如使用系统调用或现有的库函数。
  • process.readAll() 的返回值进行解析,确保正确处理命令执行的结果,包括可能的错误信息。
  • 增加对 process.waitForFinished() 的超时处理,以防止无限等待的情况发生。

@sourcery-ai
Copy link

sourcery-ai bot commented May 14, 2025

Reviewer's Guide

This PR adapts the QProcess invocation to Qt 6’s stricter API by invoking the shell explicitly when running the fuser command to reliably detect free ports.

File-Level Changes

Change Details Files
Use explicit shell invocation for QProcess under Qt 6
  • Replaced process.start(cmd) with process.start("bash", {"-c", cmd})
  • Retained waitForFinished() and output reading logic unchanged
src/tools/debugadapter/debugger/python/pythondebugger.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

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

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

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines 119 to 120
process.waitForFinished();
QString ret = process.readAll();
Copy link

Choose a reason for hiding this comment

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

suggestion: Capture stderr output for better diagnostics

Call process.readAllStandardError() to catch fuser or shell errors and improve debug info when port checks fail.

Suggested change
process.waitForFinished();
QString ret = process.readAll();
process.waitForFinished();
// capture both stdout and stderr for better diagnostics
QString ret = process.readAllStandardOutput();
QString err = process.readAllStandardError();
if (!err.isEmpty()) {
qDebug() << "checkPortFree stderr:" << err.trimmed();
}

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deepin-mozart, LiHua000

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

The pull request process is described 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

@deepin-mozart deepin-mozart merged commit b66db44 into linuxdeepin:master May 14, 2025
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants