diff --git a/go.mod b/go.mod index 6278b07357..6e79e47130 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( github.com/opencontainers/runtime-spec v1.0.1 // indirect github.com/opencontainers/selinux v1.0.0-rc1 // indirect github.com/opentracing/opentracing-go v1.0.2 // indirect - github.com/otiai10/copy v1.0.2 + github.com/otiai10/copy v1.6.0 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.6.0 github.com/spf13/afero v1.2.2 diff --git a/go.sum b/go.sum index a93a4ba816..96d9b75d18 100644 --- a/go.sum +++ b/go.sum @@ -569,10 +569,14 @@ github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/otiai10/copy v1.0.2 h1:DDNipYy6RkIkjMwy+AWzgKiNTyj2RUI9yEMeETEpVyc= github.com/otiai10/copy v1.0.2/go.mod h1:c7RpqBkwMom4bYTSkLSym4VSJz/XtncWRAj/J4PEIMY= +github.com/otiai10/copy v1.6.0 h1:IinKAryFFuPONZ7cm6T6E2QX/vcJwSnlaA5lfoaXIiQ= +github.com/otiai10/copy v1.6.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95 h1:+OLn68pqasWca0z5ryit9KGfp3sUsW4Lqg32iRMJyzs= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= +github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0 h1:Ady6MKVezQwHBkGzLFbrsywyp09Ah7rkmfjV3Bcr5uc= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= +github.com/otiai10/mint v1.3.2/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= diff --git a/integration/dockerfiles-with-context/issue-960/Dockerfile b/integration/dockerfiles-with-context/issue-960/Dockerfile new file mode 100644 index 0000000000..61bbdabc6b --- /dev/null +++ b/integration/dockerfiles-with-context/issue-960/Dockerfile @@ -0,0 +1,5 @@ +FROM alpine:3.11 as rootfs +RUN echo 7777 + +FROM alpine:3.11 +COPY --from=rootfs / /sysroot/ diff --git a/pkg/util/fs_util.go b/pkg/util/fs_util.go index d5b472559f..c9a451afe1 100644 --- a/pkg/util/fs_util.go +++ b/pkg/util/fs_util.go @@ -894,7 +894,16 @@ func CopyFileOrSymlink(src string, destDir string, root string) error { } return os.Symlink(link, destFile) } - return otiai10Cpy.Copy(src, destFile) + opt := otiai10Cpy.Options{ + Skip: func(path string) (bool, error) { + if CheckIgnoreList(path) { + logrus.Debugf("Not copying %s, as it's ignored", path) + return true, nil + } + return false, nil + }, + } + return otiai10Cpy.Copy(src, destFile, opt) } func createParentDirectory(path string) error { diff --git a/vendor/github.com/genuinetools/bpfd/proc/proc.go b/vendor/github.com/genuinetools/bpfd/proc/proc.go index d48d479694..f2357caf8d 100644 --- a/vendor/github.com/genuinetools/bpfd/proc/proc.go +++ b/vendor/github.com/genuinetools/bpfd/proc/proc.go @@ -150,12 +150,6 @@ func GetContainerRuntime(tgid, pid int) ContainerRuntime { return runtime } - // Check for container specific files - runtime = detectContainerFiles() - if runtime != RuntimeNotFound { - return runtime - } - return RuntimeNotFound } @@ -173,28 +167,6 @@ func getContainerRuntime(input string) ContainerRuntime { return RuntimeNotFound } -// Related implementation: https://github.com/systemd/systemd/blob/6604fb0207ee10e8dc05d67f6fe45de0b193b5c4/src/basic/virt.c#L523-L549 -func detectContainerFiles() ContainerRuntime { - files := []struct { - runtime ContainerRuntime - location string - }{ - // https://github.com/containers/podman/issues/6192 - // https://github.com/containers/podman/issues/3586#issuecomment-661918679 - {RuntimePodman, "/run/.containerenv"}, - // https://github.com/moby/moby/issues/18355 - {RuntimeDocker, "/.dockerenv"}, - } - - for i := range files { - if fileExists(files[i].location) { - return files[i].runtime - } - } - - return RuntimeNotFound -} - // GetContainerID returns the container ID for a process if it's running in a container. // If pid is less than one, it returns the container ID for "self". func GetContainerID(tgid, pid int) string { diff --git a/vendor/github.com/otiai10/copy/.gitignore b/vendor/github.com/otiai10/copy/.gitignore index 5b5ae0a524..d65ce17257 100644 --- a/vendor/github.com/otiai10/copy/.gitignore +++ b/vendor/github.com/otiai10/copy/.gitignore @@ -1,3 +1,5 @@ -testdata.copy +test/data.copy coverage.txt vendor +.vagrant +.idea/ diff --git a/vendor/github.com/otiai10/copy/.travis.yml b/vendor/github.com/otiai10/copy/.travis.yml deleted file mode 100644 index 65f32d9df8..0000000000 --- a/vendor/github.com/otiai10/copy/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: go -go: - - 1.9 - - tip -before_script: - - go get -t ./... -script: - - go test ./... -v - - go test -race -coverprofile=coverage.txt -covermode=atomic -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/otiai10/copy/README.md b/vendor/github.com/otiai10/copy/README.md index f5729fa289..78ad991d9b 100644 --- a/vendor/github.com/otiai10/copy/README.md +++ b/vendor/github.com/otiai10/copy/README.md @@ -1,14 +1,62 @@ # copy -[![Build Status](https://travis-ci.org/otiai10/copy.svg?branch=master)](https://travis-ci.org/otiai10/copy) -[![codecov](https://codecov.io/gh/otiai10/copy/branch/master/graph/badge.svg)](https://codecov.io/gh/otiai10/copy) -[![GoDoc](https://godoc.org/github.com/otiai10/copy?status.svg)](https://godoc.org/github.com/otiai10/copy) +[![Go Reference](https://pkg.go.dev/badge/github.com/otiai10/copy.svg)](https://pkg.go.dev/github.com/otiai10/copy) +[![Actions Status](https://github.com/otiai10/copy/workflows/Go/badge.svg)](https://github.com/otiai10/copy/actions) +[![codecov](https://codecov.io/gh/otiai10/copy/branch/main/graph/badge.svg)](https://codecov.io/gh/otiai10/copy) +[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/otiai10/copy/blob/main/LICENSE) [![Go Report Card](https://goreportcard.com/badge/github.com/otiai10/copy)](https://goreportcard.com/report/github.com/otiai10/copy) +[![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/otiai10/copy?sort=semver)](https://pkg.go.dev/github.com/otiai10/copy) `copy` copies directories recursively. -Example: +# Example Usage ```go err := Copy("your/directory", "your/directory.copy") ``` + +# Advanced Usage + +```go +// Options specifies optional actions on copying. +type Options struct { + + // OnSymlink can specify what to do on symlink + OnSymlink func(src string) SymlinkAction + + // OnDirExists can specify what to do when there is a directory already existing in destination. + OnDirExists func(src, dest string) DirExistsAction + + // Skip can specify which files should be skipped + Skip func(src string) (bool, error) + + // AddPermission to every entities, + // NO MORE THAN 0777 + AddPermission os.FileMode + + // Sync file after copy. + // Useful in case when file must be on the disk + // (in case crash happens, for example), + // at the expense of some performance penalty + Sync bool + + // Preserve the atime and the mtime of the entries + // On linux we can preserve only up to 1 millisecond accuracy + PreserveTimes bool + +} +``` + +```go +// For example... +opt := Options{ + Skip: func(src string) (bool, error) { + return strings.HasSuffix(src, ".git"), nil + }, +} +err := Copy("your/directory", "your/directory.copy", opt) +``` + +# Issues + +- https://github.com/otiai10/copy/issues diff --git a/vendor/github.com/otiai10/copy/copy.go b/vendor/github.com/otiai10/copy/copy.go index 52afac4838..77bf9f93a9 100644 --- a/vendor/github.com/otiai10/copy/copy.go +++ b/vendor/github.com/otiai10/copy/copy.go @@ -5,6 +5,7 @@ import ( "io/ioutil" "os" "path/filepath" + "time" ) const ( @@ -14,93 +15,214 @@ const ( tmpPermissionForDirectory = os.FileMode(0755) ) -// Copy copies src to dest, doesn't matter if src is a directory or a file -func Copy(src, dest string) error { +type timespec struct { + Mtime time.Time + Atime time.Time + Ctime time.Time +} + +// Copy copies src to dest, doesn't matter if src is a directory or a file. +func Copy(src, dest string, opt ...Options) error { info, err := os.Lstat(src) if err != nil { return err } - return copy(src, dest, info) + return switchboard(src, dest, info, assure(src, dest, opt...)) } -// copy dispatches copy-funcs according to the mode. +// switchboard switches proper copy functions regarding file type, etc... +// If there would be anything else here, add a case to this switchboard. +func switchboard(src, dest string, info os.FileInfo, opt Options) (err error) { + switch { + case info.Mode()&os.ModeSymlink != 0: + err = onsymlink(src, dest, info, opt) + case info.IsDir(): + err = dcopy(src, dest, info, opt) + case info.Mode()&os.ModeNamedPipe != 0: + err = pcopy(dest, info) + default: + err = fcopy(src, dest, info, opt) + } + + return err +} + +// copyNextOrSkip decide if this src should be copied or not. // Because this "copy" could be called recursively, // "info" MUST be given here, NOT nil. -func copy(src, dest string, info os.FileInfo) error { - if info.Mode()&os.ModeSymlink != 0 { - return lcopy(src, dest, info) +func copyNextOrSkip(src, dest string, info os.FileInfo, opt Options) error { + skip, err := opt.Skip(src) + if err != nil { + return err } - if info.IsDir() { - return dcopy(src, dest, info) + if skip { + return nil } - return fcopy(src, dest, info) + return switchboard(src, dest, info, opt) } // fcopy is for just a file, // with considering existence of parent directory // and file permission. -func fcopy(src, dest string, info os.FileInfo) error { +func fcopy(src, dest string, info os.FileInfo, opt Options) (err error) { - if err := os.MkdirAll(filepath.Dir(dest), os.ModePerm); err != nil { - return err + if err = os.MkdirAll(filepath.Dir(dest), os.ModePerm); err != nil { + return } f, err := os.Create(dest) if err != nil { - return err + return } - defer f.Close() + defer fclose(f, &err) - if err = os.Chmod(f.Name(), info.Mode()); err != nil { - return err + if err = os.Chmod(f.Name(), info.Mode()|opt.AddPermission); err != nil { + return } s, err := os.Open(src) if err != nil { + return + } + defer fclose(s, &err) + + var buf []byte = nil + var w io.Writer = f + // var r io.Reader = s + if opt.CopyBufferSize != 0 { + buf = make([]byte, opt.CopyBufferSize) + // Disable using `ReadFrom` by io.CopyBuffer. + // See https://github.com/otiai10/copy/pull/60#discussion_r627320811 for more details. + w = struct{ io.Writer }{f} + // r = struct{ io.Reader }{s} + } + if _, err = io.CopyBuffer(w, s, buf); err != nil { return err } - defer s.Close() - _, err = io.Copy(f, s) - return err + if opt.Sync { + err = f.Sync() + } + + if opt.PreserveTimes { + return preserveTimes(info, dest) + } + + return } // dcopy is for a directory, // with scanning contents inside the directory // and pass everything to "copy" recursively. -func dcopy(srcdir, destdir string, info os.FileInfo) error { +func dcopy(srcdir, destdir string, info os.FileInfo, opt Options) (err error) { + + _, err = os.Stat(destdir) + if err == nil && opt.OnDirExists != nil && destdir != opt.intent.dest { + switch opt.OnDirExists(srcdir, destdir) { + case Replace: + if err := os.RemoveAll(destdir); err != nil { + return err + } + case Untouchable: + return nil + } // case "Merge" is default behaviour. Go through. + } else if err != nil && !os.IsNotExist(err) { + return err // Unwelcome error type...! + } originalMode := info.Mode() // Make dest dir with 0755 so that everything writable. - if err := os.MkdirAll(destdir, tmpPermissionForDirectory); err != nil { - return err + if err = os.MkdirAll(destdir, tmpPermissionForDirectory); err != nil { + return } // Recover dir mode with original one. - defer os.Chmod(destdir, originalMode) + defer chmod(destdir, originalMode|opt.AddPermission, &err) contents, err := ioutil.ReadDir(srcdir) if err != nil { - return err + return } for _, content := range contents { cs, cd := filepath.Join(srcdir, content.Name()), filepath.Join(destdir, content.Name()) - if err := copy(cs, cd, content); err != nil { + + if err = copyNextOrSkip(cs, cd, content, opt); err != nil { // If any error, exit immediately - return err + return } } - return nil + if opt.PreserveTimes { + return preserveTimes(info, destdir) + } + + return +} + +func onsymlink(src, dest string, info os.FileInfo, opt Options) error { + switch opt.OnSymlink(src) { + case Shallow: + return lcopy(src, dest) + case Deep: + orig, err := os.Readlink(src) + if err != nil { + return err + } + info, err = os.Lstat(orig) + if err != nil { + return err + } + return copyNextOrSkip(orig, dest, info, opt) + case Skip: + fallthrough + default: + return nil // do nothing + } } // lcopy is for a symlink, // with just creating a new symlink by replicating src symlink. -func lcopy(src, dest string, info os.FileInfo) error { +func lcopy(src, dest string) error { src, err := os.Readlink(src) if err != nil { return err } return os.Symlink(src, dest) } + +// fclose ANYHOW closes file, +// with asiging error raised during Close, +// BUT respecting the error already reported. +func fclose(f *os.File, reported *error) { + if err := f.Close(); *reported == nil { + *reported = err + } +} + +// chmod ANYHOW changes file mode, +// with asiging error raised during Chmod, +// BUT respecting the error already reported. +func chmod(dir string, mode os.FileMode, reported *error) { + if err := os.Chmod(dir, mode); *reported == nil { + *reported = err + } +} + +// assure Options struct, should be called only once. +// All optional values MUST NOT BE nil/zero after assured. +func assure(src, dest string, opts ...Options) Options { + defopt := getDefaultOptions(src, dest) + if len(opts) == 0 { + return defopt + } + if opts[0].OnSymlink == nil { + opts[0].OnSymlink = defopt.OnSymlink + } + if opts[0].Skip == nil { + opts[0].Skip = defopt.Skip + } + opts[0].intent.src = defopt.intent.src + opts[0].intent.dest = defopt.intent.dest + return opts[0] +} diff --git a/vendor/github.com/otiai10/copy/copy_namedpipes.go b/vendor/github.com/otiai10/copy/copy_namedpipes.go new file mode 100644 index 0000000000..dff1731221 --- /dev/null +++ b/vendor/github.com/otiai10/copy/copy_namedpipes.go @@ -0,0 +1,17 @@ +// +build !windows + +package copy + +import ( + "os" + "path/filepath" + "syscall" +) + +// pcopy is for just named pipes +func pcopy(dest string, info os.FileInfo) error { + if err := os.MkdirAll(filepath.Dir(dest), os.ModePerm); err != nil { + return err + } + return syscall.Mkfifo(dest, uint32(info.Mode())) +} diff --git a/vendor/github.com/otiai10/copy/copy_namedpipes_windows.go b/vendor/github.com/otiai10/copy/copy_namedpipes_windows.go new file mode 100644 index 0000000000..db30b783e7 --- /dev/null +++ b/vendor/github.com/otiai10/copy/copy_namedpipes_windows.go @@ -0,0 +1,12 @@ +// +build windows + +package copy + +import ( + "os" +) + +// pcopy is for just named pipes. Windows doesn't support them +func pcopy(dest string, info os.FileInfo) error { + return nil +} diff --git a/vendor/github.com/otiai10/copy/go.mod b/vendor/github.com/otiai10/copy/go.mod index b560f3247a..e985ebede2 100644 --- a/vendor/github.com/otiai10/copy/go.mod +++ b/vendor/github.com/otiai10/copy/go.mod @@ -1,5 +1,5 @@ module github.com/otiai10/copy -go 1.12 +go 1.14 -require github.com/otiai10/mint v1.3.0 +require github.com/otiai10/mint v1.3.2 diff --git a/vendor/github.com/otiai10/copy/go.sum b/vendor/github.com/otiai10/copy/go.sum index f349490381..6d78681acc 100644 --- a/vendor/github.com/otiai10/copy/go.sum +++ b/vendor/github.com/otiai10/copy/go.sum @@ -1,3 +1,6 @@ github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= -github.com/otiai10/mint v1.3.0 h1:Ady6MKVezQwHBkGzLFbrsywyp09Ah7rkmfjV3Bcr5uc= +github.com/otiai10/curr v1.0.0 h1:TJIWdbX0B+kpNagQrjgq8bCMrbhiuX73M2XwgtDMoOI= +github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= +github.com/otiai10/mint v1.3.2 h1:VYWnrP5fXmz1MXvjuUvcBrXSjGE6xjON+axB/UrpO3E= +github.com/otiai10/mint v1.3.2/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= diff --git a/vendor/github.com/otiai10/copy/options.go b/vendor/github.com/otiai10/copy/options.go new file mode 100644 index 0000000000..18e87ac8e4 --- /dev/null +++ b/vendor/github.com/otiai10/copy/options.go @@ -0,0 +1,86 @@ +package copy + +import "os" + +// Options specifies optional actions on copying. +type Options struct { + + // OnSymlink can specify what to do on symlink + OnSymlink func(src string) SymlinkAction + + // OnDirExists can specify what to do when there is a directory already existing in destination. + OnDirExists func(src, dest string) DirExistsAction + + // Skip can specify which files should be skipped + Skip func(src string) (bool, error) + + // AddPermission to every entities, + // NO MORE THAN 0777 + AddPermission os.FileMode + + // Sync file after copy. + // Useful in case when file must be on the disk + // (in case crash happens, for example), + // at the expense of some performance penalty + Sync bool + + // Preserve the atime and the mtime of the entries. + // On linux we can preserve only up to 1 millisecond accuracy. + PreserveTimes bool + + // The byte size of the buffer to use for copying files. + // If zero, the internal default buffer of 32KB is used. + // See https://golang.org/pkg/io/#CopyBuffer for more information. + CopyBufferSize uint + + intent struct { + src string + dest string + } +} + +// SymlinkAction represents what to do on symlink. +type SymlinkAction int + +const ( + // Deep creates hard-copy of contents. + Deep SymlinkAction = iota + // Shallow creates new symlink to the dest of symlink. + Shallow + // Skip does nothing with symlink. + Skip +) + +// DirExistsAction represents what to do on dest dir. +type DirExistsAction int + +const ( + // Merge preserves or overwrites existing files under the dir (default behavior). + Merge DirExistsAction = iota + // Replace deletes all contents under the dir and copy src files. + Replace + // Untouchable does nothing for the dir, and leaves it as it is. + Untouchable +) + +// getDefaultOptions provides default options, +// which would be modified by usage-side. +func getDefaultOptions(src, dest string) Options { + return Options{ + OnSymlink: func(string) SymlinkAction { + return Shallow // Do shallow copy + }, + OnDirExists: nil, // Default behavior is "Merge". + Skip: func(string) (bool, error) { + return false, nil // Don't skip + }, + AddPermission: 0, // Add nothing + Sync: false, // Do not sync + PreserveTimes: false, // Do not preserve the modification time + CopyBufferSize: 0, // Do not specify, use default bufsize (32*1024) + intent: struct { + src string + dest string + }{src, dest}, + } +} diff --git a/vendor/github.com/otiai10/copy/preserve_times.go b/vendor/github.com/otiai10/copy/preserve_times.go new file mode 100644 index 0000000000..d89b128980 --- /dev/null +++ b/vendor/github.com/otiai10/copy/preserve_times.go @@ -0,0 +1,11 @@ +package copy + +import "os" + +func preserveTimes(srcinfo os.FileInfo, dest string) error { + spec := getTimeSpec(srcinfo) + if err := os.Chtimes(dest, spec.Atime, spec.Mtime); err != nil { + return err + } + return nil +} diff --git a/vendor/github.com/otiai10/copy/stat_times.go b/vendor/github.com/otiai10/copy/stat_times.go new file mode 100644 index 0000000000..7d8ac6b980 --- /dev/null +++ b/vendor/github.com/otiai10/copy/stat_times.go @@ -0,0 +1,21 @@ +// +build !windows,!darwin,!freebsd + +// TODO: add more runtimes + +package copy + +import ( + "os" + "syscall" + "time" +) + +func getTimeSpec(info os.FileInfo) timespec { + stat := info.Sys().(*syscall.Stat_t) + times := timespec{ + Mtime: info.ModTime(), + Atime: time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)), + Ctime: time.Unix(int64(stat.Ctim.Sec), int64(stat.Ctim.Nsec)), + } + return times +} diff --git a/vendor/github.com/otiai10/copy/stat_times_darwin.go b/vendor/github.com/otiai10/copy/stat_times_darwin.go new file mode 100644 index 0000000000..ce7a7fbc7f --- /dev/null +++ b/vendor/github.com/otiai10/copy/stat_times_darwin.go @@ -0,0 +1,19 @@ +// +build darwin + +package copy + +import ( + "os" + "syscall" + "time" +) + +func getTimeSpec(info os.FileInfo) timespec { + stat := info.Sys().(*syscall.Stat_t) + times := timespec{ + Mtime: info.ModTime(), + Atime: time.Unix(stat.Atimespec.Sec, stat.Atimespec.Nsec), + Ctime: time.Unix(stat.Ctimespec.Sec, stat.Ctimespec.Nsec), + } + return times +} diff --git a/vendor/github.com/otiai10/copy/stat_times_freebsd.go b/vendor/github.com/otiai10/copy/stat_times_freebsd.go new file mode 100644 index 0000000000..115f1388b4 --- /dev/null +++ b/vendor/github.com/otiai10/copy/stat_times_freebsd.go @@ -0,0 +1,19 @@ +// +build freebsd + +package copy + +import ( + "os" + "syscall" + "time" +) + +func getTimeSpec(info os.FileInfo) timespec { + stat := info.Sys().(*syscall.Stat_t) + times := timespec{ + Mtime: info.ModTime(), + Atime: time.Unix(int64(stat.Atimespec.Sec), int64(stat.Atimespec.Nsec)), + Ctime: time.Unix(int64(stat.Ctimespec.Sec), int64(stat.Ctimespec.Nsec)), + } + return times +} diff --git a/vendor/github.com/otiai10/copy/stat_times_windows.go b/vendor/github.com/otiai10/copy/stat_times_windows.go new file mode 100644 index 0000000000..113a2ece58 --- /dev/null +++ b/vendor/github.com/otiai10/copy/stat_times_windows.go @@ -0,0 +1,18 @@ +// +build windows + +package copy + +import ( + "os" + "syscall" + "time" +) + +func getTimeSpec(info os.FileInfo) timespec { + stat := info.Sys().(*syscall.Win32FileAttributeData) + return timespec{ + Mtime: time.Unix(0, stat.LastWriteTime.Nanoseconds()), + Atime: time.Unix(0, stat.LastAccessTime.Nanoseconds()), + Ctime: time.Unix(0, stat.CreationTime.Nanoseconds()), + } +} diff --git a/vendor/github.com/otiai10/copy/test_setup.go b/vendor/github.com/otiai10/copy/test_setup.go new file mode 100644 index 0000000000..9eb5b2c61f --- /dev/null +++ b/vendor/github.com/otiai10/copy/test_setup.go @@ -0,0 +1,17 @@ +// +build !windows + +package copy + +import ( + "os" + "syscall" + "testing" +) + +func setup(m *testing.M) { + os.MkdirAll("test/data.copy", os.ModePerm) + os.Symlink("test/data/case01", "test/data/case03/case01") + os.Chmod("test/data/case07/dir_0555", 0555) + os.Chmod("test/data/case07/file_0444", 0444) + syscall.Mkfifo("test/data/case11/foo/bar", 0555) +} diff --git a/vendor/github.com/otiai10/copy/test_setup_windows.go b/vendor/github.com/otiai10/copy/test_setup_windows.go new file mode 100644 index 0000000000..55099fa931 --- /dev/null +++ b/vendor/github.com/otiai10/copy/test_setup_windows.go @@ -0,0 +1,15 @@ +// +build windows + +package copy + +import ( + "os" + "testing" +) + +func setup(m *testing.M) { + os.MkdirAll("test/data.copy", os.ModePerm) + os.Symlink("test/data/case01", "test/data/case03/case01") + os.Chmod("test/data/case07/dir_0555", 0555) + os.Chmod("test/data/case07/file_0444", 0444) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 33ea7d0764..adc9f8fcdf 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -469,7 +469,7 @@ github.com/opencontainers/selinux/go-selinux/label github.com/opentracing/opentracing-go github.com/opentracing/opentracing-go/ext github.com/opentracing/opentracing-go/log -# github.com/otiai10/copy v1.0.2 +# github.com/otiai10/copy v1.6.0 ## explicit github.com/otiai10/copy # github.com/pkg/errors v0.9.1