Pull Request has been successfully merged by CANN-robot.
(Thank you for qinhan's contribution.)变更摘要
该 PR 旨在统一 ops-base(opbase)安装过程中的目录与文件权限处理:删除散落在安装、升级脚本中大量针对 script、bin、share/info、vendors 等目录以及 scene.info、version.info 等文件的 chmod 权限设置逻辑,避免安装流程中对权限的重复或分散控制,使权限管理趋于统一。
主要改动
- 移除安装目录权限设置:在
install.sh中删除对${opp_platform_dir}/script、${opp_platform_dir}/bin的chmod -R 555,并删除非 root 用户下对script目录的chmod -R 550及filelist.csv的chmod 440设置。 - 移除升级流程权限设置:在
install.sh与opp_upgrade.sh中删除升级场景下对script、share/info/${ops_base_platform_dir}及其子目录(含vendors下framework、fusion_pass、op_impl、op_proto等)的chmod -R权限变更,以及对scene.info、version.info、ascend_install.info等文件的只读/权限设置。 - 移除安装后权限修正:在
opp_install.sh中删除安装完成后对share/info/${ops_base_platform_dir}(含vendors目录)及scene.info、version.info、opp/version.info文件的chmod权限修正逻辑。 - 调整软链接创建/清理权限:在
opp_common.sh的create_stub_softlink和remove_stub_softlink中分别移除chmod u-w .与chmod u-w .(devlib 目录写权限收口)操作。 - 保留属主设置:在
install.sh中保留对script目录及 opbase 目录的chown root:root属主设置,仅移除权限位(chmod)部分的改动。


Hi @qinhan123, welcome to submitting your first PR to opbase!
PR Merge Steps
1. CLA Signing
If the current PR label includes cann-cla/yes, it means you have signed the CLA and can proceed to the next step. If the label includes cann-cla/no, please sign the CLA first. If you have any questions, please refer to the FAQ.
2. CI Check
Please comment /compile to trigger the CI pipeline check. If the CI run is successful, the PR will be tagged with ci-pipeline-passed and you can proceed to the next step. If the CI run fails, the PR will be tagged with ci-pipeline-failed, please check the CI logs to fix the issues in the PR. If you have any questions, please refer to the FAQ.
3. Code Review
After CI passes, please refer to the PR Approval Progress and proactively @ the committers in the table to review the code. After approval, committers will comment /lgtm and /approve. Once the lgtm and approved labels are successfully added, the PR will be merged automatically.


代码审查
审查总结
各文件审查结果
1. scripts/package/opbase/scripts/install.sh — 发现 P0 问题
- P0(1530-1534 行):删除
if [ $(id -u) -eq 0 ]的 else 分支时,其收尾fi一并被删且未补回,导致第 1412 行if [ "${is_install}" = "y" ]块到 EOF 仍无闭合fi。经逐行核对 1412-1597 区间:if ... then28 个、fi27 个,bash 解析到 EOF 报syntax error: unexpected end of file,整个 install.sh 无法执行,所有安装/升级/卸载入口全部失效。同根因的次生问题:即使补回fi,若加在logoperationretstatus之后,非 root 安装会跳过操作状态日志与退出处理。已给出可直接替换的修复代码。 - 其余变更(317/487/513/963/1145 行尾空格、1503-1504 与 1564-1570 的 chmod 删除)为噪音或 PR 主旨(权限统一),无独立问题。
2. scripts/package/opbase/scripts/opp_common.sh — 发现 P3 问题
- P3(93-97 行,另涉 107-108 行):
create_stub_softlink与remove_stub_softlink删除了还原chmod u-w .,却保留chmod u+w .,导致 install/upgrade/uninstall 后 devlib 目录永久残留属主写权限,属单边不一致的权限副作用(置信度 0.5,可能为有意为之,但建议明确二选一)。
3. scripts/package/opbase/scripts/opp_install.sh — no issues
- 仅 199 行尾空格(噪音)及 411-414、423-431 两处 chmod 删除;删除的均为"权限统一"主题下的权限变更语句,剩余代码(chown、chmod u-w 还原、create_stub_softlink 等)结构完整,未发现由此引入的功能缺陷或契约破坏。
4. scripts/package/opbase/scripts/opp_upgrade.sh — no issues
- 仅 192 行尾空格(噪音)及 513-524、528-554、569-572 三处 chmod 删除;删除块内含的
if [ -f <目录> ]判断虽本有-f/-d误用,但已被整体删除,删除后 if/fi 结构平衡,未发现新增缺陷。
汇总
- 共 2 项:P0 × 1,P3 × 1。
- 总体风险:高。install.sh 因 if/fi 不平衡产生语法错误,将直接导致整个安装/升级入口完全不可用(P0);这是本 PR 必须修复的阻断性问题。opp_common.sh 的权限还原删除为低优先级一致性/安全弱化问题,建议同步确认修复方向。
| 类型 | 数量 |
|---|---|
| 🔴 阻塞 | 1 |
| 🟡 建议 | 0 |
⛔ 需要修改


/lgtm
/approve


The MR can not be merged, because of CodeReview discussion not resolved
If you want to solve this problem, you can click here to do it in the FAQs.


描述
该 PR 旨在统一 ops-base(opbase)安装过程中的目录与文件权限处理:删除散落在安装、升级脚本中大量针对 script、bin、share/info、vendors 等目录以及 scene.info、version.info 等文件的 chmod 权限设置逻辑,避免安装流程中对权限的重复或分散控制,使权限管理趋于统一
关联的Issue
测试
文档更新
类型标签