skip hack/tools/vendor folder

The makefiles scripts create a variable with all the go files
that are part of the Kubernetes source tree, including staging.

As today, this variable has a size of < 100kb

wc .make/all_go_dirs.mk
2326  2326 98905 .make/all_go_dirs.mk

This variable is passed as argument in the Makefiles, where it
is expanded. In Linux, there is a limit to the max size of
the arguments MAX_ARG_STRLEN.

If the arguments go above 128k, you get a nice:

execvp: /usr/bin/env: Argument list too long

If you, for whatever reason, do some go mod vendor inside the
hack/tools folder, these files will be added to the variable
and most probably you'll go above the limit and get that error.

Then, you'll learn a lot about Makefils, shell expansion, strace,
execpve, ARG_MAX and MAX_ARG_STRLEN,until you realize what is
the real problem :).
This commit is contained in:
Antonio Ojea 2021-08-26 17:53:16 +02:00
parent 3e10db97d0
commit 2fee0c45e6

View File

@ -39,14 +39,17 @@ function kfind() {
# We want to include the "special" vendor directories which are actually
# part of the Kubernetes source tree (./staging/*) but we need them to be
# named as their ./vendor/* equivalents. Also, we do not want all of
# ./vendor or even all of ./vendor/k8s.io.
# ./vendor , ./hack/tools/vendor or even all of ./vendor/k8s.io.
find -H . \
\( \
-not \( \
\( \
-name '_*' -o \
-name '.[^.]*' -o \
-path './vendor' \
\( \
-name 'vendor' \
-type d \
\) \
\) -prune \
\) \
\) \