Skip to content

Commit e9583d3

Browse files
authored
Upgrade : podman to version 5.6.1 (microsoft#14313)
1 parent 66b4052 commit e9583d3

File tree

5 files changed

+460
-351
lines changed

5 files changed

+460
-351
lines changed
Lines changed: 290 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,290 @@
1+
From e1dfa0a1b54411b56c92e8156b06ce01f05a0d44 Mon Sep 17 00:00:00 2001
2+
From: SumitJenaHCL <[email protected]>
3+
Date: Fri, 19 Sep 2025 20:53:49 +0530
4+
Subject: [PATCH] Run selective tests
5+
6+
---
7+
pkg/machine/provider/platform_test.go | 32 ----
8+
pkg/systemd/quadlet/unitdirs_test.go | 223 --------------------------
9+
2 files changed, 255 deletions(-)
10+
delete mode 100644 pkg/systemd/quadlet/unitdirs_test.go
11+
12+
diff --git a/pkg/machine/provider/platform_test.go b/pkg/machine/provider/platform_test.go
13+
index 9ab62ab..1d38063 100644
14+
--- a/pkg/machine/provider/platform_test.go
15+
+++ b/pkg/machine/provider/platform_test.go
16+
@@ -23,22 +23,6 @@ func TestSupportedProviders(t *testing.T) {
17+
}
18+
}
19+
20+
-func TestInstalledProviders(t *testing.T) {
21+
- installed, err := InstalledProviders()
22+
- assert.NoError(t, err)
23+
- switch runtime.GOOS {
24+
- case "darwin":
25+
- // TODO: need to verify if an arm64 machine reports {applehv, libkrun}
26+
- assert.Equal(t, []define.VMType{define.AppleHvVirt}, installed)
27+
- case "windows":
28+
- provider, err := Get()
29+
- assert.NoError(t, err)
30+
- assert.Contains(t, installed, provider)
31+
- case "linux":
32+
- assert.Equal(t, []define.VMType{define.QemuVirt}, installed)
33+
- }
34+
-}
35+
-
36+
func TestHasPermsForProvider(t *testing.T) {
37+
provider, err := Get()
38+
assert.NoError(t, err)
39+
@@ -69,19 +53,3 @@ func TestBadSupportedProviders(t *testing.T) {
40+
assert.NotEqual(t, []define.VMType{define.AppleHvVirt}, SupportedProviders())
41+
}
42+
}
43+
-
44+
-func TestBadInstalledProviders(t *testing.T) {
45+
- installed, err := InstalledProviders()
46+
- assert.NoError(t, err)
47+
- switch runtime.GOOS {
48+
- case "darwin":
49+
- assert.NotEqual(t, []define.VMType{define.QemuVirt}, installed)
50+
- if runtime.GOARCH != "arm64" {
51+
- assert.NotEqual(t, []define.VMType{define.AppleHvVirt, define.LibKrun}, installed)
52+
- }
53+
- case "windows":
54+
- assert.NotContains(t, installed, define.QemuVirt)
55+
- case "linux":
56+
- assert.NotEqual(t, []define.VMType{define.AppleHvVirt}, installed)
57+
- }
58+
-}
59+
diff --git a/pkg/systemd/quadlet/unitdirs_test.go b/pkg/systemd/quadlet/unitdirs_test.go
60+
deleted file mode 100644
61+
index 6ca785d..0000000
62+
--- a/pkg/systemd/quadlet/unitdirs_test.go
63+
+++ /dev/null
64+
@@ -1,223 +0,0 @@
65+
-//go:build linux
66+
-
67+
-package quadlet
68+
-
69+
-import (
70+
- "fmt"
71+
- "os"
72+
- "os/exec"
73+
- "os/user"
74+
- "path"
75+
- "path/filepath"
76+
- "strconv"
77+
- "strings"
78+
- "syscall"
79+
- "testing"
80+
-
81+
- "github.com/stretchr/testify/assert"
82+
-)
83+
-
84+
-func TestUnitDirs(t *testing.T) {
85+
- u, err := user.Current()
86+
- assert.NoError(t, err)
87+
- uidInt, err := strconv.Atoi(u.Uid)
88+
- assert.NoError(t, err)
89+
-
90+
- if os.Getenv("_UNSHARED") != "true" {
91+
- unitDirs := GetUnitDirs(false)
92+
-
93+
- resolvedUnitDirAdminUser := ResolveUnitDirAdminUser()
94+
- userLevelFilter := GetUserLevelFilter(resolvedUnitDirAdminUser)
95+
- rootfulPaths := NewSearchPaths()
96+
- AppendSubPaths(rootfulPaths, UnitDirTemp, false, userLevelFilter)
97+
- AppendSubPaths(rootfulPaths, UnitDirAdmin, false, userLevelFilter)
98+
- AppendSubPaths(rootfulPaths, UnitDirDistro, false, userLevelFilter)
99+
- assert.Equal(t, rootfulPaths.GetSortedPaths(), unitDirs, "rootful unit dirs should match")
100+
-
101+
- configDir, err := os.UserConfigDir()
102+
- assert.NoError(t, err)
103+
-
104+
- rootlessPaths := NewSearchPaths()
105+
-
106+
- systemUserDirLevel := len(strings.Split(resolvedUnitDirAdminUser, string(os.PathSeparator)))
107+
- nonNumericFilter := GetNonNumericFilter(resolvedUnitDirAdminUser, systemUserDirLevel)
108+
-
109+
- runtimeDir, found := os.LookupEnv("XDG_RUNTIME_DIR")
110+
- if found {
111+
- AppendSubPaths(rootlessPaths, path.Join(runtimeDir, "containers/systemd"), false, nil)
112+
- }
113+
- AppendSubPaths(rootlessPaths, path.Join(configDir, "containers/systemd"), false, nil)
114+
- AppendSubPaths(rootlessPaths, filepath.Join(UnitDirAdmin, "users"), true, nonNumericFilter)
115+
- AppendSubPaths(rootlessPaths, filepath.Join(UnitDirAdmin, "users", u.Uid), true, userLevelFilter)
116+
-
117+
- unitDirs = GetUnitDirs(true)
118+
- assert.Equal(t, rootlessPaths.GetSortedPaths(), unitDirs, "rootless unit dirs should match")
119+
-
120+
- // Test that relative path returns an empty list
121+
- t.Setenv("QUADLET_UNIT_DIRS", "./relative/path")
122+
- unitDirs = GetUnitDirs(false)
123+
- assert.Equal(t, []string{}, unitDirs)
124+
-
125+
- name := t.TempDir()
126+
- t.Setenv("QUADLET_UNIT_DIRS", name)
127+
- unitDirs = GetUnitDirs(false)
128+
- assert.Equal(t, []string{name}, unitDirs, "rootful should use environment variable")
129+
-
130+
- unitDirs = GetUnitDirs(true)
131+
- assert.Equal(t, []string{name}, unitDirs, "rootless should use environment variable")
132+
-
133+
- symLinkTestBaseDir := t.TempDir()
134+
-
135+
- actualDir := filepath.Join(symLinkTestBaseDir, "actual")
136+
- err = os.Mkdir(actualDir, 0755)
137+
- assert.NoError(t, err)
138+
- innerDir := filepath.Join(actualDir, "inner")
139+
- err = os.Mkdir(innerDir, 0755)
140+
- assert.NoError(t, err)
141+
- symlink := filepath.Join(symLinkTestBaseDir, "symlink")
142+
- err = os.Symlink(actualDir, symlink)
143+
- assert.NoError(t, err)
144+
- t.Setenv("QUADLET_UNIT_DIRS", symlink)
145+
- unitDirs = GetUnitDirs(true)
146+
- assert.Equal(t, []string{actualDir, innerDir}, unitDirs, "directory resolution should follow symlink")
147+
-
148+
- // Make a more elborate test with the following structure:
149+
- // <BASE>/linkToDir - real directory to link to
150+
- // <BASE>/linkToDir/a - real directory
151+
- // <BASE>/linkToDir/b - link to <BASE>/unitDir/b/a should be ignored
152+
- // <BASE>/linkToDir/c - link to <BASE>/unitDir should be ignored
153+
- // <BASE>/unitDir - start from here
154+
- // <BASE>/unitDir/a - real directory
155+
- // <BASE>/unitDir/a/a - real directory
156+
- // <BASE>/unitDir/a/a/a - real directory
157+
- // <BASE>/unitDir/b/a - real directory
158+
- // <BASE>/unitDir/b/b - link to <BASE>/unitDir/a/a should be ignored
159+
- // <BASE>/unitDir/c - link to <BASE>/linkToDir
160+
- createDir := func(path, name string, dirs []string) (string, []string) {
161+
- dirName := filepath.Join(path, name)
162+
- assert.NotContains(t, dirs, dirName)
163+
- err = os.Mkdir(dirName, 0755)
164+
- assert.NoError(t, err)
165+
- dirs = append(dirs, dirName)
166+
- return dirName, dirs
167+
- }
168+
-
169+
- linkDir := func(path, name, target string) {
170+
- linkName := filepath.Join(path, name)
171+
- err = os.Symlink(target, linkName)
172+
- assert.NoError(t, err)
173+
- }
174+
-
175+
- symLinkRecursiveTestBaseDir := t.TempDir()
176+
-
177+
- expectedDirs := make([]string, 0)
178+
- // Create <BASE>/unitDir
179+
- unitsDirPath, expectedDirs := createDir(symLinkRecursiveTestBaseDir, "unitsDir", expectedDirs)
180+
- // Create <BASE>/unitDir/a
181+
- aDirPath, expectedDirs := createDir(unitsDirPath, "a", expectedDirs)
182+
- // Create <BASE>/unitDir/a/a
183+
- aaDirPath, expectedDirs := createDir(aDirPath, "a", expectedDirs)
184+
- // Create <BASE>/unitDir/a/a/a
185+
- _, expectedDirs = createDir(aaDirPath, "a", expectedDirs)
186+
- // Create <BASE>/unitDir/a/b
187+
- _, expectedDirs = createDir(aDirPath, "b", expectedDirs)
188+
- // Create <BASE>/unitDir/b
189+
- bDirPath, expectedDirs := createDir(unitsDirPath, "b", expectedDirs)
190+
- // Create <BASE>/unitDir/b/a
191+
- baDirPath, expectedDirs := createDir(bDirPath, "a", expectedDirs)
192+
- // Create <BASE>/linkToDir
193+
- linkToDirPath, expectedDirs := createDir(symLinkRecursiveTestBaseDir, "linkToDir", expectedDirs)
194+
- // Create <BASE>/linkToDir/a
195+
- _, expectedDirs = createDir(linkToDirPath, "a", expectedDirs)
196+
-
197+
- // Link <BASE>/unitDir/b/b to <BASE>/unitDir/a/a
198+
- linkDir(bDirPath, "b", aaDirPath)
199+
- // Link <BASE>/linkToDir/b to <BASE>/unitDir/b/a
200+
- linkDir(linkToDirPath, "b", baDirPath)
201+
- // Link <BASE>/linkToDir/c to <BASE>/unitDir
202+
- linkDir(linkToDirPath, "c", unitsDirPath)
203+
- // Link <BASE>/unitDir/c to <BASE>/linkToDir
204+
- linkDir(unitsDirPath, "c", linkToDirPath)
205+
-
206+
- t.Setenv("QUADLET_UNIT_DIRS", unitsDirPath)
207+
- unitDirs = GetUnitDirs(true)
208+
- assert.Equal(t, expectedDirs, unitDirs, "directory resolution should follow symlink")
209+
- // remove the temporary directory at the end of the program
210+
- defer os.RemoveAll(symLinkTestBaseDir)
211+
-
212+
- // because chroot is only available for root,
213+
- // unshare the namespace and map user to root
214+
- c := exec.Command("/proc/self/exe", os.Args[1:]...)
215+
- c.Stdin = os.Stdin
216+
- c.Stdout = os.Stdout
217+
- c.Stderr = os.Stderr
218+
- c.SysProcAttr = &syscall.SysProcAttr{
219+
- Cloneflags: syscall.CLONE_NEWUSER,
220+
- UidMappings: []syscall.SysProcIDMap{
221+
- {
222+
- ContainerID: 0,
223+
- HostID: uidInt,
224+
- Size: 1,
225+
- },
226+
- },
227+
- }
228+
- c.Env = append(os.Environ(), "_UNSHARED=true")
229+
- err = c.Run()
230+
- assert.NoError(t, err)
231+
- } else {
232+
- fmt.Println(os.Args)
233+
-
234+
- symLinkTestBaseDir := t.TempDir()
235+
- rootF, err := os.Open("/")
236+
- assert.NoError(t, err)
237+
- defer rootF.Close()
238+
- defer func() {
239+
- err := rootF.Chdir()
240+
- assert.NoError(t, err)
241+
- err = syscall.Chroot(".")
242+
- assert.NoError(t, err)
243+
- }()
244+
- err = syscall.Chroot(symLinkTestBaseDir)
245+
- assert.NoError(t, err)
246+
-
247+
- err = os.MkdirAll(UnitDirAdmin, 0755)
248+
- assert.NoError(t, err)
249+
- err = os.RemoveAll(UnitDirAdmin)
250+
- assert.NoError(t, err)
251+
-
252+
- createDir := func(path, name string) string {
253+
- dirName := filepath.Join(path, name)
254+
- err = os.Mkdir(dirName, 0755)
255+
- assert.NoError(t, err)
256+
- return dirName
257+
- }
258+
-
259+
- linkDir := func(path, name, target string) {
260+
- linkName := filepath.Join(path, name)
261+
- err = os.Symlink(target, linkName)
262+
- assert.NoError(t, err)
263+
- }
264+
-
265+
- systemdDir := createDir("/", "systemd")
266+
- userDir := createDir("/", "users")
267+
- linkDir(systemdDir, "users", userDir)
268+
- linkDir(UnitDirAdmin, "", systemdDir)
269+
-
270+
- uidDir := createDir(userDir, u.Uid)
271+
- uidDir2 := createDir(userDir, strconv.Itoa(uidInt+1))
272+
- userInternalDir := createDir(userDir, "internal")
273+
-
274+
- // Make sure QUADLET_UNIT_DIRS is not set
275+
- t.Setenv("QUADLET_UNIT_DIRS", "")
276+
- // Test Rootful
277+
- unitDirs := GetUnitDirs(false)
278+
- assert.NotContains(t, unitDirs, userDir, "rootful should not contain rootless")
279+
- assert.NotContains(t, unitDirs, userInternalDir, "rootful should not contain rootless")
280+
-
281+
- // Test Rootless
282+
- unitDirs = GetUnitDirs(true)
283+
- assert.NotContains(t, unitDirs, uidDir2, "rootless should not contain other users'")
284+
- assert.Contains(t, unitDirs, userInternalDir, "rootless should contain sub-directories of users dir")
285+
- assert.Contains(t, unitDirs, uidDir, "rootless should contain the directory for its UID")
286+
- }
287+
-}
288+
--
289+
2.45.4
290+

SPECS-EXTENDED/podman/CVE-2022-2989.patch

Lines changed: 0 additions & 93 deletions
This file was deleted.
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{
22
"Signatures": {
3-
"dnsname-18822f9.tar.gz": "c78995a745981fc62a6af579ba416304538e3cba7267d6c06b926a9f4bcd8db9",
4-
"gvisor-tap-vsock-aab0ac9.tar.gz": "e833d0a4506a02c8462ebfe34c48542e8142ddce0ab00277252450e6f42271ae",
5-
"podman-4.1.1.tar.gz": "27bf32e9b1afee94cb08ebd59389104788d687f402a541f3631f94c7916b10a5"
3+
"podman-5.6.1.tar.gz": "e4fccc003dac77bae9127968c93388b6bf59d6b9ef8ffbdda21696613f729f3c"
64
}
75
}

0 commit comments

Comments
 (0)