Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

`extractHeadlingArgsFromNode` incorrectly uses host `BuiltinArgDefaults`

未关闭 适合新手
#322 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
go
领域
build-system

调研方向

从 builder.go 中的 extractHeadingArgsFromNode 开始,这里临时 builder 会计算 heading 参数。检查当前和临时的 BuiltinArgDefaults,然后根据 buildah issue 6964 中引用的测试用例验证行为。完成的标准是 heading 参数使用当前 builder 的默认值,包括由 --platform 更改的值。

由索引模型根据 Issue 内容生成。

描述

lifecycle/stale

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 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

openshift/imagebuilder 的其他 Issue

查看 openshift/imagebuilder 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。