Skip to content

fix: remove shot-start-plugin from wayland blacklist#458

Merged
18202781743 merged 1 commit into
linuxdeepin:masterfrom
18202781743:master
May 14, 2026
Merged

fix: remove shot-start-plugin from wayland blacklist#458
18202781743 merged 1 commit into
linuxdeepin:masterfrom
18202781743:master

Conversation

@18202781743
Copy link
Copy Markdown
Contributor

@18202781743 18202781743 commented May 14, 2026

Remove "libshot-start-plugin.so" from the list of plugins blacklisted
under the Wayland session. The plugin is now compatible with Wayland,
allowing it to load and function properly on Wayland-based systems.

Log: Removed wayland blacklist entry for shot-start-plugin

Influence:

  1. Verify the shot-start plugin loads successfully on Wayland systems
  2. Test basic functionality of the shot-start plugin under Wayland
  3. Ensure no regression on X11 systems

fix: 从 wayland 黑名单中移除 shot-start-plugin

从 Wayland 会话下的插件黑名单中移除 "libshot-start-plugin.so"。该插件现
已兼容 Wayland,允许其在基于 Wayland 的系统上正常加载和运行。

Log: 移除 shot-start-plugin 的 wayland 黑名单配置

Influence:

  1. 验证 shot-start 插件在 Wayland 系统上成功加载
  2. 在 Wayland 下测试 shot-start 插件的基本功能
  3. 确保在 X11 系统上没有回归问题

PMS: BUG-345077

Summary by Sourcery

Allow the shot-start plugin to load under Wayland by removing it from the Wayland-specific plugin blacklist.

Bug Fixes:

  • Fix incorrect Wayland blacklist configuration that prevented the shot-start plugin from loading on Wayland sessions.

Enhancements:

  • Update plugin manager file copyright years to cover 2024–2026.

Remove "libshot-start-plugin.so" from the list of plugins blacklisted
under the Wayland session. The plugin is now compatible with Wayland,
allowing it to load and function properly on Wayland-based systems.

Log: Removed wayland blacklist entry for shot-start-plugin

Influence:
1. Verify the shot-start plugin loads successfully on Wayland systems
2. Test basic functionality of the shot-start plugin under Wayland
3. Ensure no regression on X11 systems

fix: 从 wayland 黑名单中移除 shot-start-plugin

从 Wayland 会话下的插件黑名单中移除 "libshot-start-plugin.so"。该插件现
已兼容 Wayland,允许其在基于 Wayland 的系统上正常加载和运行。

Log: 移除 shot-start-plugin 的 wayland 黑名单配置

Influence:
1. 验证 shot-start 插件在 Wayland 系统上成功加载
2. 在 Wayland 下测试 shot-start 插件的基本功能
3. 确保在 X11 系统上没有回归问题

PMS: BUG-345077
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 14, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Removes the Wayland blacklist entry for the shot-start plugin so it can load under Wayland, and updates the file copyright years; blacklist still includes other problematic plugins.

Flow diagram for PluginManager::loadPlugin Wayland blacklist change

flowchart TD
    A["PluginManager::loadPlugin(pluginFilePath)"] --> B{"qgetenv(XDG_SESSION_TYPE) == wayland"}
    B -- no --> C[Load plugin from pluginFilePath]
    B -- yes --> D[Initialize blacklistedPluginPaths<br/>- libshot-start-record-plugin.so<br/>- libdeepin-screen-recorder-plugin.so<br/>- libeye-comfort-mode.so]
    D --> E{pluginFilePath in blacklistedPluginPaths?}
    E -- yes --> F[Skip loading plugin]
    E -- no --> C[Load plugin from pluginFilePath]
Loading

File-Level Changes

Change Details Files
Allow shot-start plugin to load under Wayland by removing it from the Wayland-specific blacklist.
  • Adjusted the Wayland session blacklist list construction to no longer include the shot-start plugin shared object in the blacklisted plugin paths.
  • Left other Wayland-blacklisted plugins (shot-start-record, deepin-screen-recorder, eye-comfort-mode) unchanged to preserve existing behavior.
src/loader/pluginmanager.cpp
Update copyright years in plugin manager source file.
  • Extended the SPDX-FileCopyrightText year range to include 2026 while keeping the existing copyright holder and license.
src/loader/pluginmanager.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
Copy Markdown

@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 - I've reviewed your changes and they look great!


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.

@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

你好!我是CodeGeeX,你的智能编程助手。我已经仔细审查了你提供的 Git Diff 输入。下面我将从语法逻辑、代码质量、代码性能和代码安全四个方面对这次代码变更进行审查,并给出改进意见。

变更概述

这次修改主要包含两处:

  1. 更新了文件头部的版权声明年份,从 2024 扩展为 2024 - 2026
  2. 在 Wayland 环境的黑名单插件列表中,移除了 "libshot-start-plugin.so",意味着该插件将不再被 Wayland 环境屏蔽,允许其加载。

审查意见

