-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix a case where ripple::Expected returned a json array, not a value #4401
Fix a case where ripple::Expected returned a json array, not a value #4401
Conversation
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.
👍 LGTM
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.
Subtle!
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.
I approved too quickly.
Using boost 1.77 I'm getting this link-time error:
[ 16%] Linking CXX executable rippled
Undefined symbols for architecture x86_64:
"boost::json::value::value(boost::json::value&&)", referenced from:
ripple::test::Expected_test::run()::'lambda9'()::operator()() const in Expected_test.cpp.o
"boost::json::value::~value()", referenced from:
ripple::test::Expected_test::run() in Expected_test.cpp.o
ripple::test::Expected_test::run()::'lambda9'()::operator()() const in Expected_test.cpp.o
"boost::json::object::object(boost::json::object&&)", referenced from:
ripple::test::Expected_test::run()::'lambda9'()::operator()() const in Expected_test.cpp.o
"boost::json::object::object(std::initializer_list<std::__1::pair<boost::basic_string_view<char, std::__1::char_traits<char> >, boost::json::value_ref> >, unsigned long, boost::json::storage_ptr)", referenced from:
ripple::test::Expected_test::run()::'lambda9'()::operator()() const in Expected_test.cpp.o
"boost::json::object::~object()", referenced from:
ripple::test::Expected_test::run()::'lambda9'()::operator()() const in Expected_test.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [rippled] Error 1
make[1]: *** [CMakeFiles/rippled.dir/all] Error 2
make: *** [all] Error 2
It appears to be a boost error. Investigating...
49cdad1
to
42417f7
Compare
I'm using boost 1_75_0 and it's building for me. I'll be interested to hear what you discover @HowardHinnant. |
I just replicated my link error with boost 1.75. I'm beginning to suspect a compiler or linker error as my machine has been updated to use a beta developer tools (without my consent). I have another machine I can set up. Moving to that... |
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.
I have a new trusted development machine that correctly compiles, links and unittests this! 🎉 Sorry for the delay.
@HowardHinnant, thanks for being thorough. Marked as Passed. |
(not blocking on @godexsoft; just tagging for visibility) |
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.
LGTM 🚀
Suggested commit message:
|
I'm not a fan of this commit message style. I still use https://cbea.ms/git-commit/ as sort of the "git commit message bible". If the goal is to write shorter subject lines and include the PR number, how about something like:
|
Given the two suggested commit messages, I feel like the one suggested by @ximinez is a bit too terse. I'm fine with the one suggested by @intelliot however. And I appreciate how both of them managed the line lengths 😄 |
Oh, I should have been clearer - that was just the subject line. The rest of the body was fine. |
High Level Overview of Change
@godexsoft reported a problem with the
ripple::Expected
implementation and provided a proposed fix. The problem is that there are conditions whereExpected
invokes the wrong constructor for the expected type. A constructor that takes multiple arguments might be interpreted as an array.The proposed fix was a minor adjustment to three constructors that replaces the use of curly braces with parens.
A unit test also came along for the ride.
This pull request incorporates the suggested fix and the unit test into the rippled code base.
Context of Change
Clio is using
ripple::Expected
and had a problem. This change makesExpected
useable for Clio.Type of Change