-
Notifications
You must be signed in to change notification settings - Fork 66
Release 1.13 #1691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release 1.13 #1691
Changes from all commits
a4026e1
7765426
95b7d85
d7c5763
fc01f3c
18592bc
5a54387
044bbea
f2fcd4b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -464,21 +464,8 @@ utils::error::Result<api::dbus::v1::PackageManager *> Cli::getPkgMan() | |
| } | ||
|
|
||
| if (this->peerMode) { | ||
| if (getuid() != 0) { | ||
| return LINGLONG_ERR("--no-dbus should only be used by root user."); | ||
| } | ||
|
|
||
| LogW("some subcommands will failed in --no-dbus mode."); | ||
| const auto pkgManAddress = QString("unix:path=/tmp/linglong-package-manager.socket"); | ||
| QProcess::startDetached("sudo", | ||
| { "--user", | ||
| LINGLONG_USERNAME, | ||
| "--preserve-env=QT_FORCE_STDERR_LOGGING", | ||
| "--preserve-env=QDBUS_DEBUG", | ||
| LINGLONG_LIBEXEC_DIR "/ll-package-manager", | ||
| "--no-dbus" }); | ||
| using namespace std::chrono_literals; | ||
| std::this_thread::sleep_for(1s); | ||
|
|
||
| const auto &pkgManConn = | ||
| QDBusConnection::connectToPeer(pkgManAddress, "ll-package-manager"); | ||
|
Comment on lines
466
to
471
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Architectural Issue: Daemon Startup Logic Moved to Application Entry PointThe logic to start Since Recommendation: |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unhandled Process Startup Failure & Flaky Sleep
QProcess::startDetachedreturns aboolindicating whether the process was successfully started. If it fails (e.g., ifsudois missing, permissions are incorrect, or the path is invalid), the failure is silently ignored, and the program will sleep for 1 second before failing with a generic/confusing error when trying to load the repository.std::this_thread::sleep_for(1s)to wait for the daemon to initialize is a known anti-pattern. On slow or heavily loaded systems, 1 second might not be enough, leading to intermittent/flaky failures. On fast systems, it introduces an unnecessary 1-second delay to every CLI invocation.Recommendation:
QProcess::startDetachedand handle failure./tmp/linglong-package-manager.socketor the initialization of the repository instead of a hardcoded sleep.