From 2ba3a2d56dcd5b8af6b1cdb7e2d61887a440ce80 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 7 Mar 2024 12:16:46 +0100 Subject: [PATCH] pkg/machine: fix relative DefaultPolicyJSONPath When we set a relative path (i.e. ".") it should be resolved next to binary so we need to get the base dir. If we join it directly like it did before you get a path like .../podman/policy.json where podman is the podman executable so it is not a directory and thus could not contain the policy.json file. ref #21964 Signed-off-by: Paul Holzinger --- pkg/machine/ocipull/policy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/machine/ocipull/policy.go b/pkg/machine/ocipull/policy.go index aab3b81dda..62ebcdd2ab 100644 --- a/pkg/machine/ocipull/policy.go +++ b/pkg/machine/ocipull/policy.go @@ -41,7 +41,7 @@ func policyPath() (string, error) { if err != nil { return "", fmt.Errorf("could not resolve relative path to binary: %w", err) } - return filepath.Join(p, DefaultPolicyJSONPath, policyfile), nil + return filepath.Join(filepath.Dir(p), DefaultPolicyJSONPath, policyfile), nil } return "", &defaultPolicyError{errs: errs} }