Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip hack/tools/vendor folder #104610

Merged
merged 1 commit into from
Aug 27, 2021

Conversation

aojea
Copy link
Member

@aojea aojea commented Aug 26, 2021

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, (depends on the kernel, by default #define MAX_ARG_STRLEN (PAGE_SIZE * 32))
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 :).

/kind cleanup

NONE

How to reproduce it

$ cd hack/tools/
$ go mod vendor
$ git status
nothing to commit, working tree clean
$ cd -
$ make
make[1]: execvp: /usr/bin/env: Argument list too long
$ grep hack/tools/vendor .make/all_go_dirs.mk  | wc
    575     575   32739

Special notes

I know that nobody should vendor anything in that hack/tools/ folder, and I did it only to experiment with some things, but the fact that make clean don't delete the folder and git status doesn't report nothing made me spend more than 3 hours with this 馃檭

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Aug 26, 2021
@k8s-ci-robot
Copy link
Contributor

@aojea: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Aug 26, 2021
@aojea
Copy link
Member Author

aojea commented Aug 26, 2021

/assign @BenTheElder @thockin

-name '_*' -o \
-name '.[^.]*' -o \
-path './vendor' -o \
-path './hack/tools/vendor' \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this instead:

   find -H .                      \
        \(                         \
        -not \(                    \
            \(                     \
                -name '_*' -o      \
                -name '.[^.]*' -o  \
                \(                 \
                  -name 'vendor'   \
                  -type d          \
                \)                 \
            \) -prune              \
        \)                         \
        \)                         \

That will exclude ALL vendor directories, wherever they might pop up

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to do that but I was not confident

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any conflict with staging?

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 :).
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 26, 2021
@thockin
Copy link
Member

thockin commented Aug 26, 2021

Thanks!

/lgtm
/approve
/retest

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 26, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aojea, thockin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 26, 2021
@aojea
Copy link
Member Author

aojea commented Aug 27, 2021

/sig testing

@k8s-ci-robot k8s-ci-robot added sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Aug 27, 2021
@k8s-ci-robot k8s-ci-robot merged commit cb520ca into kubernetes:master Aug 27, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.23 milestone Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants