From 2a524fcaec4e6f66461d7cdda1bb73ed7c50f026 Mon Sep 17 00:00:00 2001 From: Brent Baude Date: Wed, 15 Dec 2021 13:32:57 -0600 Subject: fix healthcheck timeouts and ut8 coercion this commit fixes two bugs and adds regression tests. when getting healthcheck values from an image, if the image does not have a timeout defined, this resulted in a 0 value for timeout. The default as described in the man pages is 30s. when inspecting a container with a healthcheck command, a customer observed that the &, <, and > characters were being converted into a unicode escape value. It turns out json marshalling will by default coerce string values to ut8. Fixes: bz2028408 Signed-off-by: Brent Baude --- cmd/podman/inspect/inspect.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'cmd/podman/inspect/inspect.go') diff --git a/cmd/podman/inspect/inspect.go b/cmd/podman/inspect/inspect.go index c982b1b7f..482b616af 100644 --- a/cmd/podman/inspect/inspect.go +++ b/cmd/podman/inspect/inspect.go @@ -237,12 +237,12 @@ func (i *inspector) inspect(namesOrIDs []string) error { } func printJSON(data []interface{}) error { - buf, err := json.MarshalIndent(data, "", " ") - if err != nil { - return err - } - _, err = fmt.Println(string(buf)) - return err + enc := json.NewEncoder(os.Stdout) + // by default, json marshallers will force utf=8 from + // a string. this breaks healthchecks that use <,>, &&. + enc.SetEscapeHTML(false) + enc.SetIndent("", " ") + return enc.Encode(data) } func printTmpl(typ, row string, data []interface{}) error { -- cgit v1.2.3-54-g00ecf