full diff: https://github.com/containerd/continuity/compare/f2a389ac0a02ce21c09edd7344677a601970f41c...26c1120b8d4107d2471b93ad78ef7ce1fc84c4c4
- containerd/continuity#109 Add OpenBSD support for fs subpackage
- containerd/continuity#141 Add src string to copyDirectory error message
- containerd/continuity#143 fstest: have CreateSocket actually create a socket
- containerd/continuity#144 Support Go Modules
- containerd/continuity#147 xattr lost when copying directory
- containerd/continuity#148 fs: don't convert syscall.Timespec to unix.Timespec directly (doesn't work with gccgo)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -119,7 +119,7 @@ google.golang.org/genproto 694d95ba50e67b2e363f3483057d |
| 119 | 119 |
# containerd |
| 120 | 120 |
github.com/containerd/containerd acdcf13d5eaf0dfe0eaeabe7194a82535549bc2b |
| 121 | 121 |
github.com/containerd/fifo bda0ff6ed73c67bfb5e62bc9c697f146b7fd7f13 |
| 122 |
-github.com/containerd/continuity f2a389ac0a02ce21c09edd7344677a601970f41c |
|
| 122 |
+github.com/containerd/continuity 26c1120b8d4107d2471b93ad78ef7ce1fc84c4c4 |
|
| 123 | 123 |
github.com/containerd/cgroups 5fbad35c2a7e855762d3c60f2e474ffcad0d470a |
| 124 | 124 |
github.com/containerd/console 0650fd9eeb50bab4fc99dceb9f2e14cf58f36e7f |
| 125 | 125 |
github.com/containerd/go-runc a2952bc25f5116103a8b78f3817f6df759aa7def |
| ... | ... |
@@ -80,7 +80,7 @@ func copyDirectory(dst, src string, inodes map[uint64]string, o *copyDirOpts) er |
| 80 | 80 |
return errors.Wrapf(err, "failed to stat %s", src) |
| 81 | 81 |
} |
| 82 | 82 |
if !stat.IsDir() {
|
| 83 |
- return errors.Errorf("source is not directory")
|
|
| 83 |
+ return errors.Errorf("source %s is not directory", src)
|
|
| 84 | 84 |
} |
| 85 | 85 |
|
| 86 | 86 |
if st, err := os.Stat(dst); err != nil {
|
| ... | ... |
@@ -104,6 +104,10 @@ func copyDirectory(dst, src string, inodes map[uint64]string, o *copyDirOpts) er |
| 104 | 104 |
return errors.Wrapf(err, "failed to copy file info for %s", dst) |
| 105 | 105 |
} |
| 106 | 106 |
|
| 107 |
+ if err := copyXAttrs(dst, src, o.xeh); err != nil {
|
|
| 108 |
+ return errors.Wrap(err, "failed to copy xattrs") |
|
| 109 |
+ } |
|
| 110 |
+ |
|
| 107 | 111 |
for _, fi := range fis {
|
| 108 | 112 |
source := filepath.Join(src, fi.Name()) |
| 109 | 113 |
target := filepath.Join(dst, fi.Name()) |
| ... | ... |
@@ -51,7 +51,10 @@ func copyFileInfo(fi os.FileInfo, name string) error {
|
| 51 | 51 |
} |
| 52 | 52 |
} |
| 53 | 53 |
|
| 54 |
- timespec := []unix.Timespec{unix.Timespec(StatAtime(st)), unix.Timespec(StatMtime(st))}
|
|
| 54 |
+ timespec := []unix.Timespec{
|
|
| 55 |
+ unix.NsecToTimespec(syscall.TimespecToNsec(StatAtime(st))), |
|
| 56 |
+ unix.NsecToTimespec(syscall.TimespecToNsec(StatMtime(st))), |
|
| 57 |
+ } |
|
| 55 | 58 |
if err := unix.UtimesNanoAt(unix.AT_FDCWD, name, timespec, unix.AT_SYMLINK_NOFOLLOW); err != nil {
|
| 56 | 59 |
return errors.Wrapf(err, "failed to utime %s", name) |
| 57 | 60 |
} |
| 5 | 5 |
deleted file mode 100644 |
| ... | ... |
@@ -1,44 +0,0 @@ |
| 1 |
-// +build darwin freebsd |
|
| 2 |
- |
|
| 3 |
-/* |
|
| 4 |
- Copyright The containerd Authors. |
|
| 5 |
- |
|
| 6 |
- Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 7 |
- you may not use this file except in compliance with the License. |
|
| 8 |
- You may obtain a copy of the License at |
|
| 9 |
- |
|
| 10 |
- http://www.apache.org/licenses/LICENSE-2.0 |
|
| 11 |
- |
|
| 12 |
- Unless required by applicable law or agreed to in writing, software |
|
| 13 |
- distributed under the License is distributed on an "AS IS" BASIS, |
|
| 14 |
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 15 |
- See the License for the specific language governing permissions and |
|
| 16 |
- limitations under the License. |
|
| 17 |
-*/ |
|
| 18 |
- |
|
| 19 |
-package fs |
|
| 20 |
- |
|
| 21 |
-import ( |
|
| 22 |
- "syscall" |
|
| 23 |
- "time" |
|
| 24 |
-) |
|
| 25 |
- |
|
| 26 |
-// StatAtime returns the access time from a stat struct |
|
| 27 |
-func StatAtime(st *syscall.Stat_t) syscall.Timespec {
|
|
| 28 |
- return st.Atimespec |
|
| 29 |
-} |
|
| 30 |
- |
|
| 31 |
-// StatCtime returns the created time from a stat struct |
|
| 32 |
-func StatCtime(st *syscall.Stat_t) syscall.Timespec {
|
|
| 33 |
- return st.Ctimespec |
|
| 34 |
-} |
|
| 35 |
- |
|
| 36 |
-// StatMtime returns the modified time from a stat struct |
|
| 37 |
-func StatMtime(st *syscall.Stat_t) syscall.Timespec {
|
|
| 38 |
- return st.Mtimespec |
|
| 39 |
-} |
|
| 40 |
- |
|
| 41 |
-// StatATimeAsTime returns the access time as a time.Time |
|
| 42 |
-func StatATimeAsTime(st *syscall.Stat_t) time.Time {
|
|
| 43 |
- return time.Unix(int64(st.Atimespec.Sec), int64(st.Atimespec.Nsec)) // nolint: unconvert |
|
| 44 |
-} |
| 45 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,44 @@ |
| 0 |
+// +build darwin freebsd |
|
| 1 |
+ |
|
| 2 |
+/* |
|
| 3 |
+ Copyright The containerd Authors. |
|
| 4 |
+ |
|
| 5 |
+ Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 6 |
+ you may not use this file except in compliance with the License. |
|
| 7 |
+ You may obtain a copy of the License at |
|
| 8 |
+ |
|
| 9 |
+ http://www.apache.org/licenses/LICENSE-2.0 |
|
| 10 |
+ |
|
| 11 |
+ Unless required by applicable law or agreed to in writing, software |
|
| 12 |
+ distributed under the License is distributed on an "AS IS" BASIS, |
|
| 13 |
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 14 |
+ See the License for the specific language governing permissions and |
|
| 15 |
+ limitations under the License. |
|
| 16 |
+*/ |
|
| 17 |
+ |
|
| 18 |
+package fs |
|
| 19 |
+ |
|
| 20 |
+import ( |
|
| 21 |
+ "syscall" |
|
| 22 |
+ "time" |
|
| 23 |
+) |
|
| 24 |
+ |
|
| 25 |
+// StatAtime returns the access time from a stat struct |
|
| 26 |
+func StatAtime(st *syscall.Stat_t) syscall.Timespec {
|
|
| 27 |
+ return st.Atimespec |
|
| 28 |
+} |
|
| 29 |
+ |
|
| 30 |
+// StatCtime returns the created time from a stat struct |
|
| 31 |
+func StatCtime(st *syscall.Stat_t) syscall.Timespec {
|
|
| 32 |
+ return st.Ctimespec |
|
| 33 |
+} |
|
| 34 |
+ |
|
| 35 |
+// StatMtime returns the modified time from a stat struct |
|
| 36 |
+func StatMtime(st *syscall.Stat_t) syscall.Timespec {
|
|
| 37 |
+ return st.Mtimespec |
|
| 38 |
+} |
|
| 39 |
+ |
|
| 40 |
+// StatATimeAsTime returns the access time as a time.Time |
|
| 41 |
+func StatATimeAsTime(st *syscall.Stat_t) time.Time {
|
|
| 42 |
+ return time.Unix(int64(st.Atimespec.Sec), int64(st.Atimespec.Nsec)) // nolint: unconvert |
|
| 43 |
+} |
| 0 | 44 |
deleted file mode 100644 |
| ... | ... |
@@ -1,43 +0,0 @@ |
| 1 |
-/* |
|
| 2 |
- Copyright The containerd Authors. |
|
| 3 |
- |
|
| 4 |
- Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 |
- you may not use this file except in compliance with the License. |
|
| 6 |
- You may obtain a copy of the License at |
|
| 7 |
- |
|
| 8 |
- http://www.apache.org/licenses/LICENSE-2.0 |
|
| 9 |
- |
|
| 10 |
- Unless required by applicable law or agreed to in writing, software |
|
| 11 |
- distributed under the License is distributed on an "AS IS" BASIS, |
|
| 12 |
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 13 |
- See the License for the specific language governing permissions and |
|
| 14 |
- limitations under the License. |
|
| 15 |
-*/ |
|
| 16 |
- |
|
| 17 |
-package fs |
|
| 18 |
- |
|
| 19 |
-import ( |
|
| 20 |
- "syscall" |
|
| 21 |
- "time" |
|
| 22 |
-) |
|
| 23 |
- |
|
| 24 |
-// StatAtime returns the Atim |
|
| 25 |
-func StatAtime(st *syscall.Stat_t) syscall.Timespec {
|
|
| 26 |
- return st.Atim |
|
| 27 |
-} |
|
| 28 |
- |
|
| 29 |
-// StatCtime returns the Ctim |
|
| 30 |
-func StatCtime(st *syscall.Stat_t) syscall.Timespec {
|
|
| 31 |
- return st.Ctim |
|
| 32 |
-} |
|
| 33 |
- |
|
| 34 |
-// StatMtime returns the Mtim |
|
| 35 |
-func StatMtime(st *syscall.Stat_t) syscall.Timespec {
|
|
| 36 |
- return st.Mtim |
|
| 37 |
-} |
|
| 38 |
- |
|
| 39 |
-// StatATimeAsTime returns st.Atim as a time.Time |
|
| 40 |
-func StatATimeAsTime(st *syscall.Stat_t) time.Time {
|
|
| 41 |
- // The int64 conversions ensure the line compiles for 32-bit systems as well. |
|
| 42 |
- return time.Unix(int64(st.Atim.Sec), int64(st.Atim.Nsec)) // nolint: unconvert |
|
| 43 |
-} |
| 44 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,45 @@ |
| 0 |
+// +build linux openbsd |
|
| 1 |
+ |
|
| 2 |
+/* |
|
| 3 |
+ Copyright The containerd Authors. |
|
| 4 |
+ |
|
| 5 |
+ Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 6 |
+ you may not use this file except in compliance with the License. |
|
| 7 |
+ You may obtain a copy of the License at |
|
| 8 |
+ |
|
| 9 |
+ http://www.apache.org/licenses/LICENSE-2.0 |
|
| 10 |
+ |
|
| 11 |
+ Unless required by applicable law or agreed to in writing, software |
|
| 12 |
+ distributed under the License is distributed on an "AS IS" BASIS, |
|
| 13 |
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 14 |
+ See the License for the specific language governing permissions and |
|
| 15 |
+ limitations under the License. |
|
| 16 |
+*/ |
|
| 17 |
+ |
|
| 18 |
+package fs |
|
| 19 |
+ |
|
| 20 |
+import ( |
|
| 21 |
+ "syscall" |
|
| 22 |
+ "time" |
|
| 23 |
+) |
|
| 24 |
+ |
|
| 25 |
+// StatAtime returns the Atim |
|
| 26 |
+func StatAtime(st *syscall.Stat_t) syscall.Timespec {
|
|
| 27 |
+ return st.Atim |
|
| 28 |
+} |
|
| 29 |
+ |
|
| 30 |
+// StatCtime returns the Ctim |
|
| 31 |
+func StatCtime(st *syscall.Stat_t) syscall.Timespec {
|
|
| 32 |
+ return st.Ctim |
|
| 33 |
+} |
|
| 34 |
+ |
|
| 35 |
+// StatMtime returns the Mtim |
|
| 36 |
+func StatMtime(st *syscall.Stat_t) syscall.Timespec {
|
|
| 37 |
+ return st.Mtim |
|
| 38 |
+} |
|
| 39 |
+ |
|
| 40 |
+// StatATimeAsTime returns st.Atim as a time.Time |
|
| 41 |
+func StatATimeAsTime(st *syscall.Stat_t) time.Time {
|
|
| 42 |
+ // The int64 conversions ensure the line compiles for 32-bit systems as well. |
|
| 43 |
+ return time.Unix(int64(st.Atim.Sec), int64(st.Atim.Nsec)) // nolint: unconvert |
|
| 44 |
+} |
| 0 | 45 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,23 @@ |
| 0 |
+module github.com/containerd/continuity |
|
| 1 |
+ |
|
| 2 |
+go 1.11 |
|
| 3 |
+ |
|
| 4 |
+require ( |
|
| 5 |
+ bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898 |
|
| 6 |
+ github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4 |
|
| 7 |
+ github.com/golang/protobuf v1.2.0 |
|
| 8 |
+ github.com/inconshreveable/mousetrap v1.0.0 // indirect |
|
| 9 |
+ github.com/onsi/ginkgo v1.10.1 // indirect |
|
| 10 |
+ github.com/onsi/gomega v1.7.0 // indirect |
|
| 11 |
+ github.com/opencontainers/go-digest v1.0.0-rc1 |
|
| 12 |
+ github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7 |
|
| 13 |
+ github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2 |
|
| 14 |
+ github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee |
|
| 15 |
+ github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95 // indirect |
|
| 16 |
+ github.com/stretchr/testify v1.4.0 // indirect |
|
| 17 |
+ golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3 // indirect |
|
| 18 |
+ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f |
|
| 19 |
+ golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e |
|
| 20 |
+ gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect |
|
| 21 |
+ gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect |
|
| 22 |
+) |
| 5 | 5 |
deleted file mode 100644 |
| ... | ... |
@@ -1,13 +0,0 @@ |
| 1 |
-bazil.org/fuse 371fbbdaa8987b715bdd21d6adc4c9b20155f748 |
|
| 2 |
-github.com/dustin/go-humanize bb3d318650d48840a39aa21a027c6630e198e626 |
|
| 3 |
-github.com/golang/protobuf 1e59b77b52bf8e4b449a57e6f79f21226d571845 |
|
| 4 |
-github.com/inconshreveable/mousetrap 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 |
|
| 5 |
-github.com/opencontainers/go-digest 279bed98673dd5bef374d3b6e4b09e2af76183bf |
|
| 6 |
-github.com/pkg/errors f15c970de5b76fac0b59abb32d62c17cc7bed265 |
|
| 7 |
-github.com/sirupsen/logrus 89742aefa4b206dcf400792f3bd35b542998eb3b |
|
| 8 |
-github.com/spf13/cobra 2da4a54c5ceefcee7ca5dd0eea1e18a3b6366489 |
|
| 9 |
-github.com/spf13/pflag 4c012f6dcd9546820e378d0bdda4d8fc772cdfea |
|
| 10 |
-golang.org/x/crypto 9f005a07e0d31d45e6656d241bb5c0f2efd4bc94 |
|
| 11 |
-golang.org/x/net a337091b0525af65de94df2eb7e98bd9962dcbe2 |
|
| 12 |
-golang.org/x/sync 450f422ab23cf9881c94e2db30cac0eb1b7cf80c |
|
| 13 |
-golang.org/x/sys 77b0e4315053a57ed2962443614bdb28db152054 |