Fix lack of warning of unrecognized section names#15335
Fix lack of warning of unrecognized section names#15335maflcko merged 1 commit intobitcoin:masterfrom
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
If #14866 will be merged before this PR, I will drop the bug-fix code (system.cpp) , but leave the test code. |
|
utACK f7b0e60eac70fde74684ac406967c38ba8308679 |
|
test-nit: Wouldn't it be cleaner to also clear them in |
|
@MarcoFalke Thank you for your review. I think removing includeconf=~ from including file rather than making both 2 included file empty is another idea. |
|
Concept ACK. I wonder if it should warn unrecognized sections per file (section + file + line)? It also avoid duplicate warns but maybe it shouldn't. |
|
@AkioNak The unit tests don't read from files, but from strings. Since you moved the |
|
@promag Thank you for your review. I did not focus on that behavior. Will address. |
|
@MarcoFalke Thanks! I understand. I will check the unit test code and add to call the |
|
The tests are passing without the |
|
@promag @MarcoFalke Addressed. Both CI checks have failed: Appveyou -> Many linker error occurred. they are almost Travis CI -> The Compile time was over 25min for each failed jobs. I think it is not related to this change. edited: |
promag
left a comment
There was a problem hiding this comment.
utACK 53b7a25. Needs squash.
src/util/system.h
Outdated
There was a problem hiding this comment.
Why is the argument called label when in the SectionInfo it's file? I'd name it filepath.
There was a problem hiding this comment.
I thought it might not only be a file stream. (unit test uses std::istringstream).
But now I agree that filepath is better than label. Fixed.
src/util/system.h
Outdated
There was a problem hiding this comment.
nit, I think these should have m_ prefix? Developer notes mentions:
- Class member variables have a `m_` prefix.
src/util/system.cpp
Outdated
src/util/system.cpp
Outdated
There was a problem hiding this comment.
Use better variable name. Maybe also drop auto.
There was a problem hiding this comment.
@promag I cannot drop auto simply. I am happy if you explain a little more.
There was a problem hiding this comment.
I mean, could have explicit type.
There was a problem hiding this comment.
Thanks. I understand.
Addressed.
src/util/system.cpp
Outdated
There was a problem hiding this comment.
Fixed : parameter for lambda function.
src/util/system.cpp
Outdated
53b7a25 to
6fffaec
Compare
|
re-utACK 6fffaec0e72c21 |
promag
left a comment
There was a problem hiding this comment.
utACK 6fffaec0e72c214d538ef50c337950b4c92ccd57, will test.
1. Fix lack of warning by collecting all section names by moving m_config_sections.clear() to ArgsManager::ReadConfigFiles(). 2. Add info(file name, line number) to warning message. 3. Add a test code to confirm this situation. 3. Do clear() in ReadConfigString().
6fffaec to
1a7ba84
Compare
|
re-utACK 1a7ba84 |
|
Tested ACK 1a7ba84. |
1a7ba84 Fix lack of warning of unrecognized section names (Akio Nakamura) Pull request description: In bitcoin#14708, It was introduced that to warn when unrecognized section names are exist in the config file. But ```m_config_sections.clear()``` in ```ArgsManager::ReadConfigStream()``` is called every time when reading each configuration file, so it can warn about only last reading file if ```includeconf``` exists. This PR fix lack of warning by collecting all section names by moving ```m_config_sections.clear()``` to ```ArgsManager::ReadConfigFiles()``` . Also add a test code to confirm this situation. Tree-SHA512: 26aa0cbe3e4ae2e58cbe73d4492ee5cf465fd4c3e5df2c8ca7e282b627df9e637267af1e3816386b1dc6db2398b31936925ce0e432219fec3a9b3398f01e3e65
Summary: 1a7ba84e11 Fix lack of warning of unrecognized section names (Akio Nakamura) Pull request description: In #14708, It was introduced that to warn when unrecognized section names are exist in the config file. But ```m_config_sections.clear()``` in ```ArgsManager::ReadConfigStream()``` is called every time when reading each configuration file, so it can warn about only last reading file if ```includeconf``` exists. This PR fix lack of warning by collecting all section names by moving ```m_config_sections.clear()``` to ```ArgsManager::ReadConfigFiles()``` . Also add a test code to confirm this situation. Tree-SHA512: 26aa0cbe3e4ae2e58cbe73d4492ee5cf465fd4c3e5df2c8ca7e282b627df9e637267af1e3816386b1dc6db2398b31936925ce0e432219fec3a9b3398f01e3e65 --- Depends on D5757 This is a backport of Core [[bitcoin/bitcoin#15335 | PR15335]] Test Plan: ninja check test_runner.py feature_config_args.py Reviewers: deadalnix, #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D5758
Summary: 1a7ba84e11 Fix lack of warning of unrecognized section names (Akio Nakamura) Pull request description: In #14708, It was introduced that to warn when unrecognized section names are exist in the config file. But ```m_config_sections.clear()``` in ```ArgsManager::ReadConfigStream()``` is called every time when reading each configuration file, so it can warn about only last reading file if ```includeconf``` exists. This PR fix lack of warning by collecting all section names by moving ```m_config_sections.clear()``` to ```ArgsManager::ReadConfigFiles()``` . Also add a test code to confirm this situation. Tree-SHA512: 26aa0cbe3e4ae2e58cbe73d4492ee5cf465fd4c3e5df2c8ca7e282b627df9e637267af1e3816386b1dc6db2398b31936925ce0e432219fec3a9b3398f01e3e65 --- Depends on D5757 This is a backport of Core [[bitcoin/bitcoin#15335 | PR15335]] Test Plan: - ninja check - test_runner.py feature_config_args.py Reviewers: deadalnix, #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D5758
1. Fix lack of warning by collecting all section names by moving m_config_sections.clear() to ArgsManager::ReadConfigFiles(). 2. Add info(file name, line number) to warning message. 3. Add a test code to confirm this situation. 3. Do clear() in ReadConfigString().
1a7ba84 Fix lack of warning of unrecognized section names (Akio Nakamura) Pull request description: In bitcoin#14708, It was introduced that to warn when unrecognized section names are exist in the config file. But ```m_config_sections.clear()``` in ```ArgsManager::ReadConfigStream()``` is called every time when reading each configuration file, so it can warn about only last reading file if ```includeconf``` exists. This PR fix lack of warning by collecting all section names by moving ```m_config_sections.clear()``` to ```ArgsManager::ReadConfigFiles()``` . Also add a test code to confirm this situation. Tree-SHA512: 26aa0cbe3e4ae2e58cbe73d4492ee5cf465fd4c3e5df2c8ca7e282b627df9e637267af1e3816386b1dc6db2398b31936925ce0e432219fec3a9b3398f01e3e65
1a7ba84 Fix lack of warning of unrecognized section names (Akio Nakamura) Pull request description: In bitcoin#14708, It was introduced that to warn when unrecognized section names are exist in the config file. But ```m_config_sections.clear()``` in ```ArgsManager::ReadConfigStream()``` is called every time when reading each configuration file, so it can warn about only last reading file if ```includeconf``` exists. This PR fix lack of warning by collecting all section names by moving ```m_config_sections.clear()``` to ```ArgsManager::ReadConfigFiles()``` . Also add a test code to confirm this situation. Tree-SHA512: 26aa0cbe3e4ae2e58cbe73d4492ee5cf465fd4c3e5df2c8ca7e282b627df9e637267af1e3816386b1dc6db2398b31936925ce0e432219fec3a9b3398f01e3e65
In #14708, It was introduced that to warn when unrecognized section names are exist in the config file.
But
m_config_sections.clear()inArgsManager::ReadConfigStream()is called every time when reading each configuration file, so it can warn about only last reading file ifincludeconfexists.This PR fix lack of warning by collecting all section names by moving
m_config_sections.clear()toArgsManager::ReadConfigFiles().Also add a test code to confirm this situation.