Skip to content

Commit 70499e3

Browse files
committed
Changed to use "wc -c" to ensure the command works on both Linux and Mac OS X with a single implementation
1 parent c16dc72 commit 70499e3

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

hack/verify-file-sizes.sh

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,6 @@ cd "${KUBE_ROOT}"
2424
# Files larger than 1MB need to be allowed explicitly.
2525
maxsize=$((1 * 1024 * 1024))
2626

27-
run_stat() {
28-
local file="$1"
29-
case "$(uname -s)" in
30-
Darwin)
31-
stat -f %z "$file" | tr -d '\n'
32-
;;
33-
Linux)
34-
stat --printf=%s "$file"
35-
;;
36-
*)
37-
kube::log::error "Unsupported host OS. Must be Linux or Mac OS X."
38-
exit 1
39-
;;
40-
esac
41-
}
42-
4327
# Sorted list of those exceptions.
4428
allowlist=(
4529
staging/src/k8s.io/kubectl/images/kubectl-logo-full.png
@@ -58,7 +42,7 @@ largefiles () {
5842
case "$tree" in
5943
w/-text)
6044
# Only binary files have a size limit.
61-
size="$(run_stat "$file")"
45+
size="$(wc -c < "$file")"
6246
if [ "${size}" -gt "$maxsize" ] &&
6347
! kube::util::array_contains "$file" "${allowlist[@]}"; then
6448
echo "$file is too large ($size bytes)"

0 commit comments

Comments
 (0)