-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fix Makefile to Support Spaces in Paths #4000
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
Conversation
Can this PR be reviewed? We have found that we need this for environments that have a PATH with a space. Thanks! |
I wonder if this change is the reason why tests are failing |
Interesting:
Does this mean that I'm guessing that we also need: diff --git a/Makefile b/Makefile
index 3cc72405..f189183b 100644
--- a/Makefile
+++ b/Makefile
@@ -87,6 +87,7 @@ ifeq ($(shell uname | tr A-Z a-z), linux)
curl -L https://github.com/protocolbuffers/protobuf/releases/download/v>
endif
unzip bin/protoc.zip -d bin/protoc
+ chmod +x bin/protoc
rm bin/protoc.zip
bin/protoc-gen-go: For the second CI failure:
I'm not sure if that's the actual underlying error, but I do see that in the Github Action log. I'm assuming it's from the various calls to But offhand, I can't think of why adding the quotes to the PATH would make Oh, actually, I see this in the log output, too:
Odd. |
I added a commit to this PR that added the I haven't had time to dig into the 2nd failure yet, but I offhand wonder if that failed because protoc previously didn't run...? |
2fe2847
to
326d2bd
Compare
Oops -- had the wrong |
Sorry to bug -- could you authorize the github actions again? Thanks! |
The intent for exporting the SHELL variable is to ensure that all Makefile target comands are run with the amended PATH value that is set via the "export PATH := ..." directive. However, exporting PATH value is all that is necessary to ensure that all target commands run with the amended PATH. It is not necessary to *also* export a SHELL command that explicitly sets the PATH value. Specifically: setting SHELL to use "env" to set the PATH environment variable gets difficult if the PATH includes whitespace. make's assignment right hand side parsing does not treat quotes as delimiters of tokens. For example, the following directive in a Makefile results in the FOO variable having 3 tokens, not 2: FOO := bar "baz yow" Therefore, achieving the overall goal of amending the PATH for all Makefile target commands -- even if the PATH includes whitespace -- is best achieved simply by not exporting the SHELL. Signed-off-by: Ethan Dieterich <ethandieterich@gmail.com> Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
326d2bd
to
246fa79
Compare
It took some digging, but I tracked down what was causing CI to fail, and re-evaluated the solution of this PR. I have pushed a new commit with a full explanation. Here's the commit message: Makefile: Do not export SHELL The intent for exporting the SHELL variable is to ensure that all However, exporting PATH value is all that is necessary to ensure that Specifically: setting SHELL to use "env" to set the PATH environment FOO := bar "baz yow" Therefore, achieving the overall goal of amending the PATH for all Signed-off-by: Ethan Dieterich ethandieterich@gmail.com |
Congrats on the 4000th PR. 🎉 |
Overview
In this branch, I fixed issues my team and I encountered with the Makefile, where it would not function correctly when spaces were present in the path. The issue was traced back to how
PATH
andSHELL
were being set, leading to failures when runningmake
in directories with spaces in their names.What this PR does / why we need it
SHELL
passes thePATH
variable to ensure compatibility with/bin/sh
while keeping the correct environment settings./home/user/My Project/
), wheremake
previously failed due to improper path handling.Special notes for your reviewer