已合并
fix: 修正 install_deps.sh 中 pigz 安装提示与成功消息不一致问题 #303
fix: 修正 install_deps.sh 中 pigz 安装提示与成功消息不一致问题 #303
已合并
LambdaMiX创建于 28 天前
LambdaMiX成员
28 天前

描述

问题描述

install_deps.sh 脚本存在两个问题:

  1. pigz 安装提示与默认行为不一致install_pigz() 函数中 read -p "Install pigz? [Y/n]" 提示符 [Y/n] 暗示 Y 为默认选项,但用户按 Enter(空输入)时实际走"跳过安装"分支,导致用户以为选择了 Yes 却跳过了 pigz 安装。

  2. 成功消息误报:pigz 被跳过后,脚本末尾仍无条件打印 "All dependencies installed successfully!",与实际状态不一致,在自动化流程中会造成误判。

修改内容

1.修正 install_pigz()read 交互逻辑:空输入视为 Yes(符合 [Y/n] 惯例)

2.新增 PIGZ_SKIPPED 变量追踪 pigz 跳过状态
main() 末尾根据 PIGZ_SKIPPED 输出不同消息:跳过时提示用户手动安装命令(pigz skipped, run 'sudo apt install pigz' to install manually),而非声称全部安装成功

关联的Issue

issue #327

测试

  1. 交互模式:运行 bash install_deps.sh,pigz 未安装时按 Enter,确认 pigz 被安装(而非跳过)
  2. 交互模式:输入 n,确认 pigz 被跳过,且末尾输出提示用户手动安装的消息:"All mandatory dependencies installed successfully! (pigz skipped, run 'sudo apt install pigz' to install manually)"
  3. 非交互模式:echo "n" | bash install_deps.sh,确认脚本正常完成且输出消息准确
  4. pigz 已安装场景:确认脚本正常识别并跳过安装步骤

文档更新

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 LambdaMiX 的贡献)
atomgit-bot
atomgit-bot
28 天前 评论:

变更摘要

此 PR 修复了 install_deps.sh 脚本中 install_pigz() 函数的两个问题:一是交互提示 [Y/n] 暗示 Y 为默认选项,但用户按 Enter(空输入)时实际走了跳过安装分支,导致行为与用户预期不符;二是 pigz 被跳过安装后,脚本末尾仍无条件打印 "All dependencies installed successfully!",在自动化流程中会造成误判。修复通过调整空输入判断逻辑和引入 PIGZ_SKIPPED 状态变量,使默认行为与提示符一致,并在最终消息中准确反映安装状态。

主要改动

  • 修正 install_pigz() 中的空输入判断逻辑:将 if [[ ! $REPLY =~ ^[Yy]$ ]] 改为 if [[ -n "$REPLY" && ! $REPLY =~ ^[Yy]$ ]],使得用户按 Enter(空输入)时不再被当作跳过安装,而是执行 pigz 安装,与 [Y/n] 提示符的默认语义一致。
  • 引入 PIGZ_SKIPPED 全局状态变量:在脚本开头初始化 PIGZ_SKIPPED=false,当 install_pigz() 跳过安装时将其设为 true,用于追踪 pigz 是否被跳过。
  • 区分脚本末尾的成功消息:在 main() 函数末尾根据 PIGZ_SKIPPED 的值输出不同的提示——若 pigz 被跳过则输出 "All mandatory dependencies installed successfully! (pigz skipped, run 'sudo apt install pigz' to install manually)",否则输出原始的 "All dependencies installed successfully!"。
likedislike
atomgit-bot
atomgit-bot
28 天前 评论:

代码审查

审查完成

变更文件审查结果

  • install_deps.sh:发现 1 个问题(P2)

发现汇总

优先级 数量
P0 0
P1 0
P2 1
P3 0

整体风险评估:低风险。 本次变更正确修复了 install_pigz()[Y/n] 提示与默认行为不一致的问题(空输入现在默认为 Yes),并通过 PIGZ_SKIPPED 变量使脚本末尾的成功消息与实际状态保持一致。唯一的缺陷是 pigz 跳过提示消息中硬编码了 sudo apt install pigz,在非 Debian 系统(RHEL/Euler/macOS)上会给出错误的包管理器命令,误导用户。建议使用脚本已有的 $OS / $PKG_MANAGER 变量动态生成该提示。

