Revert "fix: fix rootfs propagation"#1639
Conversation
This reverts commit 65b19c1.
deepin pr auto review这段代码修改主要是在 OCI (Open Container Initiative) 容器配置的构建过程中,为 Linux 特定的配置添加了 1. 代码审查修改内容分析: auto linux_ = ocppi::runtime::config::types::Linux{};
+ linux_.rootfsPropagation = RootfsPropagation::Slave;这行代码将容器的根文件系统传播类型设置为 2. 逻辑与功能分析
3. 改进意见A. 代码质量与可维护性建议:使用常量或配置项 改进示例: // 建议在类定义或配置文件中定义默认值
static constexpr const char* DEFAULT_HOSTNAME = "linglong";
static constexpr auto DEFAULT_ROOTFS_PROPAGATION = RootfsPropagation::Slave;
// 在函数中使用
config.hostname = DEFAULT_HOSTNAME;
auto linux_ = ocppi::runtime::config::types::Linux{};
linux_.rootfsPropagation = DEFAULT_ROOTFS_PROPAGATION;B. 代码安全评价:安全
C. 代码性能评价:无影响
4. 潜在风险与注意事项
5. 综合建议在代码中添加注释,解释为什么选择 最终建议代码: config.hostname = "linglong";
auto linux_ = ocppi::runtime::config::types::Linux{};
// 设置为 Slave 以允许宿主机的挂载事件传播到容器,
// 但阻止容器内的挂载事件传播回宿主机,增强安全性。
// 注意:这要求宿主机上的挂载源必须是 Shared 的。
linux_.rootfsPropagation = RootfsPropagation::Slave;
linux_.namespaces = std::vector<NamespaceReference>{
NamespaceReference{ .type = NamespaceType::Pid },
NamespaceReference{ .type = NamespaceType::Mount }, |
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dengbo11, reddevillg 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 |
This reverts commit 65b19c1.