Skip to content

Commit

Permalink
Replace deepcopy on history results
Browse files Browse the repository at this point in the history
the deepcopy in the remote history code path was throwing an uncaught error on a type mismatch.  we now manually do the conversion and fix the type mismatch on the fly.

Fixes: containers#7122

Signed-off-by: Brent Baude <bbaude@redhat.com>
  • Loading branch information
baude authored and mheon committed Aug 17, 2020
1 parent 35bb621 commit 9570fd7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 11 additions & 2 deletions pkg/domain/infra/tunnel/images.go
Expand Up @@ -9,6 +9,7 @@ import (
"os"
"path/filepath"
"strings"
"time"

"github.com/containers/common/pkg/config"
"github.com/containers/image/v5/docker/reference"
Expand Down Expand Up @@ -65,8 +66,16 @@ func (ir *ImageEngine) History(ctx context.Context, nameOrID string, opts entiti
}

for i, layer := range results {
hold := entities.ImageHistoryLayer{}
_ = utils.DeepCopy(&hold, layer)
// Created time comes over as an int64 so needs conversion to time.time
t := time.Unix(layer.Created, 0)
hold := entities.ImageHistoryLayer{
ID: layer.ID,
Created: t.UTC(),
CreatedBy: layer.CreatedBy,
Tags: layer.Tags,
Size: layer.Size,
Comment: layer.Comment,
}
history.Layers[i] = hold
}
return &history, nil
Expand Down
2 changes: 0 additions & 2 deletions test/system/110-history.bats
Expand Up @@ -3,8 +3,6 @@
load helpers

@test "podman history - basic tests" {
skip_if_remote "FIXME: pending #7122"

tests="
| .*[0-9a-f]\\\{12\\\} .* CMD .* LABEL
--format '{{.ID}} {{.Created}}' | .*[0-9a-f]\\\{12\\\} .* ago
Expand Down

0 comments on commit 9570fd7

Please sign in to comment.