Skip to content

Commit

Permalink
image history: fix walking layers
Browse files Browse the repository at this point in the history
libimage did not walk thte layers correctly which was probably
inherited by old Podman code.  Fix that by vendoring in the
corresponding changes in c/common.

Fixes: containers#20375
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
  • Loading branch information
vrothberg committed Oct 17, 2023
1 parent 5853e2b commit 65a74b8
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 31 deletions.
2 changes: 2 additions & 0 deletions go.mod
Expand Up @@ -203,3 +203,5 @@ require (
)

replace github.com/opencontainers/runc => github.com/opencontainers/runc v1.1.1-0.20230904132852-a0466dd76f23

replace github.com/containers/common => github.com/vrothberg/common v0.0.3-0.20231017141812-a043e3b3a8aa
4 changes: 2 additions & 2 deletions go.sum
Expand Up @@ -251,8 +251,6 @@ github.com/containernetworking/plugins v1.3.0 h1:QVNXMT6XloyMUoO2wUOqWTC1hWFV62Q
github.com/containernetworking/plugins v1.3.0/go.mod h1:Pc2wcedTQQCVuROOOaLBPPxrEXqqXBFt3cZ+/yVg6l0=
github.com/containers/buildah v1.32.1-0.20231016164031-ade05159a485 h1:RqgxHW2iP5QJ3aRahT+KGI2aGXVZeZHTeulmeZQV0y0=
github.com/containers/buildah v1.32.1-0.20231016164031-ade05159a485/go.mod h1:gOMfotERP5Gz2pN+AnuM3ephId/YL9DmbOtVck6fWfE=
github.com/containers/common v0.56.1-0.20231013064012-9f2f68b89872 h1:8dydB0ivba6JVt04WuJmTlznJTGZNyQePU8aHqxLTFI=
github.com/containers/common v0.56.1-0.20231013064012-9f2f68b89872/go.mod h1:LM6Uyz5lq80P/DRnhs8NxvPIvBk2zmS2L/oednAGI/s=
github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6JXHGTUje2ZYobNrkg=
github.com/containers/conmon v2.0.20+incompatible/go.mod h1:hgwZ2mtuDrppv78a/cOBNiCm6O0UMWGx1mu7P00nu5I=
github.com/containers/gvisor-tap-vsock v0.7.1 h1:+Rc+sOPplrkQb/BUXeN0ug8TxjgyrIqo/9P/eNS2A4c=
Expand Down Expand Up @@ -1040,6 +1038,8 @@ github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1Y
github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU=
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
github.com/vrothberg/common v0.0.3-0.20231017141812-a043e3b3a8aa h1:NsIa4wo/8ahsywWZnnDVEtTv8LOkkh53oW7NcgxqY64=
github.com/vrothberg/common v0.0.3-0.20231017141812-a043e3b3a8aa/go.mod h1:LM6Uyz5lq80P/DRnhs8NxvPIvBk2zmS2L/oednAGI/s=
github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/history_test.go
Expand Up @@ -63,6 +63,11 @@ var _ = Describe("Podman history", func() {
Expect(session.OutputToString()).ToNot(ContainSubstring("..."))
// the second line in the alpine history contains a command longer than 45 chars
Expect(len(lines[1])).To(BeNumerically(">", 45))

session = podmanTest.Podman([]string{"history", "--no-trunc", "--format", "{{.Size}}", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session).Should(ExitCleanly())
Expect(session.OutputToStringArray()).To(Equal([]string{"0B", "5.84MB"}))
})

It("podman history with json flag", func() {
Expand Down
51 changes: 23 additions & 28 deletions vendor/github.com/containers/common/libimage/history.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion vendor/modules.txt
Expand Up @@ -167,7 +167,7 @@ github.com/containers/buildah/pkg/sshagent
github.com/containers/buildah/pkg/util
github.com/containers/buildah/pkg/volumes
github.com/containers/buildah/util
# github.com/containers/common v0.56.1-0.20231013064012-9f2f68b89872
# github.com/containers/common v0.56.1-0.20231013064012-9f2f68b89872 => github.com/vrothberg/common v0.0.3-0.20231017141812-a043e3b3a8aa
## explicit; go 1.18
github.com/containers/common/libimage
github.com/containers/common/libimage/define
Expand Down Expand Up @@ -1300,3 +1300,4 @@ k8s.io/kubernetes/third_party/forked/golang/expansion
## explicit; go 1.12
sigs.k8s.io/yaml
# github.com/opencontainers/runc => github.com/opencontainers/runc v1.1.1-0.20230904132852-a0466dd76f23
# github.com/containers/common => github.com/vrothberg/common v0.0.3-0.20231017141812-a043e3b3a8aa

0 comments on commit 65a74b8

Please sign in to comment.