1. 语法逻辑

  • 版权年份逻辑:将版权年份修改为 2024 - 2026。通常情况下,开源项目(特别是遵循 SPDX 规范的项目)的版权年份应该是过去到当前年份(如 2024 - 20242022 - 2024),因为版权是从作品创作时开始生效的。将结束年份写为未来的 2026 年在法律和规范上是不常见的,除非有特殊的预留协议。建议确认项目组的统一规范,如果是自动生成的模板,可能需要修正模板逻辑。
  • 黑名单移除逻辑:从黑名单中移除 libshot-start-plugin.so 意味着该插件将在 Wayland 会话下被加载。逻辑风险:当初加入黑名单必然是因为该插件在 Wayland 下存在兼容性问题(如截图功能在 Wayland 下受权限限制)。请务必确认该插件已经完全适配了 Wayland,否则盲目移除可能会导致程序在 Wayland 环境下崩溃或功能异常。

2. 代码质量

  • 硬编码字符串:代码中 "libshot-start-record-plugin.so" 等插件名称是以硬编码的字符串形式存在的。随着插件数量的增减,这种内联的 QStringList 初始化方式虽然简洁,但不易维护。
  • 可读性与上下文缺失:仅从 diff 无法看出为什么要移除这个黑名单项。建议在提交信息中详细说明移除的原因(例如:“libshot-start-plugin 已完成 Wayland 适配”),如果代码库支持,可以考虑加一行简短注释说明为什么之前屏蔽而现在放开。

3. 代码性能

  • 环境变量的重复读取:虽然这次 diff 没有修改这行代码,但 qgetenv("XDG_SESSION_TYPE") == "wayland" 这行代码每次调用 loadPlugin 时都会执行一次系统环境变量的读取。如果 loadPlugin 在加载大量插件时被频繁调用,这会产生不必要的性能开销。
  • 容器的重复构造:同理,blacklistedPluginPaths.append(QStringList{...}) 每次调用都会构造一个临时的 QStringList 并追加。如果 blacklistedPluginPaths 是局部变量,这会导致频繁的内存分配。

4. 代码安全

  • 环境变量欺骗:使用 qgetenv("XDG_SESSION_TYPE") 来判断会话类型存在被篡改的风险。用户或恶意脚本可以在 X11 环境下伪造该环境变量为 wayland,反之亦然。这可能导致依赖特定显示服务器协议的插件(如截图、录屏插件)在错误的协议环境下加载,引发越权访问或崩溃。
  • 路径注入(潜在):如果 pluginFilePath 是由外部输入决定的,可能存在路径遍历加载恶意 .so 文件的风险,但这属于原有逻辑的问题,本次 diff 未涉及。

改进建议与重构代码

针对性能和质量问题,建议将 Wayland 黑名单提取为类的静态成员或在使用时仅初始化一次,避免在 loadPlugin 函数的频繁调用中反复读取环境变量和构造列表。

改进后的代码示例:

// 在头文件 pluginmanager.h 中
class PluginManager {
private:
    // 将黑名单设为静态成员,或者使用局部静态变量延迟初始化
    static const QStringList& getWaylandBlacklist();
    static bool isWaylandSession();
};

// 在 pluginmanager.cpp 中
bool PluginManager::isWaylandSession() {
    // 使用局部静态变量,整个进程生命周期内只读取一次环境变量
    static bool isWayland = (qgetenv("XDG_SESSION_TYPE") == "wayland");
    return isWayland;
}

const QStringList& PluginManager::getWaylandBlacklist() {
    // 使用局部静态变量,仅初始化一次,避免重复构造 QStringList
    static const QStringList waylandBlacklist = {
        "libshot-start-record-plugin.so",
        "libshot-start-plugin.so", // 注意:此插件已确认适配Wayland,从黑名单移除(根据你的需求决定是否保留)
        "libdeepin-screen-recorder-plugin.so",
        "libeye-comfort-mode.so"
    };
    return waylandBlacklist;
}

void PluginManager::loadPlugin(const QString &pluginFilePath)
{
    // ... 其他逻辑 ...

    // 优化后的判断逻辑
    if (isWaylandSession()) {
        // 获取黑名单,此时不再每次构造临时对象
        const QStringList& blacklistedPluginPaths = getWaylandBlacklist();
        
        // 提取文件名进行比对
        QString fileName = QFileInfo(pluginFilePath).fileName();
        if (blacklistedPluginPaths.contains(fileName)) {
            qDebug() << "Plugin blacklisted on Wayland:" << fileName;
            return; // 或者执行其他屏蔽逻辑
        }
    }

    // ... 继续加载插件的逻辑 ...
}

总结

  1. 最关键的一点:请确认 libshot-start-plugin.so 确实已经在 Wayland 环境下修复了原有的问题,否则此修改会引入 Bug。
  2. 版权年份:确认 2026 是否符合你们团队的 SPDX 规范,通常应为当前年份。
  3. 性能优化:建议采用上述静态局部变量的方式,避免环境变量的重复读取和字符串列表的重复构造,这在插件数量较多时会有明显的性能提升。

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, BLumia

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

@18202781743 18202781743 merged commit f7b128c into linuxdeepin:master May 14, 2026
10 of 11 checks passed
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