detect when the read pipe got closed by using the Write error code.
It solves a race, where the pipe could be closed between the check and
the actual write.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Commit d85da31 enabled raw accounting which is not needed for the
purpose of the tarlogger. Disable the raw accounting to reduce the
memory footprint considerably (factor of 10 in some cases).
Fixes: #433
Inital-report: github.com/cri-o/cri-o/issues/2847
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Using `os.Pipe()` has a side effect when writing tar files surfacing in
differing digests (see [1] for reference). Instead use `io.Pipe()` with
a workaround to avoid writes after the reader has been closed - which is
supported by `os.Pipe()` and causes the tar package to error otherwise.
[1] https://github.com/containers/libpod/pull/3705#issuecomment-517954910
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Add a field to the Layer structure that lets us make note of the set of
UIDs and GIDs which own files in the layer, populated by scanning the
diff that we used to populate the layer, if there was one.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>