common: inf and NaN are invalid in JSON#57695
Conversation
|
@batrick do you want to review this? |
3468f5a to
81e2164
Compare
batrick
left a comment
There was a problem hiding this comment.
Commit title JSON Parser does not allow inf and NaN. Converted it to null. to common/Formatter: dump inf/nan as strings
d3a9b4e to
b3beee4
Compare
|
Is this PR going for the test? Also I think we need to backport this PR. #57392 |
|
jenkins test make check arm64 |
src/common/Formatter.cc
Outdated
| template <class T> | ||
| void JSONFormatter::add_value(std::string_view name, double val) { | ||
| CachedStackStringStream css; | ||
| if (std::isinf(val) || std::isnan(val)) { |
There was a problem hiding this comment.
Would the shorter !std::isfinite(val) form work here?
There was a problem hiding this comment.
Sorry, missed your comment somehow.
It does work but do you have any special observation for using that instead of std::isinf(val) ?
There was a problem hiding this comment.
It's shorter, expresses the intent more directly, enumerates goodness not badness,... i.e. purely aesthetical reasons.
|
jenkins test make check |
|
jenkins test docs |
|
jenkins test api |
|
jenkins test windows |
|
jenkins test make check arm64 |
|
jenkins test api |
src/common/Formatter.h
Outdated
| void add_value(std::string_view name, double val); | ||
|
|
||
| template <class T> | ||
| template <typename T> |
| } | ||
| } | ||
|
|
||
| template <class T> |
| EXPECT_EQ(parser.find_obj("negative_infinity")->get_data(), "null"); | ||
| EXPECT_EQ(parser.find_obj("nan_val")->get_data(), "null"); | ||
| EXPECT_EQ(parser.find_obj("nan_val_alt")->get_data(), "null"); | ||
| } No newline at end of file |
Fixes: https://tracker.ceph.com/issues/66215 Signed-off-by: Md Mahamudur Rahaman Sajib <mahamudur.sajib@croit.io>
|
jenkins test make check |
1 similar comment
|
jenkins test make check |
|
jenkins test api |
|
@batrick Is there anything I need to do in this PR? |
| EXPECT_EQ(parser.find_obj("negative_infinity")->get_data(), "null"); | ||
| EXPECT_EQ(parser.find_obj("nan_val")->get_data(), "null"); | ||
| EXPECT_EQ(parser.find_obj("nan_val_alt")->get_data(), "null"); | ||
| } |
There was a problem hiding this comment.
please verify double_max/double_min values as well
|
@sajibreadd did you mean to close this? Please reopen? |
Here is some mistake I did. I merged main into the branch by mistake(by syncing the fork by mistake). As there is a lot of commit to drop that's why here is the things I have done,
Now github is not allowing me to reopen the PR. Apologies for the mistakes. Now what should be the best things to do? create another PR and have reference of this PR? |
Fixes: https://tracker.ceph.com/issues/66215
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e