chore: add quotes to rm command in postrm script#520
Merged
lzwind merged 1 commit intolinuxdeepin:masterfrom Apr 16, 2026
Merged
chore: add quotes to rm command in postrm script#520lzwind merged 1 commit intolinuxdeepin:masterfrom
lzwind merged 1 commit intolinuxdeepin:masterfrom
Conversation
Quote variables in rm -rf command to prevent globbing and word splitting, addressing shellcheck SC2086 warning for safer package removal. log: add quotes to rm command in postrm script
wyu71
approved these changes
Apr 16, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, wyu71 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
deepin pr auto review这段代码是一个 Debian 软件包的 1. 语法逻辑审查当前代码逻辑: userName=$(who)
if [ "$1" = "purge" ]; then
rm -rf "/home/${userName%% *}/.config/deepin/deepin-terminal/"*问题与改进:
2. 代码质量审查问题与改进:
3. 代码性能审查问题与改进:
4. 代码安全审查问题与改进:
改进后的代码示例#DEBHELPER#
if [ "$1" = "purge" ]; then
# 遍历所有用户家目录,删除 deepin-terminal 配置
for user_home in $(getent passwd | cut -d: -f6); do
config_dir="$user_home/.config/deepin/deepin-terminal"
if [ -d "$config_dir" ]; then
rm -rf "$config_dir" || true
fi
done
# 解决 /nonexistent 目录残留问题
if [ -f /nonexistent/.config/deepin/deepin-terminal/install_flag ]; then
rm -f /nonexistent/.config/deepin/deepin-terminal/install_flag || true
fi
fi改进点总结:
进一步优化建议:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Quote variables in rm -rf command to prevent globbing and word splitting, addressing shellcheck SC2086 warning for safer package removal.
log: add quotes to rm command in postrm script