When a file changes, emit events for the seen parent
directories to ensure that those parents are included
in change streams such as archives. The parents are
needed accurately recreate diff representation apart
from a parent (such as overlay and aufs graph drivers
in Docker).
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Implements btrfs usage using a double walking diff and
counting the result. Walking gives the most accurate
count and includes inode usage.
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Previously, `Changes()` for a symlink to absolute path, with second-precision
mtime of the link itself always resulted in ENOENT.
This is because `compareFileContent()` was called for the link target path, without changing the root path.
Fixmoby/buildkit#172
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Adds tests for verifying parent directory permissions.
Currently an issue exists in extracting into some Docker graph
drivers. Supporting these graph drivers may require changes to
the diff logic, these tests clarify the existing behavior and
that extraction within containerd works.
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Call chmod on all open files and created directories to
ensure permission is set as expected without changing umask.
Fixes#1608
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Corrects compile on FreeBSD by handling the lack of ENODATA on FreeBSD.
Since continuity project has already handled this, using their const is
simpler than separating a few extra files in containerd/containerd.
Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
Use the CopyFileRange and Lsetxattr from golang.org/x/sys/unix instead
of their counterparts from github.com/containerd/continuity/sysx. These
are 1:1 replacements (except for the fd parameter types in
CopyFileRange).
This will eventually allow to remove these functions there as well.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
The syscall package is locked down and the comment in [1] advises to
switch code to use the corresponding package from golang.org/x/sys. Do
so and replace usage of package syscall with package
golang.org/x/sys/{unix,windows} where applicable.
[1] https://github.com/golang/go/blob/master/src/syscall/syscall.go#L21-L24
This will also allow to get updates and fixes for syscall wrappers
without having to use a new go version.
Errno, Signal and SysProcAttr aren't changed as they haven't been
implemented in x/sys/. Stat_t from syscall is used if standard library
packages (e.g. os) require it. syscall.ENOTSUP, syscall.SIGKILL and
syscall.SIGTERM are used for cross-platform files.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
This moves the RootPath function out of the archive package and into the
fs package for external use.
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
No need to have a util package under a package... er, package.
We should move most of this functionality to continuity.
Signed-off-by: Stephen J Day <stephen.day@docker.com>
Following symlinks does not look like it was intended behavior here,
and fails if the symlink target has not been copied yet.
Signed-off-by: Nick Santos <nicholas.j.santos@gmail.com>
This mainly fixes Linux vs generic Unix differences, with some
differences between Darwin and Freebsd (which are close bit not
identical). Should make fixing for other Unix platforms easier.
Note there are not yet `runc` equivalents for these platforms;
my current use case is image manipulation for the `moby` tool.
However there is interest in OCI runtime ports for both platforms.
Current status is that MacOS can build and run `ctr`, `dist`
and `containerd` and some operations are supported. FreeBSD 11
still needs some more fixes to continuity for extended attributes.
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
To allow the querying of usage for snapshots, we define a new method on
the snapshotter to query the resources in use by a single snapshot.
Conversely, it can be said that if the snapshot was deleted, the
reported amount of usage would be recovered.
There are few problems with this model in the implementation of btrfs
that need to be worked out. In btrfs, it is hard to resolve the amount
of data usage with the use of quotas but these may report valuables that
are incompatible with the model.
Signed-off-by: Stephen J Day <stephen.day@docker.com>
Previously hardlinking to an unmodified file or linking to a file
which was touched by not detected as modified caused a new file
to be created on unpack. This new file and the original source file
were not linked since no link record was created in the tar. This
change addresses this by adding links for all hardlinks to a file
when it is detected as changed. These links will be written after
the source file is written and may occur out of order in regard to
file name.
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Remove change type in favor of explicit change function.
Using change function makes it more difficult to unnecessarily
add to the change interface.
Update test apply functions to use an interface rather
than a function type.
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
The change computation will be done on the callers thread
and use callbacks rather than running a goroutine and
returning a channel.
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)