From 9214f8ab4f1808c2dc5db0381c62517974361873 Mon Sep 17 00:00:00 2001 From: Eric Paris Date: Wed, 19 Oct 2016 11:03:12 -0400 Subject: [PATCH] Make all useage of sort deterministic Lots of places used sort (or sort -u) but didn't set LC_ALL=C. This means it could be slightly different on different people's systems. Make it deterministic. --- Makefile.generated_files | 8 ++++---- hack/grab-profiles.sh | 6 +++--- hack/list-feature-tests.sh | 2 +- hack/make-rules/helpers/cache_go_dirs.sh | 2 +- hack/make-rules/test-integration.sh | 3 +-- hack/make-rules/test.sh | 4 ++-- hack/update-codecgen.sh | 4 ++-- hack/verify-test-images.sh | 4 ++-- 8 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Makefile.generated_files b/Makefile.generated_files index 8861c1a2dc322..278aaa036e10b 100644 --- a/Makefile.generated_files +++ b/Makefile.generated_files @@ -205,7 +205,7 @@ endif DEEPCOPY_DIRS := $(shell \ grep --color=never -l '+k8s:deepcopy-gen=' $(ALL_K8S_TAG_FILES) \ | xargs -n1 dirname \ - | sort -u \ + | LC_ALL=C sort -u \ ) DEEPCOPY_FILES := $(addsuffix /$(DEEPCOPY_FILENAME), $(DEEPCOPY_DIRS)) @@ -318,7 +318,7 @@ endif DEFAULTER_DIRS := $(shell \ grep --color=never -l '+k8s:defaulter-gen=' $(ALL_K8S_TAG_FILES) \ | xargs -n1 dirname \ - | sort -u \ + | LC_ALL=C sort -u \ ) DEFAULTER_FILES := $(addsuffix /$(DEFAULTER_FILENAME), $(DEFAULTER_DIRS)) @@ -448,7 +448,7 @@ endif OPENAPI_DIRS := $(shell \ grep --color=never -l '+k8s:openapi-gen=' $(ALL_K8S_TAG_FILES) \ | xargs -n1 dirname \ - | sort -u \ + | LC_ALL=C sort -u \ ) OPENAPI_OUTFILE := $(OPENAPI_OUTPUT_PKG)/$(OPENAPI_FILENAME) @@ -555,7 +555,7 @@ CONVERSION_DIRS := $(shell \ grep --color=never '^// *+k8s:conversion-gen=' $(ALL_K8S_TAG_FILES) \ | cut -f1 -d: \ | xargs -n1 dirname \ - | sort -u \ + | LC_ALL=C sort -u \ ) CONVERSION_FILES := $(addsuffix /$(CONVERSION_FILENAME), $(CONVERSION_DIRS)) diff --git a/hack/grab-profiles.sh b/hack/grab-profiles.sh index 086890a62b509..a0feecb504710 100755 --- a/hack/grab-profiles.sh +++ b/hack/grab-profiles.sh @@ -249,9 +249,9 @@ SSH_PID=$(pgrep -f "/usr/bin/ssh.*${tunnel_port}:localhost:8080") kube::util::trap_add 'kill $SSH_PID' EXIT kube::util::trap_add 'kill $SSH_PID' SIGTERM -requested_profiles=$(echo ${requested_profiles} | xargs -n1 | sort -u | xargs) -profile_components=$(echo ${profile_components} | xargs -n1 | sort -u | xargs) -kubelet_addreses=$(echo ${kubelet_addreses} | xargs -n1 | sort -u | xargs) +requested_profiles=$(echo ${requested_profiles} | xargs -n1 | LC_ALL=C sort -u | xargs) +profile_components=$(echo ${profile_components} | xargs -n1 | LC_ALL=C sort -u | xargs) +kubelet_addreses=$(echo ${kubelet_addreses} | xargs -n1 | LC_ALL=C sort -u | xargs) echo "requested profiles: ${requested_profiles}" echo "flags for heap profile: ${mem_pprof_flags}" diff --git a/hack/list-feature-tests.sh b/hack/list-feature-tests.sh index 42d47111c5bcd..05a5da5e14e7a 100755 --- a/hack/list-feature-tests.sh +++ b/hack/list-feature-tests.sh @@ -20,4 +20,4 @@ set -o nounset set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE}")/.. -grep "\[Feature:\w+\]" "${KUBE_ROOT}"/test/e2e/*.go -Poh | sort | uniq +grep "\[Feature:\w+\]" "${KUBE_ROOT}"/test/e2e/*.go -Poh | LC_ALL=C sort -u diff --git a/hack/make-rules/helpers/cache_go_dirs.sh b/hack/make-rules/helpers/cache_go_dirs.sh index 128d339b16689..7efc2ee869dd3 100755 --- a/hack/make-rules/helpers/cache_go_dirs.sh +++ b/hack/make-rules/helpers/cache_go_dirs.sh @@ -61,7 +61,7 @@ mkdir -p $(dirname "${CACHE}") if $("${NEED_FIND}"); then kfind -type f -name \*.go \ | xargs -n1 dirname \ - | sort -u \ + | LC_ALL=C sort -u \ | sed 's|^./||' \ > "${CACHE}" fi diff --git a/hack/make-rules/test-integration.sh b/hack/make-rules/test-integration.sh index 3ae07337cac95..075035cfd6904 100755 --- a/hack/make-rules/test-integration.sh +++ b/hack/make-rules/test-integration.sh @@ -43,8 +43,7 @@ kube::test::find_integration_test_dirs() { cd ${KUBE_ROOT} find test/integration/${1-} -name '*_test.go' -print0 \ | xargs -0n1 dirname \ - | uniq \ - | sort -u + | LC_ALL=C sort -u ) } diff --git a/hack/make-rules/test.sh b/hack/make-rules/test.sh index bce6e29851370..db6a3998496b5 100755 --- a/hack/make-rules/test.sh +++ b/hack/make-rules/test.sh @@ -47,12 +47,12 @@ kube::test::find_dirs() { -o -path './staging/*' \ -o -path './vendor/*' \ \) -prune \ - \) -name '*_test.go' -print0 | xargs -0n1 dirname | sed 's|^\./||' | sort -u + \) -name '*_test.go' -print0 | xargs -0n1 dirname | sed 's|^\./||' | LC_ALL=C sort -u find -L . \ -path './_output' -prune \ -o -path './vendor/k8s.io/client-go/*' \ - -name '*_test.go' -print0 | xargs -0n1 dirname | sed 's|^\./||' | sort -u + -name '*_test.go' -print0 | xargs -0n1 dirname | sed 's|^\./||' | LC_ALL=C sort -u ) } diff --git a/hack/update-codecgen.sh b/hack/update-codecgen.sh index 06da0032d8f48..2314d648b542f 100755 --- a/hack/update-codecgen.sh +++ b/hack/update-codecgen.sh @@ -38,7 +38,7 @@ generated_files=($( -o -wholename '*/vendor/*' \ -o -wholename '*/codecgen-*-1234.generated.go' \ \) -prune \ - \) -name '*.generated.go' | sort -r)) + \) -name '*.generated.go' | LC_ALL=C sort -r)) # We only work for deps within this prefix. my_prefix="k8s.io/kubernetes" @@ -67,7 +67,7 @@ for (( i=0; i