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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a make clean regression #77137

Merged
merged 1 commit into from
May 1, 2019

Conversation

Huang-Wei
Copy link
Member

What type of PR is this?

/kind bug
/assign @BenTheElder

What this PR does / why we need it:

There is a regression introduced in #76840:

root@k8s-bm:~/go/src/k8s.io/kubernetes# make clean
+++ [0426 13:51:42] Verifying Prerequisites....
hack/make-rules/clean.sh: line 33: match: unbound variable
Makefile:345: recipe for target 'clean' failed
make: *** [clean] Error 1

We shouldn't put "match" as a delimiter (followed by -d). IMO a delimiter other than newline (default) is unnecessary in this case.

With this PR, the bug can be fixed:

root@k8s-bm:~/go/src/k8s.io/kubernetes# make clean
+++ [0426 13:52:09] Verifying Prerequisites....
Removing test/e2e/generated/bindata.go ..

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 26, 2019
@Huang-Wei
Copy link
Member Author

/sig testing

@k8s-ci-robot k8s-ci-robot added sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Apr 26, 2019
Copy link
Contributor

@fejta fejta left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fejta, Huang-Wei

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 Apr 26, 2019
@@ -29,7 +29,7 @@ CLEAN_PATTERNS=(
)

for pattern in "${CLEAN_PATTERNS[@]}"; do
while IFS=$'\n' read -r -d match; do
while IFS=$'\n' read -r match; do
echo "Removing ${match#${KUBE_ROOT}\/} .."
rm -rf "${match#${KUBE_ROOT}\/}"
done < <(find "${KUBE_ROOT}" -iregex "^${KUBE_ROOT}/${pattern}$")
Copy link
Member

Choose a reason for hiding this comment

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

We should probably use -print0 and use this as the delimiter.

Copy link
Member Author

@Huang-Wei Huang-Wei Apr 26, 2019

Choose a reason for hiding this comment

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

@BenTheElder do you mean (1) eliminate IFS (2) append -print0 in "find" clause, and (3) use $'\0' as delimiter?

diff --git a/hack/make-rules/clean.sh b/hack/make-rules/clean.sh
index 9305c8df6c..9e85c3f879 100755
--- a/hack/make-rules/clean.sh
+++ b/hack/make-rules/clean.sh
@@ -29,10 +29,10 @@ CLEAN_PATTERNS=(
 )
 
 for pattern in "${CLEAN_PATTERNS[@]}"; do
-  while IFS=$'\n' read -r match; do
+  while read -r -d $'\0' match; do
     echo "Removing ${match#${KUBE_ROOT}\/} .."
     rm -rf "${match#${KUBE_ROOT}\/}"
-  done <   <(find "${KUBE_ROOT}" -iregex "^${KUBE_ROOT}/${pattern}$")
+  done < <(find "${KUBE_ROOT}" -iregex "^${KUBE_ROOT}/${pattern}$" -print0)
 done
 
 # ex: ts=2 sw=2 et filetype=sh

@Huang-Wei
Copy link
Member Author

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 26, 2019
@Huang-Wei
Copy link
Member Author

/hold cancel
unless we have a strong desire to go towards #77137 (comment)

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 1, 2019
@k8s-ci-robot k8s-ci-robot merged commit 576ec2c into kubernetes:master May 1, 2019
@Huang-Wei Huang-Wei deleted the make-clean-regression branch May 2, 2019 00:46
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/bug Categorizes issue or PR as related to a bug. 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. 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