Skip to content

Commit

Permalink
vendor: update fsutil to 91a3fc4
Browse files Browse the repository at this point in the history
Brings in fix for hardlink filters.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
  • Loading branch information
tonistiigi authored and jedevc committed Apr 24, 2024
1 parent 2aa1bdf commit f67b96c
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 5 deletions.
52 changes: 52 additions & 0 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ var allTests = []func(t *testing.T, sb integration.Sandbox){
testFileOpInputSwap,
testRelativeMountpoint,
testLocalSourceDiffer,
testLocalSourceWithHardlinksFilter,
testNoTarOCIIndexMediaType,
testOCILayoutSource,
testOCILayoutPlatformSource,
Expand Down Expand Up @@ -2042,6 +2043,57 @@ func testLocalSourceWithDiffer(t *testing.T, sb integration.Sandbox, d llb.DiffT
}
}

// moby/buildkit#4831
func testLocalSourceWithHardlinksFilter(t *testing.T, sb integration.Sandbox) {
requiresLinux(t)
c, err := New(context.TODO(), sb.Address())
require.NoError(t, err)
defer c.Close()

dir := integration.Tmpdir(
t,
fstest.CreateFile("bar", []byte("bar"), 0600),
fstest.Link("bar", "foo1"),
fstest.Link("bar", "foo2"),
)

st := llb.Local("mylocal", llb.FollowPaths([]string{"foo*"}))

def, err := st.Marshal(context.TODO())
require.NoError(t, err)

destDir := t.TempDir()

_, err = c.Solve(context.TODO(), def, SolveOpt{
Exports: []ExportEntry{
{
Type: ExporterLocal,
OutputDir: destDir,
},
},
LocalMounts: map[string]fsutil.FS{
"mylocal": dir,
},
}, nil)
require.NoError(t, err)

_, err = os.ReadFile(filepath.Join(destDir, "bar"))
require.Error(t, err)
require.True(t, os.IsNotExist(err))

dt, err := os.ReadFile(filepath.Join(destDir, "foo1"))
require.NoError(t, err)
require.Equal(t, []byte("bar"), dt)

st1, err := os.Stat(filepath.Join(destDir, "foo1"))
require.NoError(t, err)

st2, err := os.Stat(filepath.Join(destDir, "foo2"))
require.NoError(t, err)

require.True(t, os.SameFile(st1, st2))
}

func testOCILayoutSource(t *testing.T, sb integration.Sandbox) {
workers.CheckFeatureCompat(t, sb, workers.FeatureOCIExporter, workers.FeatureOCILayout)
requiresLinux(t)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ require (
github.com/sirupsen/logrus v1.9.3
github.com/spdx/tools-golang v0.5.3
github.com/stretchr/testify v1.8.4
github.com/tonistiigi/fsutil v0.0.0-20240418180507-497d33b008ef
github.com/tonistiigi/fsutil v0.0.0-20240424095704-91a3fc46842c
github.com/tonistiigi/go-actions-cache v0.0.0-20240320205438-9794bdbb2fb4
github.com/tonistiigi/go-archvariant v1.0.0
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tonistiigi/fsutil v0.0.0-20240418180507-497d33b008ef h1:1rshiFn5ka7/H9oGYXvRnV1BzhtWls2WSQZDrNwVsCA=
github.com/tonistiigi/fsutil v0.0.0-20240418180507-497d33b008ef/go.mod h1:vbbYqJlnswsbJqWUcJN8fKtBhnEgldDrcagTgnBVKKM=
github.com/tonistiigi/fsutil v0.0.0-20240424095704-91a3fc46842c h1:+6wg/4ORAbnSoGDzg2Q1i3CeMcT/jjhye/ZfnBHy7/M=
github.com/tonistiigi/fsutil v0.0.0-20240424095704-91a3fc46842c/go.mod h1:vbbYqJlnswsbJqWUcJN8fKtBhnEgldDrcagTgnBVKKM=
github.com/tonistiigi/go-actions-cache v0.0.0-20240320205438-9794bdbb2fb4 h1:R0lM8Jo3aZL95yjQHWQti7nszllleKBxCs9uyFbykII=
github.com/tonistiigi/go-actions-cache v0.0.0-20240320205438-9794bdbb2fb4/go.mod h1:anhKd3mnC1shAbQj1Q4IJ+w6xqezxnyDYlx/yKa7IXM=
github.com/tonistiigi/go-archvariant v1.0.0 h1:5LC1eDWiBNflnTF1prCiX09yfNHIxDC/aukdhCdTyb0=
Expand Down
68 changes: 68 additions & 0 deletions vendor/github.com/tonistiigi/fsutil/hardlinks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/tonistiigi/fsutil/send.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ github.com/spdx/tools-golang/spdx/v2/v2_3
## explicit; go 1.20
github.com/stretchr/testify/assert
github.com/stretchr/testify/require
# github.com/tonistiigi/fsutil v0.0.0-20240418180507-497d33b008ef
# github.com/tonistiigi/fsutil v0.0.0-20240424095704-91a3fc46842c
## explicit; go 1.20
github.com/tonistiigi/fsutil
github.com/tonistiigi/fsutil/copy
Expand Down

0 comments on commit f67b96c

Please sign in to comment.