This should fix the firstGoodIssue #16894 (which I discovered with carldongs firstGoodIssueTwitter bot c.f.: https://twitter.com/GoodFirstIssues/status/1173915080439795714)
have no windows machine here and couldn't test. relying on ci on github.
This should fix the firstGoodIssue #16894 (which I discovered with carldongs firstGoodIssueTwitter bot c.f.: https://twitter.com/GoodFirstIssues/status/1173915080439795714)
have no windows machine here and couldn't test. relying on ci on github.
Would be nice to leave the whitespace changes for later. It makes it impossible to review the commit that fixes a bug.
Thanks for picking this up! If everything succeeds, combine_logs won't be invoked. So for testing, you could add a second commit that makes some functional test trivially fail and after checking the CIs' output remove it again and add a link to the logs here.
Would be nice to leave the whitespace changes for later. It makes it impossible to review the commit that fixes a bug.
sorry my emacs just has some auto save actions to follow the PEP8 formatting. I didn't even realize that that has happened.
What do you (@MarcoFalke ) want me to do? I could quickly mark the 4 relevant lines here on github or do you want me to redo the patch without changes to whitespace?
82 | @@ -78,16 +83,21 @@ def read_logs(tmp_dir): 83 | for each of the input log files.""" 84 | 85 | # Find out what the folder is called that holds the debug.log file 86 | - chain = glob.glob("{}/node0/*/debug.log".format(tmp_dir)) 87 | + 88 | + chain = glob.glob(os.path.join(tmp_dir, "node0", "*", "debug.log"))
first change
91 | - chain = re.search(r'node0/(.+?)/debug\.log$', chain).group(1) # extract the chain name 92 | + # pick the first one if more than one chain was found (should never happen) 93 | + chain = chain[0] 94 | + sep = os.path.sep 95 | + chain = re.search(r'node0' + sep + '(.+?)' + sep + 96 | + 'debug\.log$', chain).group(1) # extract the chain name
second change
Nit: \. is not a valid escape sequence :)
98 | - chain = 'regtest' # fallback to regtest (should only happen when none exists) 99 | + # fallback to regtest (should only happen when none exists) 100 | + chain = 'regtest' 101 | 102 | - files = [("test", "%s/test_framework.log" % tmp_dir)] 103 | + files = [("test", os.path.join(tmp_dir, "test_framework.log"))]
third change
101 | 102 | - files = [("test", "%s/test_framework.log" % tmp_dir)] 103 | + files = [("test", os.path.join(tmp_dir, "test_framework.log"))] 104 | for i in itertools.count(): 105 | - logfile = "{}/node{}/{}/debug.log".format(tmp_dir, i, chain) 106 | + logfile = os.path.join(tmp_dir, "node{}".format(i), chain, "debug.log")
fourth change
110 | @@ -101,18 +111,21 @@ def print_node_warnings(tmp_dir, colors): 111 | warnings = [] 112 | for stream in ['stdout', 'stderr']: 113 | for i in itertools.count(): 114 | - folder = "{}/node{}/{}".format(tmp_dir, i, stream) 115 | + folder = os.path.join(tmp_dir, "node{}".format(i), stream)
5th change
117 | break 118 | for (_, _, fns) in os.walk(folder): 119 | for fn in fns: 120 | - warning = pathlib.Path('{}/{}'.format(folder, fn)).read_text().strip() 121 | + warning = pathlib.Path(os.path.join( 122 | + folder, fn)).read_text().strip()
6th change
actually the whitespace stuff didn't mess it up so badly everything between line 81 and 120 that was changed is actually a change that would have occured even without the whitespace formatting changes. everything above and blow can easily be neglected.
We don't enforce a maximum line length, and different contributors have different preferences about the line length. Thus, we can't (for now) have editors auto-format a file that was saved. Otherwise, the lines would just ping-pong around on every change. Generally, we leave the line length like it was previously.
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Reviewers, 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.
Also, I think it would be easier to read the commit message if it was shorter. See https://chris.beams.io/posts/git-commit/
This doesn't seem to be working yet. I cherry-picked your commit in order to understand why AppVeyor doesn't like my PR #16756 (that's the background why I created #16894), and combine_logs.py still doesn't work: https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/27470906
Also, the linter complains about an invalid escaping sequence. https://travis-ci.org/bitcoin/bitcoin/jobs/586103029
@mzumsande I am a little bit confused about the error. First of all the error message changed which (hopefully means progress) but I cannot make much of the error message as I don't see where unbalanced parenthesis would come from. Also I am somewhat confused that at least in the error message there is still the usage of / and ... @MarcoFalke once @mzumsande get the code running I will make a force push with the patch withouth outsave actions and with a better commit message
90 | - chain = chain[0] # pick the first one if more than one chain was found (should never happen) 91 | - chain = re.search(r'node0/(.+?)/debug\.log$', chain).group(1) # extract the chain name 92 | + # pick the first one if more than one chain was found (should never happen) 93 | + chain = chain[0] 94 | + sep = os.path.sep 95 | + chain = re.search(r'node0' + sep + '(.+?)' + sep +
I think the issue is that the windows separator \ needs to be escaped when used in a regex. Not a great expert on regex, but with the following it should work:
if sep == '\\':
sep = '\\\\'
See my post below. Also see my suggestion in post 3, if all functional tests pass, you can't see if your change works, as the current AppVeyor build shows.
Thanks for contributing. Concept ACK.
I'd also suggest removing the whitespace and formatting changes (at least to lines not touched otherwise) and focusing the changes on the issue that you're trying to fix. This makes reviewing easier, and keeps the git commit log more readable.
Yeah, pretty sure this is just a trivial one line fix. No need to blow up the scope of this pull request beside the minimal required fix.