Skip to content

Commit 730bc84

Browse files
committed
Fix directory perms vs umask for tmpcopyup
Bump fileutils to v0.5.1, which fixes permissions of newly created directories to not depend on the value of umask. Add a test case which fails like this before the fix: mounts.bats ✗ runc run [tmpcopyup] (in test file tests/integration/mounts.bats, line 28) `[[ "${lines[0]}" == *'drwxrwxrwx'* ]]' failed runc spec (status=0): runc run test_busybox (status=0): drwxr-xr-x 2 root root 40 Oct 4 22:35 /dir1/dir2 Fixes 3991. Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent d8d576c commit 730bc84

6 files changed

Lines changed: 32 additions & 8 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/godbus/dbus/v5 v5.1.0
1313
github.com/moby/sys/mountinfo v0.6.2
1414
github.com/moby/sys/user v0.1.0
15-
github.com/mrunalp/fileutils v0.5.0
15+
github.com/mrunalp/fileutils v0.5.1
1616
github.com/opencontainers/runtime-spec v1.1.1-0.20230823135140-4fec88fd00a4
1717
github.com/opencontainers/selinux v1.11.0
1818
github.com/seccomp/libseccomp-golang v0.10.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vyg
3030
github.com/moby/sys/mountinfo v0.6.2/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI=
3131
github.com/moby/sys/user v0.1.0 h1:WmZ93f5Ux6het5iituh9x2zAG7NFY9Aqi49jjE1PaQg=
3232
github.com/moby/sys/user v0.1.0/go.mod h1:fKJhFOnsCN6xZ5gSfbM6zaHGgDJMrqt9/reuj4T7MmU=
33-
github.com/mrunalp/fileutils v0.5.0 h1:NKzVxiH7eSk+OQ4M+ZYW1K6h27RUV3MI6NUTsHhU6Z4=
34-
github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ=
33+
github.com/mrunalp/fileutils v0.5.1 h1:F+S7ZlNKnrwHfSwdlgNSkKo67ReVf8o9fel6C3dkm/Q=
34+
github.com/mrunalp/fileutils v0.5.1/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ=
3535
github.com/opencontainers/runtime-spec v1.1.1-0.20230823135140-4fec88fd00a4 h1:EctkgBjZ1y4q+sibyuuIgiKpa0QSd2elFtSSdNvBVow=
3636
github.com/opencontainers/runtime-spec v1.1.1-0.20230823135140-4fec88fd00a4/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
3737
github.com/opencontainers/selinux v1.11.0 h1:+5Zbo97w3Lbmb3PeqQtpmTkMwsW5nRI3YaLpt7tQ7oU=

tests/integration/mounts.bats

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,24 @@ function teardown() {
1010
teardown_bundle
1111
}
1212

13+
# https://github.com/opencontainers/runc/issues/3991
14+
@test "runc run [tmpcopyup]" {
15+
mkdir -p rootfs/dir1/dir2
16+
chmod 777 rootfs/dir1/dir2
17+
update_config ' .mounts += [{
18+
source: "tmpfs",
19+
destination: "/dir1",
20+
type: "tmpfs",
21+
options: ["tmpcopyup"]
22+
}]
23+
| .process.args |= ["ls", "-ld", "/dir1/dir2"]'
24+
25+
umask 022
26+
runc run test_busybox
27+
[ "$status" -eq 0 ]
28+
[[ "${lines[0]}" == *'drwxrwxrwx'* ]]
29+
}
30+
1331
@test "runc run [bind mount]" {
1432
update_config ' .mounts += [{
1533
source: ".",

vendor/github.com/mrunalp/fileutils/fileutils.go

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/mrunalp/fileutils/idtools.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ github.com/moby/sys/mountinfo
3838
# github.com/moby/sys/user v0.1.0
3939
## explicit; go 1.17
4040
github.com/moby/sys/user
41-
# github.com/mrunalp/fileutils v0.5.0
41+
# github.com/mrunalp/fileutils v0.5.1
4242
## explicit; go 1.13
4343
github.com/mrunalp/fileutils
4444
# github.com/opencontainers/runtime-spec v1.1.1-0.20230823135140-4fec88fd00a4

0 commit comments

Comments
 (0)