summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CODE-OF-CONDUCT.md2
-rw-r--r--SECURITY.md2
-rw-r--r--go.mod2
-rw-r--r--go.sum11
-rw-r--r--libpod/container.go10
-rw-r--r--libpod/container_internal.go3
-rw-r--r--libpod/container_internal_linux.go5
-rw-r--r--libpod/oci_conmon_linux.go6
-rw-r--r--pkg/machine/config.go2
-rw-r--r--pkg/machine/connection.go2
-rw-r--r--pkg/machine/fcos.go2
-rw-r--r--pkg/machine/ignition.go2
-rw-r--r--pkg/machine/ignition_schema.go2
-rw-r--r--pkg/machine/keys.go2
-rw-r--r--pkg/machine/libvirt/config.go2
-rw-r--r--pkg/machine/libvirt/machine.go2
-rw-r--r--pkg/machine/libvirt/machine_unsupported.go3
-rw-r--r--pkg/machine/machine_unsupported.go3
-rw-r--r--pkg/machine/pull.go2
-rw-r--r--pkg/machine/qemu/config.go2
-rw-r--r--pkg/machine/qemu/machine.go2
-rw-r--r--pkg/machine/qemu/machine_unsupported.go3
-rw-r--r--pkg/rootless/rootless_linux.c2
-rw-r--r--test/e2e/systemd_test.go7
-rwxr-xr-xtest/system/build-testimage65
-rw-r--r--test/system/helpers.bash9
-rw-r--r--vendor/github.com/containers/storage/VERSION2
-rw-r--r--vendor/github.com/containers/storage/drivers/overlay/overlay.go6
-rw-r--r--vendor/github.com/containers/storage/go.mod6
-rw-r--r--vendor/github.com/containers/storage/go.sum15
-rw-r--r--vendor/github.com/containers/storage/pkg/lockfile/lockfile_unix.go12
-rw-r--r--vendor/github.com/containers/storage/store.go7
-rw-r--r--vendor/github.com/containers/storage/types/default_override_test.conf11
-rw-r--r--vendor/github.com/containers/storage/types/utils.go9
-rw-r--r--vendor/github.com/klauspost/compress/zstd/blockdec.go34
-rw-r--r--vendor/github.com/klauspost/compress/zstd/blockenc.go52
-rw-r--r--vendor/github.com/klauspost/compress/zstd/bytebuf.go2
-rw-r--r--vendor/github.com/klauspost/compress/zstd/decoder.go53
-rw-r--r--vendor/github.com/klauspost/compress/zstd/dict.go2
-rw-r--r--vendor/github.com/klauspost/compress/zstd/enc_best.go6
-rw-r--r--vendor/github.com/klauspost/compress/zstd/enc_better.go16
-rw-r--r--vendor/github.com/klauspost/compress/zstd/enc_dfast.go18
-rw-r--r--vendor/github.com/klauspost/compress/zstd/enc_fast.go20
-rw-r--r--vendor/github.com/klauspost/compress/zstd/encoder.go16
-rw-r--r--vendor/github.com/klauspost/compress/zstd/framedec.go69
-rw-r--r--vendor/github.com/klauspost/compress/zstd/fse_encoder.go2
-rw-r--r--vendor/github.com/klauspost/compress/zstd/snappy.go4
-rw-r--r--vendor/github.com/klauspost/compress/zstd/zstd.go10
-rw-r--r--vendor/github.com/mattn/go-shellwords/shellwords.go2
-rw-r--r--vendor/modules.txt6
50 files changed, 326 insertions, 209 deletions
diff --git a/CODE-OF-CONDUCT.md b/CODE-OF-CONDUCT.md
index b23672b1a..e418693f7 100644
--- a/CODE-OF-CONDUCT.md
+++ b/CODE-OF-CONDUCT.md
@@ -1,3 +1,3 @@
## The Podman Project Community Code of Conduct
-The Podman project which includes Libpod, follows the [Containers Community Code of Conduct](https://github.com/containers/common/blob/master/CODE-OF-CONDUCT.md).
+The Podman project which includes Libpod, follows the [Containers Community Code of Conduct](https://github.com/containers/common/blob/main/CODE-OF-CONDUCT.md).
diff --git a/SECURITY.md b/SECURITY.md
index 03a192044..1f6d5088d 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -1,3 +1,3 @@
## Security and Disclosure Information Policy for the Libpod Project
-The Libpod Project follows the [Security and Disclosure Information Policy](https://github.com/containers/common/blob/master/SECURITY.md) for the Containers Projects.
+The Libpod Project follows the [Security and Disclosure Information Policy](https://github.com/containers/common/blob/main/SECURITY.md) for the Containers Projects.
diff --git a/go.mod b/go.mod
index 061577d92..40464b8fb 100644
--- a/go.mod
+++ b/go.mod
@@ -17,7 +17,7 @@ require (
github.com/containers/image/v5 v5.12.0
github.com/containers/ocicrypt v1.1.1
github.com/containers/psgo v1.5.2
- github.com/containers/storage v1.32.1
+ github.com/containers/storage v1.32.2
github.com/coreos/go-systemd/v22 v22.3.2
github.com/coreos/stream-metadata-go v0.0.0-20210225230131-70edb9eb47b3
github.com/cri-o/ocicni v0.2.1-0.20210301205850-541cf7c703cf
diff --git a/go.sum b/go.sum
index 73bf19bf6..73b4af472 100644
--- a/go.sum
+++ b/go.sum
@@ -239,8 +239,8 @@ github.com/containers/storage v1.23.5/go.mod h1:ha26Q6ngehFNhf3AWoXldvAvwI4jFe3E
github.com/containers/storage v1.30.1/go.mod h1:NDJkiwxnSHD1Is+4DGcyR3SIEYSDOa0xnAW+uGQFx9E=
github.com/containers/storage v1.31.1/go.mod h1:IFEf+yRTS0pvCGQt2tBv1Kzz2XUSPvED6uFBmWG7V/E=
github.com/containers/storage v1.32.0/go.mod h1:J3q772EVbN9vgqoN/dkvInKnp4xK9ZXm7wHNfuiIDgE=
-github.com/containers/storage v1.32.1 h1:JgvHY5dokiff+Ee4TdvPYO++Oq2BAave5DmyPetH2iU=
-github.com/containers/storage v1.32.1/go.mod h1:do6oIF71kfkVS3CPUZr+6He94fIaj6pzF8ywevPuuOw=
+github.com/containers/storage v1.32.2 h1:V1oKAKmH5e6OTgP7Uf8+T+ntVVYk2MNFnDDkPBI9kxU=
+github.com/containers/storage v1.32.2/go.mod h1:YIBxxjfXZTi04Ah49sh1uSGfmT1V89+I5i3deRobzQo=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
@@ -536,8 +536,8 @@ github.com/klauspost/compress v1.11.0/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs
github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
-github.com/klauspost/compress v1.12.3 h1:G5AfA94pHPysR56qqrkO2pxEexdDzrpFJ6yt/VqWxVU=
-github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
+github.com/klauspost/compress v1.13.0 h1:2T7tUoQrQT+fQWdaY5rjWztFGAFwbGD04iPJg90ZiOs=
+github.com/klauspost/compress v1.13.0/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
@@ -576,8 +576,9 @@ github.com/mattn/go-runewidth v0.0.12 h1:Y41i/hVW3Pgwr8gV+J23B9YEY0zxjptBuCWEaxm
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
github.com/mattn/go-shellwords v1.0.10/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
-github.com/mattn/go-shellwords v1.0.11 h1:vCoR9VPpsk/TZFW2JwK5I9S0xdrtUq2bph6/YjEPnaw=
github.com/mattn/go-shellwords v1.0.11/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
+github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk=
+github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI=
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
diff --git a/libpod/container.go b/libpod/container.go
index c6f0cd618..4b9bea5fc 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -957,6 +957,12 @@ func (c *Container) cGroupPath() (string, error) {
// is the libpod-specific one we're looking for.
//
// See #8397 on the need for the longest-path look up.
+ //
+ // And another workaround for containers running systemd as the payload.
+ // containers running systemd moves themselves into a child subgroup of
+ // the named systemd cgroup hierarchy. Ignore any named cgroups during
+ // the lookup.
+ // See #10602 for more details.
procPath := fmt.Sprintf("/proc/%d/cgroup", c.state.PID)
lines, err := ioutil.ReadFile(procPath)
if err != nil {
@@ -972,6 +978,10 @@ func (c *Container) cGroupPath() (string, error) {
logrus.Debugf("Error parsing cgroup: expected 3 fields but got %d: %s", len(fields), procPath)
continue
}
+ // Ignore named cgroups like name=systemd.
+ if bytes.Contains(fields[1], []byte("=")) {
+ continue
+ }
path := string(fields[2])
if len(path) > len(cgroupPath) {
cgroupPath = path
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index f77825efd..69ba4671e 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -42,6 +42,7 @@ const (
// name of the directory holding the artifacts
artifactsDir = "artifacts"
execDirPermission = 0755
+ preCheckpointDir = "pre-checkpoint"
)
// rootFsSize gets the size of the container's root filesystem
@@ -141,7 +142,7 @@ func (c *Container) CheckpointPath() string {
// PreCheckpointPath returns the path to the directory containing the pre-checkpoint-images
func (c *Container) PreCheckPointPath() string {
- return filepath.Join(c.bundlePath(), "pre-checkpoint")
+ return filepath.Join(c.bundlePath(), preCheckpointDir)
}
// AttachSocketPath retrieves the path of the container's attach socket
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 94bf7855b..ddfccb999 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -909,14 +909,15 @@ func (c *Container) exportCheckpoint(options ContainerCheckpointOptions) error {
includeFiles := []string{
"artifacts",
"ctr.log",
- metadata.CheckpointDirectory,
metadata.ConfigDumpFile,
metadata.SpecDumpFile,
metadata.NetworkStatusFile,
}
if options.PreCheckPoint {
- includeFiles[0] = "pre-checkpoint"
+ includeFiles = append(includeFiles, preCheckpointDir)
+ } else {
+ includeFiles = append(includeFiles, metadata.CheckpointDirectory)
}
// Get root file-system changes included in the checkpoint archive
var addToTarFiles []string
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go
index 3da49b85f..2914bd1a1 100644
--- a/libpod/oci_conmon_linux.go
+++ b/libpod/oci_conmon_linux.go
@@ -787,7 +787,11 @@ func (r *ConmonOCIRuntime) CheckpointContainer(ctr *Container, options Container
args = append(args, "--pre-dump")
}
if !options.PreCheckPoint && options.WithPrevious {
- args = append(args, "--parent-path", ctr.PreCheckPointPath())
+ args = append(
+ args,
+ "--parent-path",
+ filepath.Join("..", preCheckpointDir),
+ )
}
runtimeDir, err := util.GetRuntimeDir()
if err != nil {
diff --git a/pkg/machine/config.go b/pkg/machine/config.go
index 58794ce42..db9bfa7de 100644
--- a/pkg/machine/config.go
+++ b/pkg/machine/config.go
@@ -1,3 +1,5 @@
+// +build amd64,linux arm64,linux amd64,darwin arm64,darwin
+
package machine
import (
diff --git a/pkg/machine/connection.go b/pkg/machine/connection.go
index e3985d8ac..3edcbd10e 100644
--- a/pkg/machine/connection.go
+++ b/pkg/machine/connection.go
@@ -1,3 +1,5 @@
+// +build amd64,linux arm64,linux amd64,darwin arm64,darwin
+
package machine
import (
diff --git a/pkg/machine/fcos.go b/pkg/machine/fcos.go
index 32f943c87..11936aee7 100644
--- a/pkg/machine/fcos.go
+++ b/pkg/machine/fcos.go
@@ -1,3 +1,5 @@
+// +build amd64,linux arm64,linux amd64,darwin arm64,darwin
+
package machine
import (
diff --git a/pkg/machine/ignition.go b/pkg/machine/ignition.go
index a5c7210af..1d77083d0 100644
--- a/pkg/machine/ignition.go
+++ b/pkg/machine/ignition.go
@@ -1,3 +1,5 @@
+// +build amd64,linux arm64,linux amd64,darwin arm64,darwin
+
package machine
import (
diff --git a/pkg/machine/ignition_schema.go b/pkg/machine/ignition_schema.go
index 9dbd90ba4..6ac8af826 100644
--- a/pkg/machine/ignition_schema.go
+++ b/pkg/machine/ignition_schema.go
@@ -1,3 +1,5 @@
+// +build amd64,linux arm64,linux amd64,darwin arm64,darwin
+
package machine
/*
diff --git a/pkg/machine/keys.go b/pkg/machine/keys.go
index 907e28f55..81ec44ea8 100644
--- a/pkg/machine/keys.go
+++ b/pkg/machine/keys.go
@@ -1,3 +1,5 @@
+// +build amd64,linux arm64,linux amd64,darwin arm64,darwin
+
package machine
import (
diff --git a/pkg/machine/libvirt/config.go b/pkg/machine/libvirt/config.go
index 903f15fbc..1ce5ab154 100644
--- a/pkg/machine/libvirt/config.go
+++ b/pkg/machine/libvirt/config.go
@@ -1,3 +1,5 @@
+// +build amd64,linux arm64,linux amd64,darwin arm64,darwin
+
package libvirt
type MachineVM struct {
diff --git a/pkg/machine/libvirt/machine.go b/pkg/machine/libvirt/machine.go
index c38f63853..e1aa1569b 100644
--- a/pkg/machine/libvirt/machine.go
+++ b/pkg/machine/libvirt/machine.go
@@ -1,3 +1,5 @@
+// +build amd64,linux arm64,linux amd64,darwin arm64,darwin
+
package libvirt
import "github.com/containers/podman/v3/pkg/machine"
diff --git a/pkg/machine/libvirt/machine_unsupported.go b/pkg/machine/libvirt/machine_unsupported.go
new file mode 100644
index 000000000..8b54440fe
--- /dev/null
+++ b/pkg/machine/libvirt/machine_unsupported.go
@@ -0,0 +1,3 @@
+// +build !amd64 amd64,windows
+
+package libvirt
diff --git a/pkg/machine/machine_unsupported.go b/pkg/machine/machine_unsupported.go
new file mode 100644
index 000000000..9309d16bc
--- /dev/null
+++ b/pkg/machine/machine_unsupported.go
@@ -0,0 +1,3 @@
+// +build !amd64 amd64,windows
+
+package machine
diff --git a/pkg/machine/pull.go b/pkg/machine/pull.go
index 68bb551dc..662896de5 100644
--- a/pkg/machine/pull.go
+++ b/pkg/machine/pull.go
@@ -1,3 +1,5 @@
+// +build amd64,linux arm64,linux amd64,darwin arm64,darwin
+
package machine
import (
diff --git a/pkg/machine/qemu/config.go b/pkg/machine/qemu/config.go
index e4687914d..013f28960 100644
--- a/pkg/machine/qemu/config.go
+++ b/pkg/machine/qemu/config.go
@@ -1,3 +1,5 @@
+// +build amd64,linux arm64,linux amd64,darwin arm64,darwin
+
package qemu
import "time"
diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go
index 31c355d4a..22fb78a5c 100644
--- a/pkg/machine/qemu/machine.go
+++ b/pkg/machine/qemu/machine.go
@@ -1,3 +1,5 @@
+// +build amd64,linux arm64,linux amd64,darwin arm64,darwin
+
package qemu
import (
diff --git a/pkg/machine/qemu/machine_unsupported.go b/pkg/machine/qemu/machine_unsupported.go
new file mode 100644
index 000000000..da06ac324
--- /dev/null
+++ b/pkg/machine/qemu/machine_unsupported.go
@@ -0,0 +1,3 @@
+// +build !amd64 amd64,windows
+
+package qemu
diff --git a/pkg/rootless/rootless_linux.c b/pkg/rootless/rootless_linux.c
index 0d1d6e93e..e5f9e88d9 100644
--- a/pkg/rootless/rootless_linux.c
+++ b/pkg/rootless/rootless_linux.c
@@ -333,7 +333,7 @@ static void __attribute__((constructor)) init()
uid_t uid;
gid_t gid;
char path[PATH_MAX];
- const char *const suffix = "/libpod/pause.pid";
+ const char *const suffix = "/libpod/tmp/pause.pid";
char *cwd = getcwd (NULL, 0);
char uid_fmt[16];
char gid_fmt[16];
diff --git a/test/e2e/systemd_test.go b/test/e2e/systemd_test.go
index b132750b0..8dc14d5f7 100644
--- a/test/e2e/systemd_test.go
+++ b/test/e2e/systemd_test.go
@@ -6,6 +6,7 @@ import (
"strings"
"time"
+ "github.com/containers/podman/v3/pkg/rootless"
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -115,6 +116,12 @@ WantedBy=multi-user.target
conData := result.InspectContainerToJSON()
Expect(len(conData)).To(Equal(1))
Expect(conData[0].Config.SystemdMode).To(BeTrue())
+
+ if CGROUPSV2 || !rootless.IsRootless() {
+ stats := podmanTest.Podman([]string{"stats", "--no-stream", ctrName})
+ stats.WaitWithDefaultTimeout()
+ Expect(stats.ExitCode()).To(Equal(0))
+ }
})
It("podman create container with systemd entrypoint triggers systemd mode", func() {
diff --git a/test/system/build-testimage b/test/system/build-testimage
index 3e5b982ce..eb5849b5e 100755
--- a/test/system/build-testimage
+++ b/test/system/build-testimage
@@ -61,8 +61,8 @@ chmod 755 pause
# - check for updates @ https://hub.docker.com/_/alpine
# busybox-extras provides httpd needed in 500-networking.bats
cat >Containerfile <<EOF
-ARG ARCH=please-override-arch
-FROM docker.io/\${ARCH}/alpine:3.12.0
+ARG REPO=please-override-repo
+FROM docker.io/\${REPO}/alpine:3.13.5
RUN apk add busybox-extras
ADD testimage-id pause /home/podman/
LABEL created_by=$create_script
@@ -74,17 +74,46 @@ EOF
# --squash-all : needed by 'tree' test in 070-build.bats
podman rmi -f testimage &> /dev/null || true
+# There should always be a testimage tagged ':0000000<X>' (eight digits,
+# zero-padded sequence ID) in the same location; this is used by tests
+# which need to pull a non-locally-cached image. This image will rarely
+# if ever need to change, nor in fact does it even have to be a copy of
+# this testimage since all we use it for is 'true'.
+# However, it does need to be multiarch :-(
+zerotag_latest=$(skopeo list-tags docker://quay.io/libpod/testimage |\
+ jq -r '.Tags[]' |\
+ sort --version-sort |\
+ grep '^000' |\
+ tail -n 1)
+zerotag_next=$(printf "%08d" $((zerotag_latest + 1)))
+
+# We don't always need to push the :00xx image, but build it anyway.
+zeroimg=quay.io/libpod/testimage:${zerotag_next}
+buildah manifest create $zeroimg
+
# We need to use buildah because (as of 2021-02-23) only buildah has --manifest
# and because Dan says arch emulation is not currently working on podman
# (no further details).
# Arch emulation on Fedora requires the qemu-user-static package.
-for arch in amd64 arm64v8 ppc64le s390x;do
+for arch in amd64 arm64 ppc64le s390x;do
+ # docker.io repo is usually the same name as the desired arch; except
+ # for arm64, where podman needs to have the arch be 'arm64' but the
+ # image lives in 'arm64v8'.
+ repo=$arch
+ if [[ $repo = "arm64" ]]; then
+ repo="${repo}v8"
+ fi
+
${BUILDAH} bud \
--arch=$arch \
- --build-arg ARCH=$arch \
+ --build-arg REPO=$repo \
--manifest=testimage \
--squash \
.
+
+ # The zero-tag image
+ ${BUILDAH} pull --arch $arch docker.io/$repo/busybox:1.33.1
+ ${BUILDAH} manifest add $zeroimg docker.io/$repo/busybox:1.33.1
done
# Clean up
@@ -94,23 +123,13 @@ rm -rf $tmpdir
# Tag image and push (all arches) to quay.
remote_tag=quay.io/libpod/testimage:$YMD
podman tag testimage ${remote_tag}
-${BUILDAH} manifest push --all ${remote_tag} docker://${remote_tag}
+cat <<EOF
-# Side note: there should always be a testimage tagged ':0000000<X>'
-# (eight digits, zero-padded sequence ID) in the same location; this is
-# used by tests which need to pull a non-locally-cached image. This
-# image will rarely if ever need to change, nor in fact does it even
-# have to be a copy of this testimage since all we use it for is 'true'.
-# However, it does need to be multiarch :-(
-#
-# As of 2021-02-24 it is simply busybox, because it is super small,
-# but it's complicated because of multiarch:
-#
-# img=quay.io/libpod/testimage:0000000<current+1>
-# buildah manifest create $img
-# for arch in amd64 arm64v8 ppc64le s390x;do
-# buildah pull --arch $arch docker.io/$arch/busybox:1.32.0
-# buildah manifest add $img docker.io/$arch/busybox:1.32.0
-# done
-# buildah manifest push --all $img docker://$img
-#
+If you're happy with these images, run:
+
+ ${BUILDAH} manifest push --all ${remote_tag} docker://${remote_tag}
+ ${BUILDAH} manifest push --all ${zeroimg} docker://${zeroimg}
+
+(You do not always need to push the :0000 image)
+
+EOF
diff --git a/test/system/helpers.bash b/test/system/helpers.bash
index e0c208f57..1859a2168 100644
--- a/test/system/helpers.bash
+++ b/test/system/helpers.bash
@@ -7,14 +7,15 @@ PODMAN=${PODMAN:-podman}
PODMAN_TEST_IMAGE_REGISTRY=${PODMAN_TEST_IMAGE_REGISTRY:-"quay.io"}
PODMAN_TEST_IMAGE_USER=${PODMAN_TEST_IMAGE_USER:-"libpod"}
PODMAN_TEST_IMAGE_NAME=${PODMAN_TEST_IMAGE_NAME:-"testimage"}
-PODMAN_TEST_IMAGE_TAG=${PODMAN_TEST_IMAGE_TAG:-"20210427"}
+PODMAN_TEST_IMAGE_TAG=${PODMAN_TEST_IMAGE_TAG:-"20210610"}
PODMAN_TEST_IMAGE_FQN="$PODMAN_TEST_IMAGE_REGISTRY/$PODMAN_TEST_IMAGE_USER/$PODMAN_TEST_IMAGE_NAME:$PODMAN_TEST_IMAGE_TAG"
PODMAN_TEST_IMAGE_ID=
# Remote image that we *DO NOT* fetch or keep by default; used for testing pull
-# This changed from 0 to 1 on 2021-02-24 due to multiarch considerations; it
-# should change only very rarely.
-PODMAN_NONLOCAL_IMAGE_FQN="$PODMAN_TEST_IMAGE_REGISTRY/$PODMAN_TEST_IMAGE_USER/$PODMAN_TEST_IMAGE_NAME:00000002"
+# This has changed in 2021, from 0 through 3, various iterations of getting
+# multiarch to work. It should change only very rarely.
+PODMAN_NONLOCAL_IMAGE_TAG=${PODMAN_NONLOCAL_IMAGE_TAG:-"00000003"}
+PODMAN_NONLOCAL_IMAGE_FQN="$PODMAN_TEST_IMAGE_REGISTRY/$PODMAN_TEST_IMAGE_USER/$PODMAN_TEST_IMAGE_NAME:$PODMAN_NONLOCAL_IMAGE_TAG"
# Because who wants to spell that out each time?
IMAGE=$PODMAN_TEST_IMAGE_FQN
diff --git a/vendor/github.com/containers/storage/VERSION b/vendor/github.com/containers/storage/VERSION
index 96cd6ee1e..c78d39b8e 100644
--- a/vendor/github.com/containers/storage/VERSION
+++ b/vendor/github.com/containers/storage/VERSION
@@ -1 +1 @@
-1.32.1
+1.32.2
diff --git a/vendor/github.com/containers/storage/drivers/overlay/overlay.go b/vendor/github.com/containers/storage/drivers/overlay/overlay.go
index d5d161bfd..87d608393 100644
--- a/vendor/github.com/containers/storage/drivers/overlay/overlay.go
+++ b/vendor/github.com/containers/storage/drivers/overlay/overlay.go
@@ -1189,7 +1189,11 @@ func (d *Driver) get(id string, disableShifting bool, options graphdriver.MountO
if d.usingMetacopy {
optsList = append(optsList, "metacopy=on")
} else {
- logrus.Warnf("ignoring metacopy option from storage.conf, not supported with booted kernel")
+ logLevel := logrus.WarnLevel
+ if unshare.IsRootless() {
+ logLevel = logrus.DebugLevel
+ }
+ logrus.StandardLogger().Logf(logLevel, "ignoring metacopy option from storage.conf, not supported with booted kernel")
}
}
}
diff --git a/vendor/github.com/containers/storage/go.mod b/vendor/github.com/containers/storage/go.mod
index e7ca56e64..2217ea739 100644
--- a/vendor/github.com/containers/storage/go.mod
+++ b/vendor/github.com/containers/storage/go.mod
@@ -10,15 +10,15 @@ require (
github.com/google/go-intervals v0.0.2
github.com/hashicorp/go-multierror v1.1.1
github.com/json-iterator/go v1.1.11
- github.com/klauspost/compress v1.12.3
+ github.com/klauspost/compress v1.13.0
github.com/klauspost/pgzip v1.2.5
- github.com/mattn/go-shellwords v1.0.11
+ github.com/mattn/go-shellwords v1.0.12
github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible
github.com/moby/sys/mountinfo v0.4.1
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/runc v1.0.0-rc95
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417
- github.com/opencontainers/selinux v1.8.1
+ github.com/opencontainers/selinux v1.8.2
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.7.0
diff --git a/vendor/github.com/containers/storage/go.sum b/vendor/github.com/containers/storage/go.sum
index 5373d0597..6cd6df17c 100644
--- a/vendor/github.com/containers/storage/go.sum
+++ b/vendor/github.com/containers/storage/go.sum
@@ -77,6 +77,8 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA=
+github.com/bits-and-blooms/bitset v1.2.0 h1:Kn4yilvwNtMACtf1eYDlG8H77R07mZSPbMjLyS07ChA=
+github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
@@ -383,8 +385,8 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
-github.com/klauspost/compress v1.12.3 h1:G5AfA94pHPysR56qqrkO2pxEexdDzrpFJ6yt/VqWxVU=
-github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
+github.com/klauspost/compress v1.13.0 h1:2T7tUoQrQT+fQWdaY5rjWztFGAFwbGD04iPJg90ZiOs=
+github.com/klauspost/compress v1.13.0/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
@@ -408,8 +410,8 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
-github.com/mattn/go-shellwords v1.0.11 h1:vCoR9VPpsk/TZFW2JwK5I9S0xdrtUq2bph6/YjEPnaw=
-github.com/mattn/go-shellwords v1.0.11/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
+github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk=
+github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs=
@@ -476,8 +478,8 @@ github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.m
github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs=
github.com/opencontainers/selinux v1.6.0/go.mod h1:VVGKuOLlE7v4PJyT6h7mNWvq1rzqiriPsEqVhc+svHE=
github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo=
-github.com/opencontainers/selinux v1.8.1 h1:yvEZh7CsfnJNwKzG9ZeXwbvR05RAZsu5RS/3vA6qFTA=
-github.com/opencontainers/selinux v1.8.1/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo=
+github.com/opencontainers/selinux v1.8.2 h1:c4ca10UMgRcvZ6h0K4HtS15UaVSBEaE+iln2LVpAuGc=
+github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
@@ -588,7 +590,6 @@ github.com/vishvananda/netns v0.0.0-20180720170159-13995c7128cc/go.mod h1:ZjcWmF
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU=
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
-github.com/willf/bitset v1.1.11 h1:N7Z7E9UvjW+sGsEl7k/SJrvY2reP1A07MrGuCjIOjRE=
github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
diff --git a/vendor/github.com/containers/storage/pkg/lockfile/lockfile_unix.go b/vendor/github.com/containers/storage/pkg/lockfile/lockfile_unix.go
index 0a92da2c0..f0e46b6b6 100644
--- a/vendor/github.com/containers/storage/pkg/lockfile/lockfile_unix.go
+++ b/vendor/github.com/containers/storage/pkg/lockfile/lockfile_unix.go
@@ -194,11 +194,7 @@ func (l *lockfile) Touch() error {
defer l.stateMutex.Unlock()
l.lw = stringid.GenerateRandomID()
id := []byte(l.lw)
- _, err := unix.Seek(int(l.fd), 0, os.SEEK_SET)
- if err != nil {
- return err
- }
- n, err := unix.Write(int(l.fd), id)
+ n, err := unix.Pwrite(int(l.fd), id, 0)
if err != nil {
return err
}
@@ -217,11 +213,7 @@ func (l *lockfile) Modified() (bool, error) {
panic("attempted to check last-writer in lockfile without locking it first")
}
defer l.stateMutex.Unlock()
- _, err := unix.Seek(int(l.fd), 0, os.SEEK_SET)
- if err != nil {
- return true, err
- }
- n, err := unix.Read(int(l.fd), id)
+ n, err := unix.Pread(int(l.fd), id, 0)
if err != nil {
return true, err
}
diff --git a/vendor/github.com/containers/storage/store.go b/vendor/github.com/containers/storage/store.go
index d6d547c64..dc6eaafa2 100644
--- a/vendor/github.com/containers/storage/store.go
+++ b/vendor/github.com/containers/storage/store.go
@@ -937,7 +937,7 @@ func (s *store) ContainerStore() (ContainerStore, error) {
}
func (s *store) canUseShifting(uidmap, gidmap []idtools.IDMap) bool {
- if !s.graphDriver.SupportsShifting() {
+ if s.graphDriver == nil || !s.graphDriver.SupportsShifting() {
return false
}
if uidmap != nil && !idtools.IsContiguous(uidmap) {
@@ -2668,6 +2668,10 @@ func (s *store) mount(id string, options drivers.MountOpts) (string, error) {
s.lastLoaded = time.Now()
}
+ if options.UidMaps != nil || options.GidMaps != nil {
+ options.DisableShifting = !s.canUseShifting(options.UidMaps, options.GidMaps)
+ }
+
if rlstore.Exists(id) {
return rlstore.Mount(id, options)
}
@@ -2708,7 +2712,6 @@ func (s *store) Mount(id, mountLabel string) (string, error) {
options.Volatile = v.(bool)
}
}
- options.DisableShifting = !s.canUseShifting(container.UIDMap, container.GIDMap)
}
return s.mount(id, options)
}
diff --git a/vendor/github.com/containers/storage/types/default_override_test.conf b/vendor/github.com/containers/storage/types/default_override_test.conf
new file mode 100644
index 000000000..caa537ba9
--- /dev/null
+++ b/vendor/github.com/containers/storage/types/default_override_test.conf
@@ -0,0 +1,11 @@
+[storage]
+
+# Default Storage Driver
+driver = ""
+
+# Primary Read/Write location of container storage
+graphroot = "environment_override_graphroot"
+
+# Storage path for rootless users
+#
+rootless_storage_path = "environment_override_rootless_storage_path"
diff --git a/vendor/github.com/containers/storage/types/utils.go b/vendor/github.com/containers/storage/types/utils.go
index d2dca7b68..4d62b151a 100644
--- a/vendor/github.com/containers/storage/types/utils.go
+++ b/vendor/github.com/containers/storage/types/utils.go
@@ -160,7 +160,14 @@ func expandEnvPath(path string, rootlessUID int) (string, error) {
}
func DefaultConfigFile(rootless bool) (string, error) {
- if defaultConfigFileSet || !rootless {
+ if defaultConfigFileSet {
+ return defaultConfigFile, nil
+ }
+
+ if path, ok := os.LookupEnv("CONTAINERS_STORAGE_CONF"); ok {
+ return path, nil
+ }
+ if !rootless {
return defaultConfigFile, nil
}
diff --git a/vendor/github.com/klauspost/compress/zstd/blockdec.go b/vendor/github.com/klauspost/compress/zstd/blockdec.go
index 6cea054d2..e30af505c 100644
--- a/vendor/github.com/klauspost/compress/zstd/blockdec.go
+++ b/vendor/github.com/klauspost/compress/zstd/blockdec.go
@@ -144,7 +144,7 @@ func (b *blockDec) reset(br byteBuffer, windowSize uint64) error {
}
cSize = 1
case blockTypeCompressed:
- if debug {
+ if debugDecoder {
println("Data size on stream:", cSize)
}
b.RLESize = 0
@@ -153,7 +153,7 @@ func (b *blockDec) reset(br byteBuffer, windowSize uint64) error {
maxSize = int(windowSize)
}
if cSize > maxCompressedBlockSize || uint64(cSize) > b.WindowSize {
- if debug {
+ if debugDecoder {
printf("compressed block too big: csize:%d block: %+v\n", uint64(cSize), b)
}
return ErrCompressedSizeTooBig
@@ -179,7 +179,7 @@ func (b *blockDec) reset(br byteBuffer, windowSize uint64) error {
}
b.data, err = br.readBig(cSize, b.dataStorage)
if err != nil {
- if debug {
+ if debugDecoder {
println("Reading block:", err, "(", cSize, ")", len(b.data))
printf("%T", br)
}
@@ -249,7 +249,7 @@ func (b *blockDec) startDecoder() {
b: b.dst,
err: err,
}
- if debug {
+ if debugDecoder {
println("Decompressed to", len(b.dst), "bytes, error:", err)
}
b.result <- o
@@ -264,7 +264,7 @@ func (b *blockDec) startDecoder() {
default:
panic("Invalid block type")
}
- if debug {
+ if debugDecoder {
println("blockDec: Finished block")
}
}
@@ -297,7 +297,7 @@ func (b *blockDec) decodeBuf(hist *history) error {
b.dst = hist.b
hist.b = nil
err := b.decodeCompressed(hist)
- if debug {
+ if debugDecoder {
println("Decompressed to total", len(b.dst), "bytes, hash:", xxhash.Sum64(b.dst), "error:", err)
}
hist.b = b.dst
@@ -390,7 +390,7 @@ func (b *blockDec) decodeCompressed(hist *history) error {
in = in[5:]
}
}
- if debug {
+ if debugDecoder {
println("literals type:", litType, "litRegenSize:", litRegenSize, "litCompSize:", litCompSize, "sizeFormat:", sizeFormat, "4X:", fourStreams)
}
var literals []byte
@@ -428,7 +428,7 @@ func (b *blockDec) decodeCompressed(hist *history) error {
literals[i] = v
}
in = in[1:]
- if debug {
+ if debugDecoder {
printf("Found %d RLE compressed literals\n", litRegenSize)
}
case literalsBlockTreeless:
@@ -439,7 +439,7 @@ func (b *blockDec) decodeCompressed(hist *history) error {
// Store compressed literals, so we defer decoding until we get history.
literals = in[:litCompSize]
in = in[litCompSize:]
- if debug {
+ if debugDecoder {
printf("Found %d compressed literals\n", litCompSize)
}
case literalsBlockCompressed:
@@ -481,7 +481,7 @@ func (b *blockDec) decodeCompressed(hist *history) error {
if len(literals) != litRegenSize {
return fmt.Errorf("literal output size mismatch want %d, got %d", litRegenSize, len(literals))
}
- if debug {
+ if debugDecoder {
printf("Decompressed %d literals into %d bytes\n", litCompSize, litRegenSize)
}
}
@@ -532,12 +532,12 @@ func (b *blockDec) decodeCompressed(hist *history) error {
br := byteReader{b: in, off: 0}
compMode := br.Uint8()
br.advance(1)
- if debug {
+ if debugDecoder {
printf("Compression modes: 0b%b", compMode)
}
for i := uint(0); i < 3; i++ {
mode := seqCompMode((compMode >> (6 - i*2)) & 3)
- if debug {
+ if debugDecoder {
println("Table", tableIndex(i), "is", mode)
}
var seq *sequenceDec
@@ -568,7 +568,7 @@ func (b *blockDec) decodeCompressed(hist *history) error {
}
dec.setRLE(symb)
seq.fse = dec
- if debug {
+ if debugDecoder {
printf("RLE set to %+v, code: %v", symb, v)
}
case compModeFSE:
@@ -584,7 +584,7 @@ func (b *blockDec) decodeCompressed(hist *history) error {
println("Transform table error:", err)
return err
}
- if debug {
+ if debugDecoder {
println("Read table ok", "symbolLen:", dec.symbolLen)
}
seq.fse = dec
@@ -652,7 +652,7 @@ func (b *blockDec) decodeCompressed(hist *history) error {
if huff != nil {
hist.huffTree = huff
}
- if debug {
+ if debugDecoder {
println("Final literals:", len(literals), "hash:", xxhash.Sum64(literals), "and", nSeqs, "sequences.")
}
@@ -669,7 +669,7 @@ func (b *blockDec) decodeCompressed(hist *history) error {
if err != nil {
return err
}
- if debug {
+ if debugDecoder {
println("History merged ok")
}
br := &bitReader{}
@@ -728,7 +728,7 @@ func (b *blockDec) decodeCompressed(hist *history) error {
}
hist.append(b.dst)
hist.recentOffsets = seqs.prevOffset
- if debug {
+ if debugDecoder {
println("Finished block with literals:", len(literals), "and", nSeqs, "sequences.")
}
diff --git a/vendor/github.com/klauspost/compress/zstd/blockenc.go b/vendor/github.com/klauspost/compress/zstd/blockenc.go
index e1be092f3..3df185ee4 100644
--- a/vendor/github.com/klauspost/compress/zstd/blockenc.go
+++ b/vendor/github.com/klauspost/compress/zstd/blockenc.go
@@ -156,7 +156,7 @@ func (h *literalsHeader) setSize(regenLen int) {
switch {
case inBits < 5:
lh |= (uint64(regenLen) << 3) | (1 << 60)
- if debug {
+ if debugEncoder {
got := int(lh>>3) & 0xff
if got != regenLen {
panic(fmt.Sprint("litRegenSize = ", regenLen, "(want) != ", got, "(got)"))
@@ -184,7 +184,7 @@ func (h *literalsHeader) setSizes(compLen, inLen int, single bool) {
lh |= 1 << 2
}
lh |= (uint64(inLen) << 4) | (uint64(compLen) << (10 + 4)) | (3 << 60)
- if debug {
+ if debugEncoder {
const mmask = (1 << 24) - 1
n := (lh >> 4) & mmask
if int(n&1023) != inLen {
@@ -312,7 +312,7 @@ func (b *blockEnc) encodeRaw(a []byte) {
bh.setType(blockTypeRaw)
b.output = bh.appendTo(b.output[:0])
b.output = append(b.output, a...)
- if debug {
+ if debugEncoder {
println("Adding RAW block, length", len(a), "last:", b.last)
}
}
@@ -325,7 +325,7 @@ func (b *blockEnc) encodeRawTo(dst, src []byte) []byte {
bh.setType(blockTypeRaw)
dst = bh.appendTo(dst)
dst = append(dst, src...)
- if debug {
+ if debugEncoder {
println("Adding RAW block, length", len(src), "last:", b.last)
}
return dst
@@ -339,7 +339,7 @@ func (b *blockEnc) encodeLits(lits []byte, raw bool) error {
// Don't compress extremely small blocks
if len(lits) < 8 || (len(lits) < 32 && b.dictLitEnc == nil) || raw {
- if debug {
+ if debugEncoder {
println("Adding RAW block, length", len(lits), "last:", b.last)
}
bh.setType(blockTypeRaw)
@@ -371,7 +371,7 @@ func (b *blockEnc) encodeLits(lits []byte, raw bool) error {
switch err {
case huff0.ErrIncompressible:
- if debug {
+ if debugEncoder {
println("Adding RAW block, length", len(lits), "last:", b.last)
}
bh.setType(blockTypeRaw)
@@ -379,7 +379,7 @@ func (b *blockEnc) encodeLits(lits []byte, raw bool) error {
b.output = append(b.output, lits...)
return nil
case huff0.ErrUseRLE:
- if debug {
+ if debugEncoder {
println("Adding RLE block, length", len(lits))
}
bh.setType(blockTypeRLE)
@@ -396,12 +396,12 @@ func (b *blockEnc) encodeLits(lits []byte, raw bool) error {
bh.setType(blockTypeCompressed)
var lh literalsHeader
if reUsed {
- if debug {
+ if debugEncoder {
println("Reused tree, compressed to", len(out))
}
lh.setType(literalsBlockTreeless)
} else {
- if debug {
+ if debugEncoder {
println("New tree, compressed to", len(out), "tree size:", len(b.litEnc.OutTable))
}
lh.setType(literalsBlockCompressed)
@@ -517,7 +517,7 @@ func (b *blockEnc) encode(org []byte, raw, rawAllLits bool) error {
lh.setSize(len(b.literals))
b.output = lh.appendTo(b.output)
b.output = append(b.output, b.literals...)
- if debug {
+ if debugEncoder {
println("Adding literals RAW, length", len(b.literals))
}
case huff0.ErrUseRLE:
@@ -525,22 +525,22 @@ func (b *blockEnc) encode(org []byte, raw, rawAllLits bool) error {
lh.setSize(len(b.literals))
b.output = lh.appendTo(b.output)
b.output = append(b.output, b.literals[0])
- if debug {
+ if debugEncoder {
println("Adding literals RLE")
}
case nil:
// Compressed litLen...
if reUsed {
- if debug {
+ if debugEncoder {
println("reused tree")
}
lh.setType(literalsBlockTreeless)
} else {
- if debug {
+ if debugEncoder {
println("new tree, size:", len(b.litEnc.OutTable))
}
lh.setType(literalsBlockCompressed)
- if debug {
+ if debugEncoder {
_, _, err := huff0.ReadTable(out, nil)
if err != nil {
panic(err)
@@ -548,18 +548,18 @@ func (b *blockEnc) encode(org []byte, raw, rawAllLits bool) error {
}
}
lh.setSizes(len(out), len(b.literals), single)
- if debug {
+ if debugEncoder {
printf("Compressed %d literals to %d bytes", len(b.literals), len(out))
println("Adding literal header:", lh)
}
b.output = lh.appendTo(b.output)
b.output = append(b.output, out...)
b.litEnc.Reuse = huff0.ReusePolicyAllow
- if debug {
+ if debugEncoder {
println("Adding literals compressed")
}
default:
- if debug {
+ if debugEncoder {
println("Adding literals ERROR:", err)
}
return err
@@ -577,7 +577,7 @@ func (b *blockEnc) encode(org []byte, raw, rawAllLits bool) error {
n := len(b.sequences) - 0x7f00
b.output = append(b.output, 255, uint8(n), uint8(n>>8))
}
- if debug {
+ if debugEncoder {
println("Encoding", len(b.sequences), "sequences")
}
b.genCodes()
@@ -611,17 +611,17 @@ func (b *blockEnc) encode(org []byte, raw, rawAllLits bool) error {
nSize = nSize + (nSize+2*8*16)>>4
switch {
case predefSize <= prevSize && predefSize <= nSize || forcePreDef:
- if debug {
+ if debugEncoder {
println("Using predefined", predefSize>>3, "<=", nSize>>3)
}
return preDef, compModePredefined
case prevSize <= nSize:
- if debug {
+ if debugEncoder {
println("Using previous", prevSize>>3, "<=", nSize>>3)
}
return prev, compModeRepeat
default:
- if debug {
+ if debugEncoder {
println("Using new, predef", predefSize>>3, ". previous:", prevSize>>3, ">", nSize>>3, "header max:", cur.maxHeaderSize()>>3, "bytes")
println("tl:", cur.actualTableLog, "symbolLen:", cur.symbolLen, "norm:", cur.norm[:cur.symbolLen], "hist", cur.count[:cur.symbolLen])
}
@@ -634,7 +634,7 @@ func (b *blockEnc) encode(org []byte, raw, rawAllLits bool) error {
if llEnc.useRLE {
mode |= uint8(compModeRLE) << 6
llEnc.setRLE(b.sequences[0].llCode)
- if debug {
+ if debugEncoder {
println("llEnc.useRLE")
}
} else {
@@ -645,7 +645,7 @@ func (b *blockEnc) encode(org []byte, raw, rawAllLits bool) error {
if ofEnc.useRLE {
mode |= uint8(compModeRLE) << 4
ofEnc.setRLE(b.sequences[0].ofCode)
- if debug {
+ if debugEncoder {
println("ofEnc.useRLE")
}
} else {
@@ -657,7 +657,7 @@ func (b *blockEnc) encode(org []byte, raw, rawAllLits bool) error {
if mlEnc.useRLE {
mode |= uint8(compModeRLE) << 2
mlEnc.setRLE(b.sequences[0].mlCode)
- if debug {
+ if debugEncoder {
println("mlEnc.useRLE, code: ", b.sequences[0].mlCode, "value", b.sequences[0].matchLen)
}
} else {
@@ -666,7 +666,7 @@ func (b *blockEnc) encode(org []byte, raw, rawAllLits bool) error {
mode |= uint8(m) << 2
}
b.output = append(b.output, mode)
- if debug {
+ if debugEncoder {
printf("Compression modes: 0b%b", mode)
}
b.output, err = llEnc.writeCount(b.output)
@@ -786,7 +786,7 @@ func (b *blockEnc) encode(org []byte, raw, rawAllLits bool) error {
// Size is output minus block header.
bh.setSize(uint32(len(b.output)-bhOffset) - 3)
- if debug {
+ if debugEncoder {
println("Rewriting block header", bh)
}
_ = bh.appendTo(b.output[bhOffset:bhOffset])
diff --git a/vendor/github.com/klauspost/compress/zstd/bytebuf.go b/vendor/github.com/klauspost/compress/zstd/bytebuf.go
index 17e820a6a..aab71c6cf 100644
--- a/vendor/github.com/klauspost/compress/zstd/bytebuf.go
+++ b/vendor/github.com/klauspost/compress/zstd/bytebuf.go
@@ -91,7 +91,7 @@ func (r *readerWrapper) readSmall(n int) ([]byte, error) {
if err == io.EOF {
return nil, io.ErrUnexpectedEOF
}
- if debug {
+ if debugDecoder {
println("readSmall: got", n2, "want", n, "err", err)
}
return nil, err
diff --git a/vendor/github.com/klauspost/compress/zstd/decoder.go b/vendor/github.com/klauspost/compress/zstd/decoder.go
index f593e464b..4d984c3b2 100644
--- a/vendor/github.com/klauspost/compress/zstd/decoder.go
+++ b/vendor/github.com/klauspost/compress/zstd/decoder.go
@@ -113,9 +113,6 @@ func NewReader(r io.Reader, opts ...DOption) (*Decoder, error) {
// Returns the number of bytes written and any error that occurred.
// When the stream is done, io.EOF will be returned.
func (d *Decoder) Read(p []byte) (int, error) {
- if d.stream == nil {
- return 0, ErrDecoderNilInput
- }
var n int
for {
if len(d.current.b) > 0 {
@@ -138,7 +135,7 @@ func (d *Decoder) Read(p []byte) (int, error) {
}
}
if len(d.current.b) > 0 {
- if debug {
+ if debugDecoder {
println("returning", n, "still bytes left:", len(d.current.b))
}
// Only return error at end of block
@@ -147,7 +144,7 @@ func (d *Decoder) Read(p []byte) (int, error) {
if d.current.err != nil {
d.drainOutput()
}
- if debug {
+ if debugDecoder {
println("returning", n, d.current.err, len(d.decoders))
}
return n, d.current.err
@@ -167,20 +164,17 @@ func (d *Decoder) Reset(r io.Reader) error {
if r == nil {
d.current.err = ErrDecoderNilInput
+ if len(d.current.b) > 0 {
+ d.current.b = d.current.b[:0]
+ }
d.current.flushed = true
return nil
}
- if d.stream == nil {
- d.stream = make(chan decodeStream, 1)
- d.streamWg.Add(1)
- go d.startStreamDecoder(d.stream)
- }
-
- // If bytes buffer and < 1MB, do sync decoding anyway.
- if bb, ok := r.(byter); ok && bb.Len() < 1<<20 {
+ // If bytes buffer and < 5MB, do sync decoding anyway.
+ if bb, ok := r.(byter); ok && bb.Len() < 5<<20 {
bb2 := bb
- if debug {
+ if debugDecoder {
println("*bytes.Buffer detected, doing sync decode, len:", bb.Len())
}
b := bb2.Bytes()
@@ -196,12 +190,18 @@ func (d *Decoder) Reset(r io.Reader) error {
d.current.b = dst
d.current.err = err
d.current.flushed = true
- if debug {
+ if debugDecoder {
println("sync decode to", len(dst), "bytes, err:", err)
}
return nil
}
+ if d.stream == nil {
+ d.stream = make(chan decodeStream, 1)
+ d.streamWg.Add(1)
+ go d.startStreamDecoder(d.stream)
+ }
+
// Remove current block.
d.current.decodeOutput = decodeOutput{}
d.current.err = nil
@@ -225,7 +225,7 @@ func (d *Decoder) drainOutput() {
d.current.cancel = nil
}
if d.current.d != nil {
- if debug {
+ if debugDecoder {
printf("re-adding current decoder %p, decoders: %d", d.current.d, len(d.decoders))
}
d.decoders <- d.current.d
@@ -238,7 +238,7 @@ func (d *Decoder) drainOutput() {
}
for v := range d.current.output {
if v.d != nil {
- if debug {
+ if debugDecoder {
printf("re-adding decoder %p", v.d)
}
d.decoders <- v.d
@@ -255,9 +255,6 @@ func (d *Decoder) drainOutput() {
// The return value n is the number of bytes written.
// Any error encountered during the write is also returned.
func (d *Decoder) WriteTo(w io.Writer) (int64, error) {
- if d.stream == nil {
- return 0, ErrDecoderNilInput
- }
var n int64
for {
if len(d.current.b) > 0 {
@@ -297,7 +294,7 @@ func (d *Decoder) DecodeAll(input, dst []byte) ([]byte, error) {
block := <-d.decoders
frame := block.localFrame
defer func() {
- if debug {
+ if debugDecoder {
printf("re-adding decoder: %p", block)
}
frame.rawInput = nil
@@ -310,7 +307,7 @@ func (d *Decoder) DecodeAll(input, dst []byte) ([]byte, error) {
frame.history.reset()
err := frame.reset(&frame.bBuf)
if err == io.EOF {
- if debug {
+ if debugDecoder {
println("frame reset return EOF")
}
return dst, nil
@@ -355,7 +352,7 @@ func (d *Decoder) DecodeAll(input, dst []byte) ([]byte, error) {
return dst, err
}
if len(frame.bBuf) == 0 {
- if debug {
+ if debugDecoder {
println("frame dbuf empty")
}
break
@@ -371,7 +368,7 @@ func (d *Decoder) DecodeAll(input, dst []byte) ([]byte, error) {
// if no data was available without blocking.
func (d *Decoder) nextBlock(blocking bool) (ok bool) {
if d.current.d != nil {
- if debug {
+ if debugDecoder {
printf("re-adding current decoder %p", d.current.d)
}
d.decoders <- d.current.d
@@ -391,7 +388,7 @@ func (d *Decoder) nextBlock(blocking bool) (ok bool) {
return false
}
}
- if debug {
+ if debugDecoder {
println("got", len(d.current.b), "bytes, error:", d.current.err)
}
return true
@@ -485,7 +482,7 @@ func (d *Decoder) startStreamDecoder(inStream chan decodeStream) {
defer d.streamWg.Done()
frame := newFrameDec(d.o)
for stream := range inStream {
- if debug {
+ if debugDecoder {
println("got new stream")
}
br := readerWrapper{r: stream.r}
@@ -493,7 +490,7 @@ func (d *Decoder) startStreamDecoder(inStream chan decodeStream) {
for {
frame.history.reset()
err := frame.reset(&br)
- if debug && err != nil {
+ if debugDecoder && err != nil {
println("Frame decoder returned", err)
}
if err == nil && frame.DictionaryID != nil {
@@ -510,7 +507,7 @@ func (d *Decoder) startStreamDecoder(inStream chan decodeStream) {
}
break
}
- if debug {
+ if debugDecoder {
println("starting frame decoder")
}
diff --git a/vendor/github.com/klauspost/compress/zstd/dict.go b/vendor/github.com/klauspost/compress/zstd/dict.go
index fa25a18d8..a36ae83ef 100644
--- a/vendor/github.com/klauspost/compress/zstd/dict.go
+++ b/vendor/github.com/klauspost/compress/zstd/dict.go
@@ -82,7 +82,7 @@ func loadDict(b []byte) (*dict, error) {
println("Transform table error:", err)
return err
}
- if debug {
+ if debugDecoder || debugEncoder {
println("Read table ok", "symbolLen:", dec.symbolLen)
}
// Set decoders as predefined so they aren't reused.
diff --git a/vendor/github.com/klauspost/compress/zstd/enc_best.go b/vendor/github.com/klauspost/compress/zstd/enc_best.go
index dc1eed5f0..b7d4b9004 100644
--- a/vendor/github.com/klauspost/compress/zstd/enc_best.go
+++ b/vendor/github.com/klauspost/compress/zstd/enc_best.go
@@ -132,7 +132,7 @@ func (e *bestFastEncoder) Encode(blk *blockEnc, src []byte) {
}
_ = addLiterals
- if debug {
+ if debugEncoder {
println("recent offsets:", blk.recentOffsets)
}
@@ -274,7 +274,7 @@ encodeLoop:
nextEmit = s
if s >= sLimit {
- if debug {
+ if debugEncoder {
println("repeat ended", s, best.length)
}
@@ -412,7 +412,7 @@ encodeLoop:
blk.recentOffsets[0] = uint32(offset1)
blk.recentOffsets[1] = uint32(offset2)
blk.recentOffsets[2] = uint32(offset3)
- if debug {
+ if debugEncoder {
println("returning, recent offsets:", blk.recentOffsets, "extra literals:", blk.extraLits)
}
}
diff --git a/vendor/github.com/klauspost/compress/zstd/enc_better.go b/vendor/github.com/klauspost/compress/zstd/enc_better.go
index 604954290..eab7b5083 100644
--- a/vendor/github.com/klauspost/compress/zstd/enc_better.go
+++ b/vendor/github.com/klauspost/compress/zstd/enc_better.go
@@ -138,7 +138,7 @@ func (e *betterFastEncoder) Encode(blk *blockEnc, src []byte) {
blk.literals = append(blk.literals, src[nextEmit:until]...)
s.litLen = uint32(until - nextEmit)
}
- if debug {
+ if debugEncoder {
println("recent offsets:", blk.recentOffsets)
}
@@ -204,7 +204,7 @@ encodeLoop:
nextEmit = s
if s >= sLimit {
- if debug {
+ if debugEncoder {
println("repeat ended", s, lenght)
}
@@ -264,7 +264,7 @@ encodeLoop:
s += lenght + repOff2
nextEmit = s
if s >= sLimit {
- if debug {
+ if debugEncoder {
println("repeat ended", s, lenght)
}
@@ -553,7 +553,7 @@ encodeLoop:
}
blk.recentOffsets[0] = uint32(offset1)
blk.recentOffsets[1] = uint32(offset2)
- if debug {
+ if debugEncoder {
println("returning, recent offsets:", blk.recentOffsets, "extra literals:", blk.extraLits)
}
}
@@ -656,7 +656,7 @@ func (e *betterFastEncoderDict) Encode(blk *blockEnc, src []byte) {
blk.literals = append(blk.literals, src[nextEmit:until]...)
s.litLen = uint32(until - nextEmit)
}
- if debug {
+ if debugEncoder {
println("recent offsets:", blk.recentOffsets)
}
@@ -724,7 +724,7 @@ encodeLoop:
nextEmit = s
if s >= sLimit {
- if debug {
+ if debugEncoder {
println("repeat ended", s, lenght)
}
@@ -787,7 +787,7 @@ encodeLoop:
s += lenght + repOff2
nextEmit = s
if s >= sLimit {
- if debug {
+ if debugEncoder {
println("repeat ended", s, lenght)
}
@@ -1084,7 +1084,7 @@ encodeLoop:
}
blk.recentOffsets[0] = uint32(offset1)
blk.recentOffsets[1] = uint32(offset2)
- if debug {
+ if debugEncoder {
println("returning, recent offsets:", blk.recentOffsets, "extra literals:", blk.extraLits)
}
}
diff --git a/vendor/github.com/klauspost/compress/zstd/enc_dfast.go b/vendor/github.com/klauspost/compress/zstd/enc_dfast.go
index 8629d43d8..96b21b90e 100644
--- a/vendor/github.com/klauspost/compress/zstd/enc_dfast.go
+++ b/vendor/github.com/klauspost/compress/zstd/enc_dfast.go
@@ -109,7 +109,7 @@ func (e *doubleFastEncoder) Encode(blk *blockEnc, src []byte) {
blk.literals = append(blk.literals, src[nextEmit:until]...)
s.litLen = uint32(until - nextEmit)
}
- if debug {
+ if debugEncoder {
println("recent offsets:", blk.recentOffsets)
}
@@ -170,7 +170,7 @@ encodeLoop:
s += lenght + repOff
nextEmit = s
if s >= sLimit {
- if debug {
+ if debugEncoder {
println("repeat ended", s, lenght)
}
@@ -368,7 +368,7 @@ encodeLoop:
}
blk.recentOffsets[0] = uint32(offset1)
blk.recentOffsets[1] = uint32(offset2)
- if debug {
+ if debugEncoder {
println("returning, recent offsets:", blk.recentOffsets, "extra literals:", blk.extraLits)
}
}
@@ -427,7 +427,7 @@ func (e *doubleFastEncoder) EncodeNoHist(blk *blockEnc, src []byte) {
blk.literals = append(blk.literals, src[nextEmit:until]...)
s.litLen = uint32(until - nextEmit)
}
- if debug {
+ if debugEncoder {
println("recent offsets:", blk.recentOffsets)
}
@@ -483,7 +483,7 @@ encodeLoop:
s += length + repOff
nextEmit = s
if s >= sLimit {
- if debug {
+ if debugEncoder {
println("repeat ended", s, length)
}
@@ -677,7 +677,7 @@ encodeLoop:
blk.literals = append(blk.literals, src[nextEmit:]...)
blk.extraLits = len(src) - int(nextEmit)
}
- if debug {
+ if debugEncoder {
println("returning, recent offsets:", blk.recentOffsets, "extra literals:", blk.extraLits)
}
@@ -767,7 +767,7 @@ func (e *doubleFastEncoderDict) Encode(blk *blockEnc, src []byte) {
blk.literals = append(blk.literals, src[nextEmit:until]...)
s.litLen = uint32(until - nextEmit)
}
- if debug {
+ if debugEncoder {
println("recent offsets:", blk.recentOffsets)
}
@@ -830,7 +830,7 @@ encodeLoop:
s += lenght + repOff
nextEmit = s
if s >= sLimit {
- if debug {
+ if debugEncoder {
println("repeat ended", s, lenght)
}
@@ -1039,7 +1039,7 @@ encodeLoop:
}
blk.recentOffsets[0] = uint32(offset1)
blk.recentOffsets[1] = uint32(offset2)
- if debug {
+ if debugEncoder {
println("returning, recent offsets:", blk.recentOffsets, "extra literals:", blk.extraLits)
}
// If we encoded more than 64K mark all dirty.
diff --git a/vendor/github.com/klauspost/compress/zstd/enc_fast.go b/vendor/github.com/klauspost/compress/zstd/enc_fast.go
index ba4a17e10..2246d286d 100644
--- a/vendor/github.com/klauspost/compress/zstd/enc_fast.go
+++ b/vendor/github.com/klauspost/compress/zstd/enc_fast.go
@@ -103,7 +103,7 @@ func (e *fastEncoder) Encode(blk *blockEnc, src []byte) {
blk.literals = append(blk.literals, src[nextEmit:until]...)
s.litLen = uint32(until - nextEmit)
}
- if debug {
+ if debugEncoder {
println("recent offsets:", blk.recentOffsets)
}
@@ -178,7 +178,7 @@ encodeLoop:
s += length + 2
nextEmit = s
if s >= sLimit {
- if debug {
+ if debugEncoder {
println("repeat ended", s, length)
}
@@ -330,7 +330,7 @@ encodeLoop:
}
blk.recentOffsets[0] = uint32(offset1)
blk.recentOffsets[1] = uint32(offset2)
- if debug {
+ if debugEncoder {
println("returning, recent offsets:", blk.recentOffsets, "extra literals:", blk.extraLits)
}
}
@@ -343,7 +343,7 @@ func (e *fastEncoder) EncodeNoHist(blk *blockEnc, src []byte) {
inputMargin = 8
minNonLiteralBlockSize = 1 + 1 + inputMargin
)
- if debug {
+ if debugEncoder {
if len(src) > maxBlockSize {
panic("src too big")
}
@@ -391,7 +391,7 @@ func (e *fastEncoder) EncodeNoHist(blk *blockEnc, src []byte) {
blk.literals = append(blk.literals, src[nextEmit:until]...)
s.litLen = uint32(until - nextEmit)
}
- if debug {
+ if debugEncoder {
println("recent offsets:", blk.recentOffsets)
}
@@ -462,7 +462,7 @@ encodeLoop:
s += length + 2
nextEmit = s
if s >= sLimit {
- if debug {
+ if debugEncoder {
println("repeat ended", s, length)
}
@@ -616,7 +616,7 @@ encodeLoop:
blk.literals = append(blk.literals, src[nextEmit:]...)
blk.extraLits = len(src) - int(nextEmit)
}
- if debug {
+ if debugEncoder {
println("returning, recent offsets:", blk.recentOffsets, "extra literals:", blk.extraLits)
}
// We do not store history, so we must offset e.cur to avoid false matches for next user.
@@ -696,7 +696,7 @@ func (e *fastEncoderDict) Encode(blk *blockEnc, src []byte) {
blk.literals = append(blk.literals, src[nextEmit:until]...)
s.litLen = uint32(until - nextEmit)
}
- if debug {
+ if debugEncoder {
println("recent offsets:", blk.recentOffsets)
}
@@ -773,7 +773,7 @@ encodeLoop:
s += length + 2
nextEmit = s
if s >= sLimit {
- if debug {
+ if debugEncoder {
println("repeat ended", s, length)
}
@@ -926,7 +926,7 @@ encodeLoop:
}
blk.recentOffsets[0] = uint32(offset1)
blk.recentOffsets[1] = uint32(offset2)
- if debug {
+ if debugEncoder {
println("returning, recent offsets:", blk.recentOffsets, "extra literals:", blk.extraLits)
}
}
diff --git a/vendor/github.com/klauspost/compress/zstd/encoder.go b/vendor/github.com/klauspost/compress/zstd/encoder.go
index 4871dd03a..ea85548fc 100644
--- a/vendor/github.com/klauspost/compress/zstd/encoder.go
+++ b/vendor/github.com/klauspost/compress/zstd/encoder.go
@@ -245,7 +245,7 @@ func (e *Encoder) nextBlock(final bool) error {
s.filling, s.current, s.previous = s.previous[:0], s.filling, s.current
s.wg.Add(1)
go func(src []byte) {
- if debug {
+ if debugEncoder {
println("Adding block,", len(src), "bytes, final:", final)
}
defer func() {
@@ -290,7 +290,7 @@ func (e *Encoder) nextBlock(final bool) error {
}
switch err {
case errIncompressible:
- if debug {
+ if debugEncoder {
println("Storing incompressible block as raw")
}
blk.encodeRaw(src)
@@ -313,7 +313,7 @@ func (e *Encoder) nextBlock(final bool) error {
//
// The Copy function uses ReaderFrom if available.
func (e *Encoder) ReadFrom(r io.Reader) (n int64, err error) {
- if debug {
+ if debugEncoder {
println("Using ReadFrom")
}
@@ -336,20 +336,20 @@ func (e *Encoder) ReadFrom(r io.Reader) (n int64, err error) {
switch err {
case io.EOF:
e.state.filling = e.state.filling[:len(e.state.filling)-len(src)]
- if debug {
+ if debugEncoder {
println("ReadFrom: got EOF final block:", len(e.state.filling))
}
return n, nil
case nil:
default:
- if debug {
+ if debugEncoder {
println("ReadFrom: got error:", err)
}
e.state.err = err
return n, err
}
if len(src) > 0 {
- if debug {
+ if debugEncoder {
println("ReadFrom: got space left in source:", len(src))
}
continue
@@ -512,7 +512,7 @@ func (e *Encoder) EncodeAll(src, dst []byte) []byte {
switch err {
case errIncompressible:
- if debug {
+ if debugEncoder {
println("Storing incompressible block as raw")
}
dst = blk.encodeRawTo(dst, src)
@@ -548,7 +548,7 @@ func (e *Encoder) EncodeAll(src, dst []byte) []byte {
switch err {
case errIncompressible:
- if debug {
+ if debugEncoder {
println("Storing incompressible block as raw")
}
dst = blk.encodeRawTo(dst, todo)
diff --git a/vendor/github.com/klauspost/compress/zstd/framedec.go b/vendor/github.com/klauspost/compress/zstd/framedec.go
index 4dc151213..e8cc9a2c2 100644
--- a/vendor/github.com/klauspost/compress/zstd/framedec.go
+++ b/vendor/github.com/klauspost/compress/zstd/framedec.go
@@ -78,20 +78,33 @@ func newFrameDec(o decoderOptions) *frameDec {
func (d *frameDec) reset(br byteBuffer) error {
d.HasCheckSum = false
d.WindowSize = 0
- var b []byte
+ var signature [4]byte
for {
var err error
- b, err = br.readSmall(4)
+ // Check if we can read more...
+ b, err := br.readSmall(1)
switch err {
case io.EOF, io.ErrUnexpectedEOF:
return io.EOF
default:
return err
case nil:
+ signature[0] = b[0]
+ }
+ // Read the rest, don't allow io.ErrUnexpectedEOF
+ b, err = br.readSmall(3)
+ switch err {
+ case io.EOF:
+ return io.EOF
+ default:
+ return err
+ case nil:
+ copy(signature[1:], b)
}
- if !bytes.Equal(b[1:4], skippableFrameMagic) || b[0]&0xf0 != 0x50 {
- if debug {
- println("Not skippable", hex.EncodeToString(b), hex.EncodeToString(skippableFrameMagic))
+
+ if !bytes.Equal(signature[1:4], skippableFrameMagic) || signature[0]&0xf0 != 0x50 {
+ if debugDecoder {
+ println("Not skippable", hex.EncodeToString(signature[:]), hex.EncodeToString(skippableFrameMagic))
}
// Break if not skippable frame.
break
@@ -99,28 +112,34 @@ func (d *frameDec) reset(br byteBuffer) error {
// Read size to skip
b, err = br.readSmall(4)
if err != nil {
- println("Reading Frame Size", err)
+ if debugDecoder {
+ println("Reading Frame Size", err)
+ }
return err
}
n := uint32(b[0]) | (uint32(b[1]) << 8) | (uint32(b[2]) << 16) | (uint32(b[3]) << 24)
println("Skipping frame with", n, "bytes.")
err = br.skipN(int(n))
if err != nil {
- if debug {
+ if debugDecoder {
println("Reading discarded frame", err)
}
return err
}
}
- if !bytes.Equal(b, frameMagic) {
- println("Got magic numbers: ", b, "want:", frameMagic)
+ if !bytes.Equal(signature[:], frameMagic) {
+ if debugDecoder {
+ println("Got magic numbers: ", signature, "want:", frameMagic)
+ }
return ErrMagicMismatch
}
// Read Frame_Header_Descriptor
fhd, err := br.readByte()
if err != nil {
- println("Reading Frame_Header_Descriptor", err)
+ if debugDecoder {
+ println("Reading Frame_Header_Descriptor", err)
+ }
return err
}
d.SingleSegment = fhd&(1<<5) != 0
@@ -135,7 +154,9 @@ func (d *frameDec) reset(br byteBuffer) error {
if !d.SingleSegment {
wd, err := br.readByte()
if err != nil {
- println("Reading Window_Descriptor", err)
+ if debugDecoder {
+ println("Reading Window_Descriptor", err)
+ }
return err
}
printf("raw: %x, mantissa: %d, exponent: %d\n", wd, wd&7, wd>>3)
@@ -153,7 +174,7 @@ func (d *frameDec) reset(br byteBuffer) error {
size = 4
}
- b, err = br.readSmall(int(size))
+ b, err := br.readSmall(int(size))
if err != nil {
println("Reading Dictionary_ID", err)
return err
@@ -167,7 +188,7 @@ func (d *frameDec) reset(br byteBuffer) error {
case 4:
id = uint32(b[0]) | (uint32(b[1]) << 8) | (uint32(b[2]) << 16) | (uint32(b[3]) << 24)
}
- if debug {
+ if debugDecoder {
println("Dict size", size, "ID:", id)
}
if id > 0 {
@@ -191,7 +212,7 @@ func (d *frameDec) reset(br byteBuffer) error {
}
d.FrameContentSize = 0
if fcsSize > 0 {
- b, err = br.readSmall(fcsSize)
+ b, err := br.readSmall(fcsSize)
if err != nil {
println("Reading Frame content", err)
return err
@@ -209,7 +230,7 @@ func (d *frameDec) reset(br byteBuffer) error {
d2 := uint32(b[4]) | (uint32(b[5]) << 8) | (uint32(b[6]) << 16) | (uint32(b[7]) << 24)
d.FrameContentSize = uint64(d1) | (uint64(d2) << 32)
}
- if debug {
+ if debugDecoder {
println("field size bits:", v, "fcsSize:", fcsSize, "FrameContentSize:", d.FrameContentSize, hex.EncodeToString(b[:fcsSize]), "singleseg:", d.SingleSegment, "window:", d.WindowSize)
}
}
@@ -252,7 +273,7 @@ func (d *frameDec) reset(br byteBuffer) error {
// next will start decoding the next block from stream.
func (d *frameDec) next(block *blockDec) error {
- if debug {
+ if debugDecoder {
printf("decoding new block %p:%p", block, block.data)
}
err := block.reset(d.rawInput, d.WindowSize)
@@ -263,7 +284,7 @@ func (d *frameDec) next(block *blockDec) error {
return err
}
block.input <- struct{}{}
- if debug {
+ if debugDecoder {
println("next block:", block)
}
d.asyncRunningMu.Lock()
@@ -318,12 +339,12 @@ func (d *frameDec) checkCRC() error {
}
if !bytes.Equal(tmp[:], want) {
- if debug {
+ if debugDecoder {
println("CRC Check Failed:", tmp[:], "!=", want)
}
return ErrCRCMismatch
}
- if debug {
+ if debugDecoder {
println("CRC ok", tmp[:])
}
return nil
@@ -344,7 +365,7 @@ func (d *frameDec) initAsync() {
if cap(d.decoding) < d.o.concurrent {
d.decoding = make(chan *blockDec, d.o.concurrent)
}
- if debug {
+ if debugDecoder {
h := d.history
printf("history init. len: %d, cap: %d", len(h.b), cap(h.b))
}
@@ -392,7 +413,7 @@ func (d *frameDec) startDecoder(output chan decodeOutput) {
output <- r
return
}
- if debug {
+ if debugDecoder {
println("got result, from ", d.offset, "to", d.offset+int64(len(r.b)))
d.offset += int64(len(r.b))
}
@@ -400,7 +421,7 @@ func (d *frameDec) startDecoder(output chan decodeOutput) {
// Send history to next block
select {
case next = <-d.decoding:
- if debug {
+ if debugDecoder {
println("Sending ", len(d.history.b), "bytes as history")
}
next.history <- &d.history
@@ -438,7 +459,7 @@ func (d *frameDec) startDecoder(output chan decodeOutput) {
output <- r
if next == nil {
// There was no decoder available, we wait for one now that we have sent to the writer.
- if debug {
+ if debugDecoder {
println("Sending ", len(d.history.b), " bytes as history")
}
next = <-d.decoding
@@ -462,7 +483,7 @@ func (d *frameDec) runDecoder(dst []byte, dec *blockDec) ([]byte, error) {
if err != nil {
break
}
- if debug {
+ if debugDecoder {
println("next block:", dec)
}
err = dec.decodeBuf(&d.history)
diff --git a/vendor/github.com/klauspost/compress/zstd/fse_encoder.go b/vendor/github.com/klauspost/compress/zstd/fse_encoder.go
index c74681b99..b4757ee3f 100644
--- a/vendor/github.com/klauspost/compress/zstd/fse_encoder.go
+++ b/vendor/github.com/klauspost/compress/zstd/fse_encoder.go
@@ -229,7 +229,7 @@ func (s *fseEncoder) setRLE(val byte) {
deltaFindState: 0,
deltaNbBits: 0,
}
- if debug {
+ if debugEncoder {
println("setRLE: val", val, "symbolTT", s.ct.symbolTT[val])
}
s.rleVal = val
diff --git a/vendor/github.com/klauspost/compress/zstd/snappy.go b/vendor/github.com/klauspost/compress/zstd/snappy.go
index 9d9d1d567..0372b1714 100644
--- a/vendor/github.com/klauspost/compress/zstd/snappy.go
+++ b/vendor/github.com/klauspost/compress/zstd/snappy.go
@@ -203,7 +203,7 @@ func (r *SnappyConverter) Convert(in io.Reader, w io.Writer) (int64, error) {
written += int64(n)
continue
case chunkTypeUncompressedData:
- if debug {
+ if debugEncoder {
println("Uncompressed, chunklen", chunkLen)
}
// Section 4.3. Uncompressed data (chunk type 0x01).
@@ -246,7 +246,7 @@ func (r *SnappyConverter) Convert(in io.Reader, w io.Writer) (int64, error) {
continue
case chunkTypeStreamIdentifier:
- if debug {
+ if debugEncoder {
println("stream id", chunkLen, len(snappyMagicBody))
}
// Section 4.1. Stream identifier (chunk type 0xff).
diff --git a/vendor/github.com/klauspost/compress/zstd/zstd.go b/vendor/github.com/klauspost/compress/zstd/zstd.go
index 1ba308c8b..ef1d49a00 100644
--- a/vendor/github.com/klauspost/compress/zstd/zstd.go
+++ b/vendor/github.com/klauspost/compress/zstd/zstd.go
@@ -15,6 +15,12 @@ import (
// enable debug printing
const debug = false
+// enable encoding debug printing
+const debugEncoder = debug
+
+// enable decoding debug printing
+const debugDecoder = debug
+
// Enable extra assertions.
const debugAsserts = debug || false
@@ -82,13 +88,13 @@ var (
)
func println(a ...interface{}) {
- if debug {
+ if debug || debugDecoder || debugEncoder {
log.Println(a...)
}
}
func printf(format string, a ...interface{}) {
- if debug {
+ if debug || debugDecoder || debugEncoder {
log.Printf(format, a...)
}
}
diff --git a/vendor/github.com/mattn/go-shellwords/shellwords.go b/vendor/github.com/mattn/go-shellwords/shellwords.go
index 01afd94d1..1b42a0017 100644
--- a/vendor/github.com/mattn/go-shellwords/shellwords.go
+++ b/vendor/github.com/mattn/go-shellwords/shellwords.go
@@ -232,7 +232,7 @@ loop:
case '\'':
if !doubleQuoted && !dollarQuote {
if singleQuoted {
- got = argSingle
+ got = argQuoted
}
singleQuoted = !singleQuoted
continue
diff --git a/vendor/modules.txt b/vendor/modules.txt
index a00f1becc..f2a38caca 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -195,7 +195,7 @@ github.com/containers/psgo/internal/dev
github.com/containers/psgo/internal/host
github.com/containers/psgo/internal/proc
github.com/containers/psgo/internal/process
-# github.com/containers/storage v1.32.1
+# github.com/containers/storage v1.32.2
github.com/containers/storage
github.com/containers/storage/drivers
github.com/containers/storage/drivers/aufs
@@ -397,7 +397,7 @@ github.com/json-iterator/go
# github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a
github.com/juju/ansiterm
github.com/juju/ansiterm/tabwriter
-# github.com/klauspost/compress v1.12.3
+# github.com/klauspost/compress v1.13.0
github.com/klauspost/compress/flate
github.com/klauspost/compress/fse
github.com/klauspost/compress/huff0
@@ -417,7 +417,7 @@ github.com/mattn/go-colorable
github.com/mattn/go-isatty
# github.com/mattn/go-runewidth v0.0.12
github.com/mattn/go-runewidth
-# github.com/mattn/go-shellwords v1.0.11
+# github.com/mattn/go-shellwords v1.0.12
github.com/mattn/go-shellwords
# github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369
github.com/matttproud/golang_protobuf_extensions/pbutil