-
Notifications
You must be signed in to change notification settings - Fork 36.3k
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
configure: BITCOIN_SUBDIR_TO_INCLUDE: Improve compatibility with paths including space and multiline cpp output #5872
Conversation
…s including space and multiline cpp output
WFM ACK. I need to re-review all the escapes to make I'm happy with it. |
@luke-jr That's pretty hard to read so I'll take your word that it's correct. Can you verify that it's portable, though? Non-gnu sed (*bsd) tends to choke pretty easily. |
Except for the -E option for extended regex syntax, I took care writing the rest avoiding anything that wasn't part of POSIX. As for the -E, it's been used in BFGMiner's configure script for a while including at least one BSD user testing it (and reporting other compatibility issues) - although I'm not certain it was triggered in that scenario. It would be best to have someone verify this on BSD before merging. |
@koobs on freenode tested the sed expression on FreeBSD 9/10/current and confirmed the -E parameter is supported by 8. |
Does it really need all this complexity? If so, I'd prefer something that is more written-out so easier to verify. |
Is there anyone that can review this? |
I've tried in different ways to find reviewers for this, to no avail. No one can review the |
Sadly, agree with @laanwj Closing due to failing to garner review. |
…t to be more readable
Added detailed comments and otherwise improved readability. @theuni and anyone else, can you review? Nothing has changed that should break BSD compatibility, but a BSD tester would be appreciated as well. |
@luke-jr Sorry I didn't get to this before leaving. I'm going to have to clear my head, make peace with the universe, accept mortality, and review this craziness while fresh. But more likely, bored on a plane. The comments are a big help, thanks. Though I have to say, I'm still uneasy relying on something so cryptic, even if it is correct. |
What issues does this solve? @theuni can you review? |
Compatibility with more compilers, and build paths with spaces in them. |
That sounds fairly important. |
Here's an alternative that I'm more comfortable with: theuni@2ef8a6f That completely does away with bitcoin_subdir_to_include.m4, as it was only used to find bdb. Instead of building, asking the compiler what the resulting path was, and adding it to the flags, instead just cut off the subdir that worked and concat it back with the include. Since it already build that way in configure, we can be sure that it will work again during build. Is there any obvious disadvantage? |
Besides being an ugly hack, I'm not sure if that will be practical to make compatible with absolute paths as needed for --bdb-include-dir (every Google result for whether absolute paths are acceptable in includes resulted in advice saying basically "don't do that, use -I") |
I'm not sure what you mean, this wouldn't change the semantics at all. Say bdb lives at /foo/bar/db/db_cxx.h
configure tries a bunch of paths, and lands on this working combo: conftest.cpp:
#include db/db_cxx.h
+
cpp -I/foo/bar conftest and Now as a result, it exports: So the result is the same. I'm not sure what you mean by "whether absolute paths are acceptable", everything in the above example is standard usage. |
I see, so you'd combine -I and #define to find the file. (It's certainly not standard to use a #define in an #include, or you'd not have to jump through 5 extra LOC to do it.. :p) But your solution may still be less uglier than doing this right... especially if nobody is willing to review it. |
@luke-jr Not that I'm unwilling to review, simply unable. That sed program needs its own unit tests :p. I just don't think it's the right tool for the job. I don't like theuni@2ef8a6f either, but at least it's relatively straightforward. |
Going to close this, as this has been open for more than a year and there is no real progress toward it getting merged. |
This fixes a number of bugs in the BITCOIN_SUBDIR_TO_INCLUDE macro:
The new sed takes two steps: