Skip to content

fix: improve gfxmode signal file creation safety#1178

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:release/2500from
52cyb:security3
Jul 17, 2026
Merged

fix: improve gfxmode signal file creation safety#1178
deepin-bot[bot] merged 1 commit into
linuxdeepin:release/2500from
52cyb:security3

Conversation

@52cyb

@52cyb 52cyb commented Jul 17, 2026

Copy link
Copy Markdown
Contributor
  1. Move gfxmode signal file from /tmp to /run (tmpfs, wiped each boot) to fix stale-file issue that could prevent detection completion
  2. Introduce CreateGfxmodeDetectReady function to centralize mkdir + write logic with consistent error wrapping
  3. Remove direct os.WriteFile calls in favor of the new function
  4. Update systemd service with RuntimeDirectory to manage /run/deepin-gfxmode-detect and preserve across restarts

Log: Relocate gfxmode detection signal file to /run and unify creation entry for better lifecycle management
PMS: BUG-367565
Influence:

  1. Test gfxmode detection process with normal device conditions
  2. Verify signal file creation in /run directory after detection
  3. Verify signal file preservation across service restart
  4. Verify postinst grub2 -prepare-gfxmode-detect creates signal file without systemd RuntimeDirectory

refactor: 提升 gfxmode 信号文件创建安全性

  1. 将 gfxmode 信号文件从 /tmp 迁移至 /run(tmpfs,每次开机清空), 修正残留旧文件导致探测完成判断失效的问题
  2. 引入 CreateGfxmodeDetectReady 函数,统一 mkdir + 写文件逻辑并 规范错误包装
  3. 移除直接的 os.WriteFile 调用,统一使用新函数
  4. 更新 systemd 服务,通过 RuntimeDirectory 托管 /run/deepin-gfxmode-detect 父目录并跨重启保留

Log: 将 gfxmode 探测完成信号文件迁移至 /run 并统一创建入口,改善生命周期管理
PMS: BUG-367565
Influence:

  1. 测试正常设备条件下的 gfxmode 检测流程
  2. 验证检测完成后 /run 目录中信号文件的创建与生命周期
  3. 验证服务重启后信号文件按 RuntimeDirectoryPreserve 行为保留
  4. 验证 postinst 的 grub2 -prepare-gfxmode-detect 在无 systemd 托管时能正常创建信号文件

(cherry picked from commit a50e3aa)

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @52cyb, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot

Copy link
Copy Markdown

Hi @52cyb. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 52cyb, fly602

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

1. Move gfxmode signal file from /tmp to /run (tmpfs, wiped each boot)
   to fix stale-file issue that could prevent detection completion
2. Introduce CreateGfxmodeDetectReady function to centralize mkdir +
   write logic with consistent error wrapping
3. Remove direct os.WriteFile calls in favor of the new function
4. Update systemd service with RuntimeDirectory to manage
   /run/deepin-gfxmode-detect and preserve across restarts

Log: Relocate gfxmode detection signal file to /run and unify creation
entry for better lifecycle management
PMS: BUG-367565
Influence:
1. Test gfxmode detection process with normal device conditions
2. Verify signal file creation in /run directory after detection
3. Verify signal file preservation across service restart
4. Verify postinst grub2 -prepare-gfxmode-detect creates signal file
   without systemd RuntimeDirectory

refactor: 提升 gfxmode 信号文件创建安全性

1. 将 gfxmode 信号文件从 /tmp 迁移至 /run(tmpfs,每次开机清空),
   修正残留旧文件导致探测完成判断失效的问题
2. 引入 CreateGfxmodeDetectReady 函数,统一 mkdir + 写文件逻辑并
   规范错误包装
3. 移除直接的 os.WriteFile 调用,统一使用新函数
4. 更新 systemd 服务,通过 RuntimeDirectory 托管
   /run/deepin-gfxmode-detect 父目录并跨重启保留

Log: 将 gfxmode 探测完成信号文件迁移至 /run 并统一创建入口,改善生命周期管理
PMS: BUG-367565
Influence:
1. 测试正常设备条件下的 gfxmode 检测流程
2. 验证检测完成后 /run 目录中信号文件的创建与生命周期
3. 验证服务重启后信号文件按 RuntimeDirectoryPreserve 行为保留
4. 验证 postinst 的 grub2 -prepare-gfxmode-detect 在无 systemd 托管时能正常创建信号文件

(cherry picked from commit a50e3aa)
@52cyb

52cyb commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

This pr force merged! (status: unstable)

@deepin-bot
deepin-bot Bot merged commit be59e2c into linuxdeepin:release/2500 Jul 17, 2026
15 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants