Page MenuHomePhabricator

refactor: Remove redundant c_str() calls in formatting
ClosedPublic

Authored by deadalnix on Apr 30 2020, 13:07.

Details

Summary

Our formatter, tinyformat, *never* needs c_str() for strings.
Remove redundant c_str() calls for:

  • strprintf
  • LogPrintf
  • tfm::format

This is a backport of Core PR17279

Test Plan
ninja all check

Diff Detail

Repository
rABC Bitcoin ABC
Branch
pr17279
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 10507
Build 18832: Default Diff Build & Tests
Build 18831: arc lint + arc unit

Event Timeline

[Bot Message]
One or more PR numbers were detected in the summary.
Links to those PRs have been inserted into the summary for reference.

Snippet of first build failure:

[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Counting objects: 100% (43/43), done.        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:   4% (1/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:   9% (2/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:  13% (3/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:  18% (4/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:  22% (5/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:  27% (6/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:  31% (7/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:  36% (8/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:  40% (9/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:  45% (10/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:  50% (11/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:  54% (12/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:  59% (13/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:  63% (14/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:  68% (15/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:  72% (16/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:  77% (17/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:  81% (18/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:  86% (19/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:  90% (20/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects:  95% (21/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects: 100% (22/22)        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Compressing objects: 100% (22/22), done.        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] remote: Total 22 (delta 21), reused 0 (delta 0), pack-reused 0        
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292] From ssh://reviews.bitcoinabc.org:2221/source/bitcoin-abc-staging
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292]  * [new tag]             phabricator/diff/19292 -> phabricator/diff/19292
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292]  * [new tag]             phabricator/base/19291 -> phabricator/base/19291
[13:08:08]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19292:refs/tags/phabricator/diff/19292]  * [new tag]             phabricator/base/19292 -> phabricator/base/19292
[13:08:08] :			 [Update git mirror (/home/teamcity/buildAgent/system/git/git-48AA3180.git)] /usr/bin/git log -n1 --pretty=format:%H%x20%s 5c196d23f659ee34fdd8971c6ff5546a2d45f875 --
[13:08:08] :			 [Update git mirror (/home/teamcity/buildAgent/system/git/git-48AA3180.git)] /usr/bin/git pack-refs --all
[13:08:08] :		 [VCS Root: Bitcoin ABC Staging] Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)
[13:08:08] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] The .git directory is missing in '/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc'. Running 'git init'...
[13:08:08] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git init
[13:08:08] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git config lfs.storage /home/teamcity/buildAgent/system/git/git-48AA3180.git/lfs
[13:08:08] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git config core.sparseCheckout true
[13:08:08] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git config http.sslCAInfo
[13:08:08] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git show-ref
[13:08:08] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git show-ref refs/tags/phabricator/diff/19292
[13:08:08] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git log -n1 --pretty=format:%H%x20%s 5c196d23f659ee34fdd8971c6ff5546a2d45f875 --
[13:08:09] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git -c credential.helper= checkout -q -f phabricator/diff/19292
[13:08:09] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git show-ref refs/tags/phabricator/diff/19292
[13:08:09] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] Cleaning Bitcoin ABC Staging in /home/teamcity/buildAgent/work/jailed-build/bitcoin-abc the file set ALL_UNTRACKED
[13:08:09] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git clean -f -d -x
[13:08:09] : Build preparation done
[13:08:09]E: Step 1/2: Command Line (11m:35s)
[13:08:09] :	 [Step 1/2] Ant JUnit report watcher
[13:08:09] :		 [Ant JUnit report watcher] Watching paths:
[13:08:09] :		 [Ant JUnit report watcher] +:results/test_bitcoin.xml
[13:08:09] :		 [Ant JUnit report watcher] +:results/**/junit_results*.xml
[13:08:09] :	 [Step 1/2] Starting: /home/teamcity/buildAgent/temp/agentTmp/custom_script4087256718940541737
[13:08:09] :	 [Step 1/2] in directory: /home/teamcity/buildAgent/work/jailed-build
[13:08:09] :	 [Step 1/2] ~/buildAgent/work/jailed-build/bitcoin-abc ~/buildAgent/work/jailed-build
[13:08:09] :	 [Step 1/2] ~/buildAgent/work/jailed-build
[13:08:09] :	 [Step 1/2] Building base image for: 5c196d23f...
[13:08:09] :	 [Step 1/2] ~/buildAgent/work/jailed-build/bitcoin-abc ~/buildAgent/work/jailed-build
[13:08:09] :	 [Step 1/2] ~/buildAgent/work/jailed-build
[13:08:09] :	 [Step 1/2] Tag name: abc-base-image-5c196d23f
[13:19:43]W:	 [Step 1/2] Process exited with code 1
[13:19:44]E:	 [Step 1/2] Process exited with code 1 (Step: Command Line)
This revision is now accepted and ready to land.Apr 30 2020, 16:02
This revision was landed with ongoing or failed builds.Apr 30 2020, 16:12
This revision was automatically updated to reflect the committed changes.

Snippet of first build failure:

2020-04-30T17:00:55.745000Z TestFramework (ERROR): Test failed. Test logging available at /work/build/test/tmp/bitcoin_test_runner_20200430_165929/feature_uacomment_240/test_framework.log
2020-04-30T17:00:55.745000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/build/test/tmp/bitcoin_test_runner_20200430_165929/feature_uacomment_240' to consolidate all logs
[17:01:24]i:		 [Bitcoin ABC functional tests] wallet_multiwallet.py
[17:01:24]i:			 [wallet_multiwallet.py] [Test Output]
2020-04-30T17:00:21.897000Z TestFramework (INFO): Initializing test directory /work/build/test/tmp/bitcoin_test_runner_20200430_165929/wallet_multiwallet_212
2020-04-30T17:00:23.980000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_node.py", line 352, in assert_start_raises_init_error
    self.wait_for_rpc_connection()
  File "/work/test/functional/test_framework/test_node.py", line 237, in wait_for_rpc_connection
    'bitcoind exited with status {} during initialization'.format(self.process.returncode)))
test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status 1 during initialization

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 165, in main
    self.run_test()
  File "/work/test/functional/wallet_multiwallet.py", line 93, in run_test
    ['-walletdir=wallets'], 'Error: Specified -walletdir "wallets" does not exist')
  File "/work/test/functional/test_framework/test_node.py", line 375, in assert_start_raises_init_error
    'Expected message "{}" does not fully match stderr:\n"{}"'.format(expected_msg, stderr))
  File "/work/test/functional/test_framework/test_node.py", line 152, in _raise_assertion_error
    raise AssertionError(self._node_msg(msg))
AssertionError: [node 0] Expected message "Error: Specified -walletdir "wallets" does not exist" does not fully match stderr:
"ErrorSpecified -walletdir "wallets" does not exist"
2020-04-30T17:00:24.031000Z TestFramework (INFO): Stopping nodes
2020-04-30T17:00:24.031000Z TestFramework (WARNING): Not cleaning up dir /work/build/test/tmp/bitcoin_test_runner_20200430_165929/wallet_multiwallet_212
2020-04-30T17:00:24.031000Z TestFramework (ERROR): Test failed. Test logging available at /work/build/test/tmp/bitcoin_test_runner_20200430_165929/wallet_multiwallet_212/test_framework.log
2020-04-30T17:00:24.031000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/build/test/tmp/bitcoin_test_runner_20200430_165929/wallet_multiwallet_212' to consolidate all logs
[17:01:24]i:		 [Bitcoin ABC functional tests] wallet_multiwallet.py --usecli
[17:01:24]i:			 [wallet_multiwallet.py --usecli] [Test Output]
2020-04-30T17:00:11.759000Z TestFramework (INFO): Initializing test directory /work/build/test/tmp/bitcoin_test_runner_20200430_165929/wallet_multiwallet_206
2020-04-30T17:00:14.145000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_node.py", line 352, in assert_start_raises_init_error
    self.wait_for_rpc_connection()
  File "/work/test/functional/test_framework/test_node.py", line 237, in wait_for_rpc_connection
    'bitcoind exited with status {} during initialization'.format(self.process.returncode)))
test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status 1 during initialization

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 165, in main
    self.run_test()
  File "/work/test/functional/wallet_multiwallet.py", line 93, in run_test
    ['-walletdir=wallets'], 'Error: Specified -walletdir "wallets" does not exist')
  File "/work/test/functional/test_framework/test_node.py", line 375, in assert_start_raises_init_error
    'Expected message "{}" does not fully match stderr:\n"{}"'.format(expected_msg, stderr))
  File "/work/test/functional/test_framework/test_node.py", line 152, in _raise_assertion_error
    raise AssertionError(self._node_msg(msg))
AssertionError: [node 0] Expected message "Error: Specified -walletdir "wallets" does not exist" does not fully match stderr:
"ErrorSpecified -walletdir "wallets" does not exist"
2020-04-30T17:00:14.196000Z TestFramework (INFO): Stopping nodes
2020-04-30T17:00:14.196000Z TestFramework (WARNING): Not cleaning up dir /work/build/test/tmp/bitcoin_test_runner_20200430_165929/wallet_multiwallet_206
2020-04-30T17:00:14.196000Z TestFramework (ERROR): Test failed. Test logging available at /work/build/test/tmp/bitcoin_test_runner_20200430_165929/wallet_multiwallet_206/test_framework.log
2020-04-30T17:00:14.196000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/build/test/tmp/bitcoin_test_runner_20200430_165929/wallet_multiwallet_206' to consolidate all logs
[17:01:32]W:	 [Step 1/2] Process exited with code 1
[17:01:32]E:	 [Step 1/2] Process exited with code 1 (Step: Command Line)

Each failure log is accessible here:
Bitcoin ABC functional tests: abc-cmdline.py
Bitcoin ABC functional tests: feature_blocksdir.py
Bitcoin ABC functional tests: feature_config_args.py
Bitcoin ABC functional tests: feature_includeconf.py
Bitcoin ABC functional tests: feature_logging.py
Bitcoin ABC functional tests: feature_uacomment.py
Bitcoin ABC functional tests: wallet_multiwallet.py
Bitcoin ABC functional tests: wallet_multiwallet.py --usecli