From 1da897d505717d2cc5fecca06ac2c22ebe2bc9b3 Mon Sep 17 00:00:00 2001 From: Qi Wang Date: Sun, 4 Aug 2019 09:53:14 -0400 Subject: fix system df crashes on unnamed images if the image is unnamed, pass an nil slice to the parse repotags function instead of getting the image name by index. after this patch, unnamed images will be shown as ``` Images space usage: REPOSITORY TAG IMAGE ID CREATED SIZE SHARED SIZE UNIQUE SIZE CONTAINERS docker.io/library/ubuntu bionic 3556258649b2 11 days ago 66.6MB 0B 66.6MB 0 dd8a8db2c79b 11 days ago 986MB 66.6MB 919MB 0 ``` Signed-off-by: Qi Wang --- cmd/podman/system_df.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cmd/podman') diff --git a/cmd/podman/system_df.go b/cmd/podman/system_df.go index 6b9824a79..44582a802 100644 --- a/cmd/podman/system_df.go +++ b/cmd/podman/system_df.go @@ -460,11 +460,11 @@ func getImageVerboseDiskUsage(ctx context.Context, images []*image.Image, images } var repo string var tag string - if len(img.Names()) == 0 { - repo = "" - tag = "" + var repotags []string + if len(img.Names()) != 0 { + repotags = []string{img.Names()[0]} } - repopairs, err := image.ReposToMap([]string{img.Names()[0]}) + repopairs, err := image.ReposToMap(repotags) if err != nil { logrus.Errorf("error finding tag/digest for %s", img.ID()) } -- cgit v1.2.3-54-g00ecf