类型 数量
🔴 阻塞 0
🟡 建议 1

💬 仅评论

likedislike
CANN-robotCANN-robot成员
28 天前 添加了label:stat/needs-squash
CANN-robotCANN-robot成员
28 天前 添加了label:cann-cla/no
CANN-robot
CANN-robot成员
28 天前 评论:

Thanks for your pull-request.
The full list of commands accepted by me can be found at here
You can get sig-info at here


PR Approval Progress

Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
repo-cann/ops-blas 宋恺, xutianze (2/2) 宋恺, xutianze (2/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

LambdaMiX, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robot
CANN-robot成员
28 天前 评论:

CLA Signature Guide

@LambdaMiX , thanks for your pull request.

The following commit(s) have not signed Contributor License Agreement (CLA).

Commit Reason
4099fed8 fix:调整 PIGZ_SKIPPED 初始�... the email is not signed for CLA! please check if it is correct and the same as your signed email.
af676195 fix: 修正 install_deps.sh 中 ... the email used in the commit is platform default email: ***@noreply.gitcode.com!
使用了Gitcode平台系统默认邮箱,需要在平台个人设置里绑定个人邮箱.

If you need to sign CLA, you can click here to sign the CLA.

If you need to check if the email is set up correctly, you can click here to do it in the FAQs.

After signing the CLA or updating the email, you must comment /check-cla to check the CLA status again.

likedislike
CANN-robotCANN-robot成员
28 天前 将chenbinbin199309,luowen203_gg123,QK_25415,MaskHunter2008,songkai111,xutianze,wangzitao_leo,nino888,zhaoyingchao2,demoauguste,zizhongchen设为评审人
CANN-robotCANN-robot成员
28 天前 将chenbinbin199309,luowen203_gg123,QK_25415,MaskHunter2008,songkai111,xutianze,wangzitao_leo,nino888,zhaoyingchao2,demoauguste,zizhongchen设为审查人
atomgit-bot
atomgit-bot28 天前进行代码检视3
install_deps.sh
已过期
@@ -623,2 +626,3 @@
623626 echo -e "===================================================="
624- echo "All dependencies installed successfully!"
627+ if [[ "${PIGZ_SKIPPED:-false}" == "true" ]]; then
628+ echo "All mandatory dependencies installed successfully! (pigz skipped, run 'sudo apt install pigz' to install manually)"
atomgit-bot
atomgit-bot28 天前评论:

🟡 Medium Priority

变更行:第 628 行(新增行)

install_deps.sh 通过 detect_os() 支持多种操作系统:debian (apt)、rhel (dnf/yum)、euler (dnf)、macOS (brew)。install_pigz() 函数内部正确使用变量 $PKG_MANAGER 来适配不同系统的包管理器。

但第 628 行新增的 pigz 跳过提示消息中,硬编码了 'sudo apt install pigz'。在 RHEL/Euler 系统上用户应使用 sudo dnf install pigz(或 sudo yum install pigz),在 macOS 上应使用 brew install pigz。当前消息会误导非 Debian 用户执行错误的安装命令。

触发条件:用户在非 Debian 系统(RHEL/Euler/macOS)上运行脚本并选择跳过 pigz 安装时。

失败模式:用户看到错误的安装命令提示,可能执行失败或产生困惑,尤其在自动化流程中会传递不准确的信息。

建议:使用 $OS / $PKG_MANAGER 变量动态生成提示命令,与 install_pigz() 中的安装逻辑保持一致。debian/rhel/euler 使用 sudo $PKG_MANAGER install pigz;macOS 使用 brew install pigz(不加 sudo)。

likedislike
System
系统消息系统
27 天前 评论:

changed this line on 6177bee1 view diff detail

LambdaMiX成员
27 天前 评论:

已修改

LLambdaMiX成员
28 天前 强制推送  1 个提交:3ddcb42e-fix: 修正 install_deps.sh 中 pigz 安装提示与成功消息不一致问题
CANN-robotCANN-robot成员
28 天前 删除了label:stat/needs-squash
CANN-robotCANN-robot成员
28 天前 删除了label:cann-cla/no
CANN-robot
CANN-robot成员
28 天前 评论:

Notification

This pull request has been changed(code update) or closed, so removes the following label(s): stat/needs-squash.

likedislike
CANN-robotCANN-robot成员
28 天前 添加了label:cann-cla/yes
LambdaMiX成员
28 天前 评论:

compile

likedislike
CANN-robotCANN-robot成员
28 天前 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
28 天前 评论:

流水线任务触发成功
任务链接 [ddbc4de89be445d29a0b02b1eff7443a][流水线指导]

任务名称状态日志下载链接
Compile_Ascend_X86_A2 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_A5 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A2 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A5 ✅ SUCCESS >>>>> >>>>>
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86_A2_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_A5_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A2_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A5_ubuntu24 ✅ SUCCESS >>>>> >>>>>
codecheck_codestyle ✅ SUCCESS >>>>>
precommit ✅ SUCCESS >>>>>
PreSmoke_A900_npupool ✅ SUCCESS >>>>>

[2026-07-23 12:21:11]    CI执行结束

likedislike
CANN-robotCANN-robot成员
28 天前 删除了label:ci-pipeline-running
此处折叠了5条事件消息 查看更多
LLambdaMiX成员
28 天前 修改了pull request 的描述
songkai111成员
28 天前 评论:

/approve

likedislike
CANN-robotCANN-robot成员
28 天前 添加了label:approved
LLambdaMiX成员
27 天前 强制推送  1 个提交:6177bee1-fix: 修正 install_deps.sh 中 pigz 安装提示与成功消息不一致问题
CANN-robotCANN-robot成员
27 天前 删除了label:ci-pipeline-passed
CANN-robot
CANN-robot成员
27 天前 评论:

Notification

This pull request has been changed(code update) or closed, so removes the following label(s): ci-pipeline-passed.

likedislike
CANN-robotCANN-robot成员
27 天前 删除了label:approved
CANN-robotCANN-robot成员
27 天前 添加了label:approved
CANN-robot
CANN-robot成员
27 天前 评论:

Notice

New code changes of the pull request are detected and remove these labels approved. 😳

likedislike
LLambdaMiX成员
27 天前 设置为草稿状态
LLambdaMiX成员
27 天前 取消了草稿状态
LLambdaMiX成员
27 天前 设置为草稿状态
LLambdaMiX成员
27 天前 修改了pull request 的描述
LambdaMiX成员
27 天前 评论:

compile

likedislike
CANN-robotCANN-robot成员
27 天前 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
27 天前 评论:

流水线任务触发成功
任务链接 [757579bd0f804fe39ca1123efd820c35][流水线指导]

任务名称状态日志下载链接
Compile_Ascend_X86_A2 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_A5 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A2 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A5 ✅ SUCCESS >>>>> >>>>>
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86_A2_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_A5_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A2_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A5_ubuntu24 ✅ SUCCESS >>>>> >>>>>
codecheck_codestyle ✅ SUCCESS >>>>>
precommit ✅ SUCCESS >>>>>
PreSmoke_A900_npupool ✅ SUCCESS >>>>>

[2026-07-24 14:38:15]    CI执行结束

likedislike
CANN-robotCANN-robot成员
27 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
27 天前 添加了label:ci-pipeline-passed
LLambdaMiX成员
27 天前 取消了草稿状态
Ssongkai111成员
26 天前 添加了 squash commit 备注:/approve
songkai111成员
26 天前 评论:

/approve

likedislike
xutianze
xutianze成员
26 天前 评论:

/approve

likedislike
CANN-robotCANN-robot成员
26 天前 添加了label:lgtm
CANN-robotCANN-robot成员
26 天前 解决了最后一个问题
CANN-robotCANN-robot成员
26 天前 关闭了关联的issue
CANN-robotCANN-robot成员
26 天前 合入了pull request