mirror of
https://github.com/moby/moby.git
synced 2025-04-18 20:44:11 +03:00
deprecate pkg/atomicwriter, migrate to github.com/moby/sys/atomicwriter
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
d7b743b856
commit
6422ff2804
@ -30,13 +30,13 @@ import (
|
||||
"github.com/docker/docker/image"
|
||||
libcontainerdtypes "github.com/docker/docker/libcontainerd/types"
|
||||
"github.com/docker/docker/oci"
|
||||
"github.com/docker/docker/pkg/atomicwriter"
|
||||
"github.com/docker/docker/pkg/idtools"
|
||||
"github.com/docker/docker/restartmanager"
|
||||
"github.com/docker/docker/volume"
|
||||
volumemounts "github.com/docker/docker/volume/mounts"
|
||||
"github.com/docker/go-units"
|
||||
agentexec "github.com/moby/swarmkit/v2/agent/exec"
|
||||
"github.com/moby/sys/atomicwriter"
|
||||
"github.com/moby/sys/signal"
|
||||
"github.com/moby/sys/symlink"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/pkg/atomicwriter"
|
||||
"github.com/moby/sys/atomicwriter"
|
||||
)
|
||||
|
||||
// convertKVStringsToMap converts ["key=value"] to {"key":"value"}
|
||||
|
@ -23,12 +23,12 @@ import (
|
||||
"github.com/docker/docker/internal/containerfs"
|
||||
"github.com/docker/docker/internal/directory"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/atomicwriter"
|
||||
"github.com/docker/docker/pkg/chrootarchive"
|
||||
"github.com/docker/docker/pkg/idtools"
|
||||
"github.com/docker/docker/quota"
|
||||
"github.com/docker/go-units"
|
||||
"github.com/moby/locker"
|
||||
"github.com/moby/sys/atomicwriter"
|
||||
"github.com/moby/sys/mount"
|
||||
"github.com/moby/sys/userns"
|
||||
"github.com/opencontainers/selinux/go-selinux/label"
|
||||
|
@ -4,8 +4,8 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/docker/docker/pkg/atomicwriter"
|
||||
"github.com/google/uuid"
|
||||
"github.com/moby/sys/atomicwriter"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
@ -21,7 +21,7 @@ import (
|
||||
"github.com/docker/docker/daemon/config"
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/docker/docker/libcontainerd/shimopts"
|
||||
"github.com/docker/docker/pkg/atomicwriter"
|
||||
"github.com/moby/sys/atomicwriter"
|
||||
"github.com/opencontainers/runtime-spec/specs-go/features"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
"github.com/docker/docker/pkg/atomicwriter"
|
||||
"github.com/moby/sys/atomicwriter"
|
||||
)
|
||||
|
||||
// Store implements a K/V store for mapping distribution-related IDs
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/containerd/log"
|
||||
"github.com/docker/docker/pkg/atomicwriter"
|
||||
"github.com/moby/sys/atomicwriter"
|
||||
"github.com/opencontainers/go-digest"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
@ -12,8 +12,8 @@ import (
|
||||
|
||||
"github.com/containerd/log"
|
||||
"github.com/docker/distribution"
|
||||
"github.com/docker/docker/pkg/atomicwriter"
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
"github.com/moby/sys/atomicwriter"
|
||||
"github.com/opencontainers/go-digest"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
@ -31,7 +31,7 @@ import (
|
||||
"text/template"
|
||||
|
||||
"github.com/containerd/log"
|
||||
"github.com/docker/docker/pkg/atomicwriter"
|
||||
"github.com/moby/sys/atomicwriter"
|
||||
"github.com/opencontainers/go-digest"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
56
pkg/atomicwriter/atomicwriter_deprecated.go
Normal file
56
pkg/atomicwriter/atomicwriter_deprecated.go
Normal file
@ -0,0 +1,56 @@
|
||||
package atomicwriter
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/moby/sys/atomicwriter"
|
||||
)
|
||||
|
||||
// New returns a WriteCloser so that writing to it writes to a
|
||||
// temporary file and closing it atomically changes the temporary file to
|
||||
// destination path. Writing and closing concurrently is not allowed.
|
||||
// NOTE: umask is not considered for the file's permissions.
|
||||
//
|
||||
// New uses [sequential.CreateTemp] to use sequential file access on Windows,
|
||||
// avoiding depleting the standby list un-necessarily. On Linux, this equates to
|
||||
// a regular [os.CreateTemp]. Refer to the [Win32 API documentation] for details
|
||||
// on sequential file access.
|
||||
//
|
||||
// Deprecated: use [atomicwriter.New] instead.
|
||||
//
|
||||
// [Win32 API documentation]: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea#FILE_FLAG_SEQUENTIAL_SCAN
|
||||
func New(filename string, perm os.FileMode) (io.WriteCloser, error) {
|
||||
return atomicwriter.New(filename, perm)
|
||||
}
|
||||
|
||||
// WriteFile atomically writes data to a file named by filename and with the
|
||||
// specified permission bits. The given filename is created if it does not exist,
|
||||
// but the destination directory must exist. It can be used as a drop-in replacement
|
||||
// for [os.WriteFile], but currently does not allow the destination path to be
|
||||
// a symlink. WriteFile is implemented using [New] for its implementation.
|
||||
//
|
||||
// NOTE: umask is not considered for the file's permissions.
|
||||
//
|
||||
// Deprecated: use [atomicwriter.WriteFile] instead.
|
||||
func WriteFile(filename string, data []byte, perm os.FileMode) error {
|
||||
return atomicwriter.WriteFile(filename, data, perm)
|
||||
}
|
||||
|
||||
// WriteSet is used to atomically write a set
|
||||
// of files and ensure they are visible at the same time.
|
||||
// Must be committed to a new directory.
|
||||
//
|
||||
// Deprecated: use [atomicwriter.WriteSet] instead.
|
||||
type WriteSet = atomicwriter.WriteSet
|
||||
|
||||
// NewWriteSet creates a new atomic write set to
|
||||
// atomically create a set of files. The given directory
|
||||
// is used as the base directory for storing files before
|
||||
// commit. If no temporary directory is given the system
|
||||
// default is used.
|
||||
//
|
||||
// Deprecated: use [atomicwriter.NewWriteSet] instead.
|
||||
func NewWriteSet(tmpDir string) (*atomicwriter.WriteSet, error) {
|
||||
return atomicwriter.NewWriteSet(tmpDir)
|
||||
}
|
@ -1,325 +0,0 @@
|
||||
package atomicwriter
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"syscall"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// testMode returns the file-mode to use in tests, accounting for Windows
|
||||
// not supporting full Linux file mode.
|
||||
func testMode() os.FileMode {
|
||||
if runtime.GOOS == "windows" {
|
||||
return 0o666
|
||||
}
|
||||
return 0o640
|
||||
}
|
||||
|
||||
// assertFile asserts the given fileName to exist, and to have the expected
|
||||
// content and mode.
|
||||
func assertFile(t *testing.T, fileName string, fileContent []byte, expectedMode os.FileMode) {
|
||||
t.Helper()
|
||||
actual, err := os.ReadFile(fileName)
|
||||
if err != nil {
|
||||
t.Fatalf("Error reading from file: %v", err)
|
||||
}
|
||||
|
||||
if !bytes.Equal(actual, fileContent) {
|
||||
t.Errorf("Data mismatch, expected %q, got %q", fileContent, actual)
|
||||
}
|
||||
|
||||
st, err := os.Stat(fileName)
|
||||
if err != nil {
|
||||
t.Fatalf("Error statting file: %v", err)
|
||||
}
|
||||
if st.Mode() != expectedMode {
|
||||
t.Errorf("Mode mismatched, expected %o, got %o", expectedMode, st.Mode())
|
||||
}
|
||||
}
|
||||
|
||||
// assertFileCount asserts the given directory has the expected number
|
||||
// of files, and returns the list of files found.
|
||||
func assertFileCount(t *testing.T, directory string, expected int) []os.DirEntry {
|
||||
t.Helper()
|
||||
files, err := os.ReadDir(directory)
|
||||
if err != nil {
|
||||
t.Fatalf("Error reading dir: %v", err)
|
||||
}
|
||||
if len(files) != expected {
|
||||
t.Errorf("Expected %d files, got %d: %v", expected, len(files), files)
|
||||
}
|
||||
return files
|
||||
}
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
for _, tc := range []string{"normal", "symlinked"} {
|
||||
tmpDir := t.TempDir()
|
||||
parentDir := tmpDir
|
||||
actualParentDir := parentDir
|
||||
if tc == "symlinked" {
|
||||
actualParentDir = filepath.Join(tmpDir, "parent-dir")
|
||||
if err := os.Mkdir(actualParentDir, 0o700); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
parentDir = filepath.Join(tmpDir, "parent-dir-symlink")
|
||||
if err := os.Symlink(actualParentDir, parentDir); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
t.Run(tc, func(t *testing.T) {
|
||||
for _, tc := range []string{"new-file", "existing-file"} {
|
||||
t.Run(tc, func(t *testing.T) {
|
||||
fileName := filepath.Join(parentDir, "test.txt")
|
||||
var origFileCount int
|
||||
if tc == "existing-file" {
|
||||
if err := os.WriteFile(fileName, []byte("original content"), testMode()); err != nil {
|
||||
t.Fatalf("Error writing file: %v", err)
|
||||
}
|
||||
origFileCount = 1
|
||||
}
|
||||
writer, err := New(fileName, testMode())
|
||||
if writer == nil {
|
||||
t.Errorf("Writer is nil")
|
||||
}
|
||||
if err != nil {
|
||||
t.Fatalf("Error creating new atomicwriter: %v", err)
|
||||
}
|
||||
files := assertFileCount(t, actualParentDir, origFileCount+1)
|
||||
if tmpFileName := files[0].Name(); !strings.HasPrefix(tmpFileName, ".tmp-test.txt") {
|
||||
t.Errorf("Unexpected file name for temp-file: %s", tmpFileName)
|
||||
}
|
||||
|
||||
// Closing the writer without writing should clean up the temp-file,
|
||||
// and should not replace the destination file.
|
||||
if err = writer.Close(); err != nil {
|
||||
t.Errorf("Error closing writer: %v", err)
|
||||
}
|
||||
assertFileCount(t, actualParentDir, origFileCount)
|
||||
if tc == "existing-file" {
|
||||
assertFile(t, fileName, []byte("original content"), testMode())
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewInvalid(t *testing.T) {
|
||||
t.Run("missing target dir", func(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
fileName := filepath.Join(tmpDir, "missing-dir", "test.txt")
|
||||
writer, err := New(fileName, testMode())
|
||||
if writer != nil {
|
||||
t.Errorf("Should not have created writer")
|
||||
}
|
||||
if !errors.Is(err, os.ErrNotExist) {
|
||||
t.Errorf("Should produce a 'not found' error, but got %[1]T (%[1]v)", err)
|
||||
}
|
||||
})
|
||||
t.Run("target dir is not a directory", func(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
parentPath := filepath.Join(tmpDir, "not-a-dir")
|
||||
err := os.WriteFile(parentPath, nil, testMode())
|
||||
if err != nil {
|
||||
t.Fatalf("Error writing file: %v", err)
|
||||
}
|
||||
fileName := filepath.Join(parentPath, "new-file.txt")
|
||||
writer, err := New(fileName, testMode())
|
||||
if writer != nil {
|
||||
t.Errorf("Should not have created writer")
|
||||
}
|
||||
// This should match the behavior of os.WriteFile, which returns a [os.PathError] with [syscall.ENOTDIR].
|
||||
if !errors.Is(err, syscall.ENOTDIR) {
|
||||
t.Errorf("Should produce a 'not a directory' error, but got %[1]T (%[1]v)", err)
|
||||
}
|
||||
})
|
||||
t.Run("empty filename", func(t *testing.T) {
|
||||
writer, err := New("", testMode())
|
||||
if writer != nil {
|
||||
t.Errorf("Should not have created writer")
|
||||
}
|
||||
if err == nil || err.Error() != "file name is empty" {
|
||||
t.Errorf("Should produce a 'file name is empty' error, but got %[1]T (%[1]v)", err)
|
||||
}
|
||||
})
|
||||
t.Run("directory", func(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
writer, err := New(tmpDir, testMode())
|
||||
if writer != nil {
|
||||
t.Errorf("Should not have created writer")
|
||||
}
|
||||
if err == nil || err.Error() != "cannot write to a directory" {
|
||||
t.Errorf("Should produce a 'cannot write to a directory' error, but got %[1]T (%[1]v)", err)
|
||||
}
|
||||
})
|
||||
t.Run("symlinked file", func(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
linkTarget := filepath.Join(tmpDir, "symlink-target")
|
||||
if err := os.WriteFile(linkTarget, []byte("orig content"), testMode()); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
fileName := filepath.Join(tmpDir, "symlinked-file")
|
||||
if err := os.Symlink(linkTarget, fileName); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
writer, err := New(fileName, testMode())
|
||||
if writer != nil {
|
||||
t.Errorf("Should not have created writer")
|
||||
}
|
||||
if err == nil || err.Error() != "cannot write to a symbolic link directly" {
|
||||
t.Errorf("Should produce a 'cannot write to a symbolic link directly' error, but got %[1]T (%[1]v)", err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestWriteFile(t *testing.T) {
|
||||
t.Run("empty filename", func(t *testing.T) {
|
||||
err := WriteFile("", nil, testMode())
|
||||
if err == nil || err.Error() != "file name is empty" {
|
||||
t.Errorf("Should produce a 'file name is empty' error, but got %[1]T (%[1]v)", err)
|
||||
}
|
||||
})
|
||||
t.Run("write to directory", func(t *testing.T) {
|
||||
err := WriteFile(t.TempDir(), nil, testMode())
|
||||
if err == nil || err.Error() != "cannot write to a directory" {
|
||||
t.Errorf("Should produce a 'cannot write to a directory' error, but got %[1]T (%[1]v)", err)
|
||||
}
|
||||
})
|
||||
t.Run("write to file", func(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
fileName := filepath.Join(tmpDir, "test.txt")
|
||||
fileContent := []byte("file content")
|
||||
fileMode := testMode()
|
||||
if err := WriteFile(fileName, fileContent, fileMode); err != nil {
|
||||
t.Fatalf("Error writing to file: %v", err)
|
||||
}
|
||||
assertFile(t, fileName, fileContent, fileMode)
|
||||
assertFileCount(t, tmpDir, 1)
|
||||
})
|
||||
t.Run("missing parent directory", func(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
fileName := filepath.Join(tmpDir, "missing-dir", "test.txt")
|
||||
fileContent := []byte("file content")
|
||||
fileMode := testMode()
|
||||
if err := WriteFile(fileName, fileContent, fileMode); !errors.Is(err, os.ErrNotExist) {
|
||||
t.Errorf("Should produce a 'not found' error, but got %[1]T (%[1]v)", err)
|
||||
}
|
||||
assertFileCount(t, tmpDir, 0)
|
||||
})
|
||||
t.Run("symlinked file", func(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
linkTarget := filepath.Join(tmpDir, "symlink-target")
|
||||
originalContent := []byte("original content")
|
||||
fileMode := testMode()
|
||||
if err := os.WriteFile(linkTarget, originalContent, fileMode); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.Symlink(linkTarget, filepath.Join(tmpDir, "symlinked-file")); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
origFileCount := 2
|
||||
assertFileCount(t, tmpDir, origFileCount)
|
||||
|
||||
fileName := filepath.Join(tmpDir, "symlinked-file")
|
||||
err := WriteFile(fileName, []byte("new content"), testMode())
|
||||
if err == nil || err.Error() != "cannot write to a symbolic link directly" {
|
||||
t.Errorf("Should produce a 'cannot write to a symbolic link directly' error, but got %[1]T (%[1]v)", err)
|
||||
}
|
||||
assertFile(t, linkTarget, originalContent, fileMode)
|
||||
assertFileCount(t, tmpDir, origFileCount)
|
||||
})
|
||||
t.Run("symlinked directory", func(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
actualParentDir := filepath.Join(tmpDir, "parent-dir")
|
||||
if err := os.Mkdir(actualParentDir, 0o700); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
actualTargetFile := filepath.Join(actualParentDir, "target-file")
|
||||
if err := os.WriteFile(actualTargetFile, []byte("orig content"), testMode()); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
parentDir := filepath.Join(tmpDir, "parent-dir-symlink")
|
||||
if err := os.Symlink(actualParentDir, parentDir); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
origFileCount := 1
|
||||
assertFileCount(t, actualParentDir, origFileCount)
|
||||
|
||||
fileName := filepath.Join(parentDir, "target-file")
|
||||
fileContent := []byte("new content")
|
||||
fileMode := testMode()
|
||||
if err := WriteFile(fileName, fileContent, fileMode); err != nil {
|
||||
t.Fatalf("Error writing to file: %v", err)
|
||||
}
|
||||
assertFile(t, fileName, fileContent, fileMode)
|
||||
assertFile(t, actualTargetFile, fileContent, fileMode)
|
||||
assertFileCount(t, actualParentDir, origFileCount)
|
||||
})
|
||||
}
|
||||
|
||||
func TestWriteSetCommit(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
|
||||
if err := os.Mkdir(filepath.Join(tmpDir, "tmp"), 0o700); err != nil {
|
||||
t.Fatalf("Error creating tmp directory: %s", err)
|
||||
}
|
||||
|
||||
targetDir := filepath.Join(tmpDir, "target")
|
||||
ws, err := NewWriteSet(filepath.Join(tmpDir, "tmp"))
|
||||
if err != nil {
|
||||
t.Fatalf("Error creating atomic write set: %s", err)
|
||||
}
|
||||
|
||||
fileContent := []byte("file content")
|
||||
fileMode := testMode()
|
||||
|
||||
if err := ws.WriteFile("foo", fileContent, fileMode); err != nil {
|
||||
t.Fatalf("Error writing to file: %v", err)
|
||||
}
|
||||
|
||||
if _, err := os.ReadFile(filepath.Join(targetDir, "foo")); err == nil {
|
||||
t.Fatalf("Expected error reading file where should not exist")
|
||||
}
|
||||
|
||||
if err := ws.Commit(targetDir); err != nil {
|
||||
t.Fatalf("Error committing file: %s", err)
|
||||
}
|
||||
|
||||
assertFile(t, filepath.Join(targetDir, "foo"), fileContent, fileMode)
|
||||
assertFileCount(t, targetDir, 1)
|
||||
}
|
||||
|
||||
func TestWriteSetCancel(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
|
||||
if err := os.Mkdir(filepath.Join(tmpDir, "tmp"), 0o700); err != nil {
|
||||
t.Fatalf("Error creating tmp directory: %s", err)
|
||||
}
|
||||
|
||||
ws, err := NewWriteSet(filepath.Join(tmpDir, "tmp"))
|
||||
if err != nil {
|
||||
t.Fatalf("Error creating atomic write set: %s", err)
|
||||
}
|
||||
|
||||
fileContent := []byte("file content")
|
||||
fileMode := testMode()
|
||||
if err := ws.WriteFile("foo", fileContent, fileMode); err != nil {
|
||||
t.Fatalf("Error writing to file: %v", err)
|
||||
}
|
||||
|
||||
if err := ws.Cancel(); err != nil {
|
||||
t.Fatalf("Error committing file: %s", err)
|
||||
}
|
||||
|
||||
if _, err := os.ReadFile(filepath.Join(tmpDir, "target", "foo")); err == nil {
|
||||
t.Fatalf("Expected error reading file where should not exist")
|
||||
} else if !errors.Is(err, os.ErrNotExist) {
|
||||
t.Fatalf("Unexpected error reading file: %s", err)
|
||||
}
|
||||
assertFileCount(t, filepath.Join(tmpDir, "tmp"), 0)
|
||||
}
|
@ -4,7 +4,7 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/docker/docker/pkg/atomicwriter"
|
||||
"github.com/moby/sys/atomicwriter"
|
||||
)
|
||||
|
||||
// NewAtomicFileWriter returns WriteCloser so that writing to it writes to a
|
||||
|
@ -19,11 +19,11 @@ import (
|
||||
"github.com/docker/docker/api/types/events"
|
||||
"github.com/docker/docker/internal/containerfs"
|
||||
"github.com/docker/docker/internal/lazyregexp"
|
||||
"github.com/docker/docker/pkg/atomicwriter"
|
||||
"github.com/docker/docker/pkg/authorization"
|
||||
v2 "github.com/docker/docker/plugin/v2"
|
||||
"github.com/docker/docker/registry"
|
||||
"github.com/moby/pubsub"
|
||||
"github.com/moby/sys/atomicwriter"
|
||||
"github.com/opencontainers/go-digest"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/distribution/reference"
|
||||
"github.com/docker/docker/pkg/atomicwriter"
|
||||
"github.com/moby/sys/atomicwriter"
|
||||
"github.com/opencontainers/go-digest"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
@ -70,6 +70,7 @@ require (
|
||||
github.com/moby/patternmatcher v0.6.0
|
||||
github.com/moby/pubsub v1.0.0
|
||||
github.com/moby/swarmkit/v2 v2.0.0-20250103191802-8c1959736554
|
||||
github.com/moby/sys/atomicwriter v0.0.0-20250404210502-6e2523cbf3a1
|
||||
github.com/moby/sys/mount v0.3.4
|
||||
github.com/moby/sys/mountinfo v0.7.2
|
||||
github.com/moby/sys/reexec v0.1.0
|
||||
|
@ -397,6 +397,8 @@ github.com/moby/pubsub v1.0.0 h1:jkp/imWsmJz2f6LyFsk7EkVeN2HxR/HTTOY8kHrsxfA=
|
||||
github.com/moby/pubsub v1.0.0/go.mod h1:bXSO+3h5MNXXCaEG+6/NlAIk7MMZbySZlnB+cUQhKKc=
|
||||
github.com/moby/swarmkit/v2 v2.0.0-20250103191802-8c1959736554 h1:DMHJbgyNZWyrPKYjCYt2IxEO7KA0eSd4fo6KQsv2W84=
|
||||
github.com/moby/swarmkit/v2 v2.0.0-20250103191802-8c1959736554/go.mod h1:mTTGIAz/59OGZR5Qe+QByIe3Nxc+sSuJkrsStFhr6Lg=
|
||||
github.com/moby/sys/atomicwriter v0.0.0-20250404210502-6e2523cbf3a1 h1:RfsCoQh4+GdgY8QQ7y05leVCa8niO1Phmy5CF3YiSgo=
|
||||
github.com/moby/sys/atomicwriter v0.0.0-20250404210502-6e2523cbf3a1/go.mod h1:Ul8oqv2ZMNHOceF643P6FKPXeCmYtlQMvpizfsSoaWs=
|
||||
github.com/moby/sys/mount v0.3.4 h1:yn5jq4STPztkkzSKpZkLcmjue+bZJ0u2AuQY1iNI1Ww=
|
||||
github.com/moby/sys/mount v0.3.4/go.mod h1:KcQJMbQdJHPlq5lcYT+/CjatWM4PuxKe+XLSVS4J6Os=
|
||||
github.com/moby/sys/mountinfo v0.7.2 h1:1shs6aH5s4o5H2zQLn796ADW1wMrIwHsyJ2v9KouLrg=
|
||||
|
202
vendor/github.com/moby/sys/atomicwriter/LICENSE
generated
vendored
Normal file
202
vendor/github.com/moby/sys/atomicwriter/LICENSE
generated
vendored
Normal file
@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
3
vendor/modules.txt
vendored
3
vendor/modules.txt
vendored
@ -1007,6 +1007,9 @@ github.com/moby/swarmkit/v2/volumequeue
|
||||
github.com/moby/swarmkit/v2/watch
|
||||
github.com/moby/swarmkit/v2/watch/queue
|
||||
github.com/moby/swarmkit/v2/xnet
|
||||
# github.com/moby/sys/atomicwriter v0.0.0-20250404210502-6e2523cbf3a1
|
||||
## explicit; go 1.18
|
||||
github.com/moby/sys/atomicwriter
|
||||
# github.com/moby/sys/mount v0.3.4
|
||||
## explicit; go 1.17
|
||||
github.com/moby/sys/mount
|
||||
|
@ -16,10 +16,10 @@ import (
|
||||
"github.com/containerd/log"
|
||||
"github.com/docker/docker/daemon/names"
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/docker/docker/pkg/atomicwriter"
|
||||
"github.com/docker/docker/pkg/idtools"
|
||||
"github.com/docker/docker/quota"
|
||||
"github.com/docker/docker/volume"
|
||||
"github.com/moby/sys/atomicwriter"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user