From 03db535f908159cf44515ceabcd70733025835e0 Mon Sep 17 00:00:00 2001 From: Lars Lehtonen Date: Wed, 27 Sep 2017 19:16:10 -0700 Subject: [PATCH 1/2] k8s.io/kubernetes/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch: Fix swallowed errors in diffLists() --- .../k8s.io/apimachinery/pkg/util/strategicpatch/patch.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go b/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go index 8884c738ed9..43c6df13e99 100644 --- a/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go +++ b/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go @@ -554,7 +554,13 @@ func diffLists(original, modified []interface{}, t reflect.Type, mergeKey string switch kind { case reflect.Map: patchList, deleteList, err = diffListsOfMaps(original, modified, t, mergeKey, diffOptions) + if err != nil { + return nil, nil, nil, err + } patchList, err = normalizeSliceOrder(patchList, modified, mergeKey, kind) + if err != nil { + return nil, nil, nil, err + } orderSame, err := isOrderSame(original, modified, mergeKey) if err != nil { return nil, nil, nil, err @@ -580,6 +586,9 @@ func diffLists(original, modified []interface{}, t reflect.Type, mergeKey string return nil, nil, nil, mergepatch.ErrNoListOfLists default: patchList, deleteList, err = diffListsOfScalars(original, modified, diffOptions) + if err != nil { + return nil, nil, nil, err + } patchList, err = normalizeSliceOrder(patchList, modified, mergeKey, kind) // generate the setElementOrder list when there are content changes or order changes if diffOptions.SetElementOrder && ((!diffOptions.IgnoreDeletions && len(deleteList) > 0) || From 1bdc6574257d10c553230fc9907548bf58af6fbd Mon Sep 17 00:00:00 2001 From: Lars Lehtonen Date: Wed, 27 Sep 2017 19:16:49 -0700 Subject: [PATCH 2/2] k8s.io/kubernetes/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch: Fix swallowed errors in normalizeSliceOrder() --- .../src/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go b/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go index 43c6df13e99..3fe5907cf80 100644 --- a/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go +++ b/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go @@ -515,6 +515,9 @@ func normalizeSliceOrder(toSort, order []interface{}, mergeKey string, kind refl return nil, err } toSort, toDelete, err = extractToDeleteItems(toSort) + if err != nil { + return nil, err + } } sort.SliceStable(toSort, func(i, j int) bool {