Behavior change: Don't change TMPDIR in WithRegistriesConf

Previously, using WithRegistriesConf was setting
BigFilesTemporaryDir using buildah/internal/tmpdir, which (turns relative
$TMPDIR into absolute and) silently ignores invalid values in containers.conf
and uses /var/tmp in that case.

Without WithRegistriesConf, we would first initialize libimage with
BigFilesTemporaryDir = nil (causing libimage to determine BigFilesTemporaryDir
using a _different_ code path which fails on invalid containers.conf),
and only later set r.imageContext.BigFilesTemporaryDir.

It doesn't make sense that --registries-conf should affect TMPDIR processing
that way, and presumably the code path without --registries-conf is much
more frequently used and the one everyone expects; so drop this aspect of
WithRegistriesConf.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
Miloslav Trmač
2026-03-02 23:06:53 +01:00
parent f49950c370
commit 2ac337dbd8

View File

@@ -14,7 +14,6 @@ import (
"syscall"
"time"
"github.com/containers/buildah/pkg/parse"
"github.com/containers/podman/v6/libpod/define"
"github.com/containers/podman/v6/libpod/events"
"github.com/containers/podman/v6/pkg/namespaces"
@@ -223,9 +222,7 @@ func WithRegistriesConf(path string) RuntimeOption {
return fmt.Errorf("locating specified registries.conf: %w", err)
}
if rt.imageContext == nil {
rt.imageContext = &types.SystemContext{
BigFilesTemporaryDir: parse.GetTempDir(),
}
rt.imageContext = &types.SystemContext{}
}
rt.imageContext.SystemRegistriesConfPath = path