`extractHeadlingArgsFromNode` incorrectly uses host `BuiltinArgDefaults`
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- go
- 领域
- build-system
调研方向
从 builder.go 中的 extractHeadingArgsFromNode 开始,这里临时 builder 会计算 heading 参数。检查当前和临时的 BuiltinArgDefaults,然后根据 buildah issue 6964 中引用的测试用例验证行为。完成的标准是 heading 参数使用当前 builder 的默认值,包括由 --platform 更改的值。
由索引模型根据 Issue 内容生成。
描述
extractHeadlingArgsFromNode creates headling args using a new temporary builder. However, if the current builder's BuiltinArgDefaults differ from the host's defaults (such as when passing --platform to buildah, which overrides TARGET* args after calling NewBuilder()), the resulting headling args contain the wrong values.
The function should instead copy the current builder's BuiltinArgDefaults into the temporary builder before trying to construct the headling args. The following patch should fix this:
--- a/builder.go
+++ b/builder.go
@@ -6,6 +6,7 @@ import (
"fmt"
"io"
"log"
+ "maps"
"os"
"path/filepath"
"runtime"
@@ -418,6 +419,7 @@ func (b *Builder) extractHeadingArgsFromNode(node *parser.Node) error {
// Use a separate builder to evaluate the heading args
tempBuilder := NewBuilder(b.UserArgs)
+ maps.Copy(tempBuilder.BuiltinArgDefaults, b.BuiltinArgDefaults)
// Built-in ARGs are declared implicitly in the heading and should be resolvable in its scope
for k, v := range tempBuilder.BuiltinArgDefaults {
The test cases in https://github.com/podman-container-tools/buildah/issues/6964 pass after making this change.
- 主要语言
- Go
- 星标
- 131
- 派生
- 77
- 平均合并
- 7 天 41 分钟
- 30 天内合并 PR
- 1
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
openshift/imagebuilder 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 68/100
openshift/imagebuilder#323 ·
-
lifecycle/frozen
难度 4/5 3-5 天 新手友好度 35/100
openshift/imagebuilder#68 · 9 条评论 ·
查看 openshift/imagebuilder 的全部 Issue
相似的 Issue
-
status:needs-review type:bug
难度 2/5 1-3 小时 新手友好度 78/100
Gentleman-Programming/engram#2079 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
limitlessprojects/Go-Hybrid#1377 ·
维护者通常 1 天内回复
-
bug report
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复