From 04bfa8e91f5a934079dd449d1a344bf731917a6b Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Tue, 17 Jun 2014 23:19:42 +0000 Subject: [PATCH 1/2] allow utimes on mac os, only lutimes isn't supported Docker-DCO-1.1-Signed-off-by: Victor Vieux (github: vieux) --- pkg/system/utimes_darwin.go | 11 +++++++++++ pkg/system/utimes_linux.go | 5 +---- pkg/system/utimes_unsupported.go | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 pkg/system/utimes_darwin.go diff --git a/pkg/system/utimes_darwin.go b/pkg/system/utimes_darwin.go new file mode 100644 index 0000000000..4c6002fe8e --- /dev/null +++ b/pkg/system/utimes_darwin.go @@ -0,0 +1,11 @@ +package system + +import "syscall" + +func LUtimesNano(path string, ts []syscall.Timespec) error { + return ErrNotSupportedPlatform +} + +func UtimesNano(path string, ts []syscall.Timespec) error { + return syscall.UtimesNano(path, ts) +} diff --git a/pkg/system/utimes_linux.go b/pkg/system/utimes_linux.go index c00f4026a5..8f90298271 100644 --- a/pkg/system/utimes_linux.go +++ b/pkg/system/utimes_linux.go @@ -24,8 +24,5 @@ func LUtimesNano(path string, ts []syscall.Timespec) error { } func UtimesNano(path string, ts []syscall.Timespec) error { - if err := syscall.UtimesNano(path, ts); err != nil { - return err - } - return nil + return syscall.UtimesNano(path, ts) } diff --git a/pkg/system/utimes_unsupported.go b/pkg/system/utimes_unsupported.go index 9a8cf9cd4a..adf2734f27 100644 --- a/pkg/system/utimes_unsupported.go +++ b/pkg/system/utimes_unsupported.go @@ -1,4 +1,4 @@ -// +build !linux,!freebsd +// +build !linux,!freebsd,!darwin package system From b132e7b36d30a116fa50eb5035c85cc895cc3d5b Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Wed, 18 Jun 2014 23:42:22 +0000 Subject: [PATCH 2/2] discard ErrNotSupportedPlatform Docker-DCO-1.1-Signed-off-by: Victor Vieux (github: vieux) --- archive/archive.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archive/archive.go b/archive/archive.go index 76c6e31289..1982218b46 100644 --- a/archive/archive.go +++ b/archive/archive.go @@ -262,11 +262,11 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader io.Reader, L ts := []syscall.Timespec{timeToTimespec(hdr.AccessTime), timeToTimespec(hdr.ModTime)} // syscall.UtimesNano doesn't support a NOFOLLOW flag atm, and if hdr.Typeflag != tar.TypeSymlink { - if err := system.UtimesNano(path, ts); err != nil { + if err := system.UtimesNano(path, ts); err != nil && err != system.ErrNotSupportedPlatform { return err } } else { - if err := system.LUtimesNano(path, ts); err != nil { + if err := system.LUtimesNano(path, ts); err != nil && err != system.ErrNotSupportedPlatform { return err } }