Skip to content

Conversation

@AkioNak
Copy link
Contributor

@AkioNak AkioNak commented Feb 4, 2019

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.

@DrahtBot
Copy link
Contributor

DrahtBot commented Feb 4, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #14866 (Improve property evaluation way in bitcoin.conf by AkioNak)

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.

@AkioNak
Copy link
Contributor Author

AkioNak commented Feb 4, 2019

If #14866 will be merged before this PR, I will drop the bug-fix code (system.cpp) , but leave the test code.

@maflcko
Copy link
Member

maflcko commented Feb 4, 2019

utACK f7b0e60eac70fde74684ac406967c38ba8308679

@maflcko
Copy link
Member

maflcko commented Feb 4, 2019

test-nit: Wouldn't it be cleaner to also clear them in ReadConfigString?

@AkioNak
Copy link
Contributor Author

AkioNak commented Feb 5, 2019

@MarcoFalke Thank you for your review.
I'm sorry, but I don't understand. Is ReadConfigString related to this Python test?

I think removing includeconf=~ from including file rather than making both 2 included file empty is another idea.

@promag
Copy link
Contributor

promag commented Feb 5, 2019

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.

@maflcko
Copy link
Member

maflcko commented Feb 5, 2019

@AkioNak The unit tests don't read from files, but from strings. Since you moved the clear() to the method that reads files, it would no longer be called in the unit tests.

@AkioNak
Copy link
Contributor Author

AkioNak commented Feb 5, 2019

@promag Thank you for your review. I did not focus on that behavior. Will address.

@AkioNak
Copy link
Contributor Author

AkioNak commented Feb 5, 2019

@MarcoFalke Thanks! I understand. I will check the unit test code and add to call the clear() .

@maflcko
Copy link
Member

maflcko commented Feb 5, 2019

The tests are passing without the clear(), but I guess the state might be dirty (haven't actually checked) and future tests might break unexpectedly.

@AkioNak
Copy link
Contributor Author

AkioNak commented Feb 6, 2019

@promag @MarcoFalke Addressed.

Both CI checks have failed:

Appveyou -> Many linker error occurred. they are almost unresolved external symbols. but now I don't know what's wrong.
https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/22165173

Travis CI -> The Compile time was over 25min for each failed jobs. I think it is not related to this change.
https://travis-ci.org/bitcoin/bitcoin/builds/489501276?utm_source=github_status&utm_medium=notification


edited:
All checks have passed. Thanks for someone who restart them.

Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 53b7a25. Needs squash.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the argument called label when in the SectionInfo it's file? I'd name it filepath.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, I think these should have m_ prefix? Developer notes mentions:

- Class member variables have a `m_` prefix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Fixed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use emplace_back?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Addressed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use better variable name. Maybe also drop auto.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@promag I cannot drop auto simply. I am happy if you explain a little more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, could have explicit type.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I understand.
Addressed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use better variable name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed : parameter for lambda function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also emplace_back.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Addressed.

@maflcko
Copy link
Member

maflcko commented Feb 18, 2019

re-utACK 6fffaec0e72c21

Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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().
@maflcko
Copy link
Member

maflcko commented Feb 19, 2019

re-utACK 1a7ba84

@promag
Copy link
Contributor

promag commented Feb 23, 2019

Tested ACK 1a7ba84.

@maflcko maflcko added this to the 0.19.0 milestone Feb 23, 2019
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Mar 2, 2019
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
@maflcko maflcko merged commit 1a7ba84 into bitcoin:master Mar 2, 2019
@AkioNak AkioNak deleted the conf_include_multi branch March 13, 2019 01:29
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Apr 17, 2020
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
ftrader pushed a commit to bitcoin-cash-node/bitcoin-cash-node that referenced this pull request Aug 17, 2020
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
christiancfifi pushed a commit to christiancfifi/dash that referenced this pull request Oct 3, 2021
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().
vijaydasmp pushed a commit to vijaydasmp/dash that referenced this pull request Oct 16, 2021
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
pravblockc pushed a commit to pravblockc/dash that referenced this pull request Nov 18, 2021
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
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants