-
Notifications
You must be signed in to change notification settings - Fork 910
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
Makefile
: use xargs -0
consistently
#6706
Conversation
@@ -385,7 +385,7 @@ $(GRPC_GEN)&: cln-grpc/proto/node.proto cln-grpc/proto/primitives.proto | |||
$(PYTHON) -m grpc_tools.protoc -I cln-grpc/proto cln-grpc/proto/node.proto --python_out=$(GRPC_PATH)/ --grpc_python_out=$(GRPC_PATH)/ --experimental_allow_proto3_optional | |||
$(PYTHON) -m grpc_tools.protoc -I cln-grpc/proto cln-grpc/proto/primitives.proto --python_out=$(GRPC_PATH)/ --experimental_allow_proto3_optional | |||
find $(GRPC_DIR)/ -type f -name "*.py" -print0 | xargs -0 sed -i'.bak' -e 's/^import \(.*\)_pb2 as .*__pb2/from pyln.grpc import \1_pb2 as \1__pb2/g' | |||
find $(GRPC_DIR)/ -type f -name "*.py.bak" -print0 | xargs rm -f | |||
find $(GRPC_DIR)/ -type f -name "*.py.bak" -print0 | xargs -0 rm -f |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the actual fix. The other changes are defensive.
Just kidding about 91d48c7. GNU |
Nice change. You kind of blamed the wrong commit (it just added -f to rm, before that was the same issue), but doesn't matter. |
In its default mode, `xargs` interprets any whitespace as a delimiter, and it interprets single and double quotes and backslashes specially. This can play havoc when fed by tools that don't escape these special characters in their output. Fortunately, `xargs` (at least the GNU version of it) has a `-0` option that changes the behavior so that only NUL characters act as delimiters, and no other characters have any special meaning. Use this option consistently to avoid any nasty surprises. Note that `git-ls-files` has a `-z` option that causes it to terminate filenames on output with a NUL character instead of a newline, and `grep` has a `-z` option that causes it to operate on NUL-terminated records rather than on lines. Use these options together with `xargs -0`. Note: This commit corrects an oversight introduced in 9d94687. Changelog-None
7cead08
to
1c2c7e2
Compare
Rebased on latest master to avoid CI brokenness. |
@rustyrussell: How is that? 9d94687 changed |
In its default mode,
xargs
interprets any whitespace as a delimiter, and it interprets single and double quotes and backslashes specially. This can play havoc when fed by tools that don't escape these special characters in their output.Fortunately,
xargs
(at least the GNU and macOS versions of it) has a-0
option that changes the behavior so that only NUL characters act as delimiters, and no other characters have any special meaning. Use this option consistently to avoid any nasty surprises.Note that
git-ls-files
has a-z
option that causes it to terminate filenames on output with a NUL character instead of a newline, andgrep
has a-z
option that causes it to operate on NUL-terminated records rather than on lines. Use these options together withxargs -0
.Note: This commit corrects an oversight introduced in 9d94687.