Bug 500261 - KWin::ScreenShotDBusInterface2::checkPermissions() always false on FreeBSD X11
Summary: KWin::ScreenShotDBusInterface2::checkPermissions() always false on FreeBSD X11
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 6.3.0
Platform: FreeBSD Ports FreeBSD
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL: https://bugs.freebsd.org/bugzilla/sho...
Keywords:
Depends on:
Blocks:
 
Reported: 2025-02-17 14:46 UTC by dsh
Modified: 2025-02-19 23:52 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 6.3.1
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dsh 2025-02-17 14:46:06 UTC
SUMMARY

KWin::ScreenShotDBusInterface2::checkPermissions() always false on FreeBSD X11, because KWin::fetchRestrictedDBusInterfacesFromPid(pid) uses linux specific code, which reads from /proc FS

static inline QStringList fetchRestrictedDBusInterfacesFromPid(const uint pid)
{
    const auto executablePath = QFileInfo(QStringLiteral("/proc/%1/exe").arg(pid)).symLinkTarget();
    return fetchProcessServiceField(executablePath, s_dbusRestrictedInterfaceName);
}

instead of reusing of portable executablePathFromPid(pid_t) from src/utils/executable_path.h

STEPS TO REPRODUCE
1.  Launch spectacle

OBSERVED RESULT

It shows

An error occurred while taking a screenshot.
KWin screenshot request failed:
The process is not authorized to take a screenshot
Potentially relevant information:
- Method: CaptureScreen
- Method specific arguments: "DP-0"

EXPECTED RESULT

No errors.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version:  6.3.0
KDE Frameworks Version: 6.10.0
Qt Version:  6.8.2

ADDITIONAL INFORMATION
Comment 1 Bug Janitor Service 2025-02-18 11:37:13 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/7181
Comment 2 Vlad Zahorodnii 2025-02-18 11:55:48 UTC
Git commit 1e7421d6b0e7ac03d1cac8323c5436a867dfc3db by Vlad Zahorodnii.
Committed on 18/02/2025 at 11:36.
Pushed by vladz into branch 'master'.

utils: Fix permission checks on FreeBSD

/proc is linux specific.

M  +5    -1    src/utils/serviceutils.h

https://invent.kde.org/plasma/kwin/-/commit/1e7421d6b0e7ac03d1cac8323c5436a867dfc3db
Comment 3 Vlad Zahorodnii 2025-02-18 11:55:49 UTC
Git commit c2f60491aa96222b0e8599901eb0a8ce3fcc65a9 by Vlad Zahorodnii.
Committed on 18/02/2025 at 11:40.
Pushed by vladz into branch 'master'.

utils: Export executablePathFromPid()

M  +3    -1    src/utils/executable_path.h

https://invent.kde.org/plasma/kwin/-/commit/c2f60491aa96222b0e8599901eb0a8ce3fcc65a9
Comment 4 Vlad Zahorodnii 2025-02-18 12:18:48 UTC
Git commit 2618d2cbc54505f075f57e78189423993509a9be by Vlad Zahorodnii.
Committed on 18/02/2025 at 11:59.
Pushed by vladz into branch 'Plasma/6.3'.

utils: Fix permission checks on FreeBSD

/proc is linux specific.
(cherry picked from commit 1e7421d6b0e7ac03d1cac8323c5436a867dfc3db)

M  +5    -1    src/utils/serviceutils.h

https://invent.kde.org/plasma/kwin/-/commit/2618d2cbc54505f075f57e78189423993509a9be
Comment 5 Vlad Zahorodnii 2025-02-18 12:18:56 UTC
Git commit 6125cfccf9123cf47e556ee0050be064ccbfaa97 by Vlad Zahorodnii.
Committed on 18/02/2025 at 11:59.
Pushed by vladz into branch 'Plasma/6.3'.

utils: Export executablePathFromPid()
(cherry picked from commit c2f60491aa96222b0e8599901eb0a8ce3fcc65a9)

M  +3    -1    src/utils/executable_path.h

https://invent.kde.org/plasma/kwin/-/commit/6125cfccf9123cf47e556ee0050be064ccbfaa97
Comment 6 dsh 2025-02-18 18:38:24 UTC
Thanks! I test it and it works fine.