configure.ac: bashism: fix critical existence failure on systems with dash#517
Open
eli-schwartz wants to merge 1 commit intokismetwireless:masterfrom
Open
configure.ac: bashism: fix critical existence failure on systems with dash#517eli-schwartz wants to merge 1 commit intokismetwireless:masterfrom
eli-schwartz wants to merge 1 commit intokismetwireless:masterfrom
Conversation
… dash Remove the consistent use of bashisms. An autoconf generated script is designed to work with POSIX sh, and contains a /bin/sh shebang. As a result, it *cannot* assume it will be run with bash, as it won't be. The bashism in question is the double equals (`==`) operator for the test command. It is actually a bash-specific alias for the single equals operator. It behaves exactly the same, except more confusing. It contains no added functionality and no behavior changes, it is merely an additional alternate spelling. In exchange for doing nothing whatsoever, even in bash, it breaks muscle memory when writing POSIX sh scripts and tricks developers into writing the wrong thing. It is terrible and should never be used under any circumstances. Ideally it would be removed altogether from GNU bash. Fixes the following warnings when running configure: ``` ./configure: 5011: test: x: unexpected operator ./configure: 5014: test: x: unexpected operator ./configure: 5017: test: x: unexpected operator ./configure: 8056: test: nox: unexpected operator ./configure: 8109: test: yesx: unexpected operator ./configure: 8120: test: 3: unexpected operator ./configure: 8144: test: unexpected operator ./configure: 9089: test: stdc++x: unexpected operator ./configure: 9937: test: 0: unexpected operator ./configure: 10084: test: 0: unexpected operator ./configure: 10207: test: 0: unexpected operator ./configure: 10283: test: 0: unexpected operator ./configure: 11363: test: x: unexpected operator ./configure: 11561: test: x: unexpected operator ./configure: 11634: test: xno: unexpected operator ./configure: 11663: test: xno: unexpected operator ./configure: 12490: test: 3: unexpected operator ./configure: 13150: test: no: unexpected operator ./configure: 13167: test: no: unexpected operator ``` And the following fatal errors when trying to compile, since the resulting conditionals failed to define $(PROTOCBIN): ``` make -j8 cpp_out=./protobuf_cpp/ -I protobuf_definitions/ protobuf_definitions/kismet.proto cpp_out=./protobuf_cpp/ -I protobuf_definitions/ protobuf_definitions/http.proto /bin/sh: 1: -I: not found make: [Makefile:808: protobuf_cpp/kismet.pb.h] Error 127 (ignored) cpp_out=./protobuf_cpp/ -I protobuf_definitions/ protobuf_definitions/datasource.proto cpp_out=./protobuf_cpp/ -I protobuf_definitions/ protobuf_definitions/linuxbluetooth.proto /bin/sh: 1: -I: not found make: [Makefile:808: protobuf_cpp/http.pb.h] Error 127 (ignored) cpp_out=./protobuf_cpp/ -I protobuf_definitions/ protobuf_definitions/eventbus.proto /bin/sh: 1: -I: not found make: [Makefile:808: protobuf_cpp/linuxbluetooth.pb.h] Error 127 (ignored) cpp_out=./protobuf_cpp/ -I protobuf_definitions/ protobuf_definitions/kismet.proto /bin/sh: 1: -I: not found cpp_out=./protobuf_cpp/ -I protobuf_definitions/ protobuf_definitions/http.proto /bin/sh: 1: -I: not found /bin/sh: 1: -I: not found make: [Makefile:808: protobuf_cpp/datasource.pb.h] Error 127 (ignored) make: [Makefile:808: protobuf_cpp/eventbus.pb.h] Error 127 (ignored) make: [Makefile:806: protobuf_cpp/kismet.pb.cc] Error 127 (ignored) cpp_out=./protobuf_cpp/ -I protobuf_definitions/ protobuf_definitions/datasource.proto cpp_out=./protobuf_cpp/ -I protobuf_definitions/ protobuf_definitions/linuxbluetooth.proto cpp_out=./protobuf_cpp/ -I protobuf_definitions/ protobuf_definitions/eventbus.proto /bin/sh: 1: -I: not found ``` For extra interest, the failing command begins with `--flag` i.e. a flag passed to protoc, which Make then interprets as "ignore errors for this command", which means output files are not created but the build then continues and produces significantly more confusing errors such as: ``` kis_external.h:51:10: fatal error: protobuf_cpp/kismet.pb.h: No such file or directory ```
8d58c21 to
177d20d
Compare
Author
|
Hi, I've rebased against git master so the changes still apply. |
Author
|
@dragorn is there anything outstanding I need to do to get this merged? The current state of affairs makes it quite challenging to build kismet on my system... |
Author
|
ping? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove the consistent use of bashisms. An autoconf generated script is designed to work with POSIX sh, and contains a /bin/sh shebang. As a result, it cannot assume it will be run with bash, as it won't be.
The bashism in question is the double equals (
==) operator for the test command. It is actually a bash-specific alias for the single equals operator. It behaves exactly the same, except more confusing. It contains no added functionality and no behavior changes, it is merely an additional alternate spelling. In exchange for doing nothing whatsoever, even in bash, it breaks muscle memory when writing POSIX sh scripts and tricks developers into writing the wrong thing.It is terrible and should never be used under any circumstances. Ideally it would be removed altogether from GNU bash.
Fixes the following warnings when running configure:
And the following fatal errors when trying to compile, since the resulting conditionals failed to define $(PROTOCBIN):
For extra interest, the failing command begins with
--flagi.e. a flag passed to protoc, which Make then interprets as "ignore errors for this command", which means output files are not created but the build then continues and produces significantly more confusing errors such as: