The ApplyDiffWithDiffer function was marked as deprecated,
with PrepareStagedLayer being the recommended replacement.
Its implementation was just a wrapper around PrepareStagedLayer.
Remove the deprecated function from the Store and LayerStore
interfaces and its implementation.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Replace the direct call to unix.Open with the O_TMPFILE flag
with the dedicated openTmpFile helper function.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Replace the in-memory buffer with a O_TMPFILE file. This reduces the
memory requirements for a partial pull since the tar-split data can be
written to disk.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
When running as non-root, the code previously checked
if usePerUserStorage() before applying default paths
for RunRoot and GraphRoot if they were missing from
the configuration file. This check prevented defaults
from being applied if the STORAGE_DRIVER environment
variable was set.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This allows disinguishing between inherent fatal error (writing to the
tar archive failed, eg. disk full) and non-fatal error
(tarWithOptionsTo is racing with another process mutating the file
system.)
Signed-off-by: Han-Wen Nienhuys <hanwen@engflow.com>
This code was imported in commit f39066fe1b (Sep 7, 2017, "Update
packages to match latest code in moby/pkg") without any further comments.
The error check cannot trigger, because there is only whiteout
converter (overlayfs => AUFS), and that only acts on char devices and
directories.
Document in detail what is going on.
Signed-off-by: Han-Wen Nienhuys <hanwen@engflow.com>
Otherwise, if addFile errors out before writing the entry for a file
with hardlink, subsequent files with hardlinks would reference a file
that is not in the tar file.
Use hdr.Name (which is passed through CanonicalTarNameForPath) instead
of the 'name' parameter.
Signed-off-by: Han-Wen Nienhuys <hanwen@engflow.com>
> pkg/unshare/unshare_linux.go:471:64: directive `// nolint: revive,goprintffuncname` should be written without leading space as `//nolint: revive,goprintffuncname` (nolintlint)
> func bailOnError(err error, format string, a ...interface{}) { // nolint: revive,goprintffuncname
> ^
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
For struct Stat_t in syscall pkg:
- Ino is always uint64;
- Dev/Rdev can be uint64, uint32, or int32;
- Nlink might be uint64, uint32, or uint16.
Fix the code accordingly, adding or removing typecasts where needed,
and annotating those with //nolint:unconvert to calm down the unconvert
linter.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Those are the cases where the value being converted is already of that
type (checked to be that way for all os/arch combinations).
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
1. Move common code to atime() helper.
2. Use Atim.Unix to simplify conversion and avoid explicit typecasts.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>