Yasuhito FUTATSUKI wrote on Sat, Oct 12, 2019 at 05:31:53 +0900: > Yes, it will fix local_missing_dir_endless_loop() itself correctly. > But the stack trace before fix indicate there is at least one problem > in svntest.verify.compare_and_display_lines(). > > Assume the file contents is broken here. This situation can be simulate > by patch like: > > Index: subversion/tests/cmdline/tree_conflict_tests.py > =================================================================== > --- subversion/tests/cmdline/tree_conflict_tests.py (revision 1868264) > +++ subversion/tests/cmdline/tree_conflict_tests.py (working copy) > @@ -1544,7 +1544,7 @@ > contents = open(sbox.ospath('A1/B/lambda'), 'rb').readlines() > svntest.verify.compare_and_display_lines( > "A1/B/lambda has unexpectected contents", sbox.ospath("A1/B/lambda"), > - [ "This is the file 'lambda'.\n", "This is more content.\n"], contents) > + [ b"This is the file 'lambda'.\n", b"This is not more content.\n"], > contents) > ####################################################################### > > > then we will got fails.log, contains stack trace for unexpected exception > within the code to construct log message. > > [[[ > W: A1/B/lambda has unexpectected contents > W: EXPECTED svn-test-work/working_copies/tree_conflict_tests-26/A1/B/lambda > (match_all=True): > W: CWD: /home/futatuki/work/subversion/vwc/trunk/subversion/tests/cmdline > Traceback (most recent call last): > File > "/home/futatuki/work/subversion/vwc/trunk/subversion/tests/cmdline/svntest/main.py", > line 1931, in run > rc = self.pred.run(sandbox) > File > "/home/futatuki/work/subversion/vwc/trunk/subversion/tests/cmdline/svntest/testcase.py", > line 178, in run > result = self.func(sandbox) > File > "/home/futatuki/work/subversion/vwc/trunk/subversion/tests/cmdline/tree_conflict_tests.py", > line 1547, in local_missing_dir_endless_loop > [ b"This is the file 'lambda'.\n", b"This is not more content.\n"], > contents) > File > "/home/futatuki/work/subversion/vwc/trunk/subversion/tests/cmdline/svntest/verify.py", > line 503, in compare_and_display_lines > expected.display_differences(message, label, actual) > File > "/home/futatuki/work/subversion/vwc/trunk/subversion/tests/cmdline/svntest/verify.py", > line 154, in display_differences > display_lines(message, self.expected, actual, e_label, label) > File > "/home/futatuki/work/subversion/vwc/trunk/subversion/tests/cmdline/svntest/verify.py", > line 474, in display_lines > logger.warn('| ' + x.rstrip()) > TypeError: can only concatenate str (not "bytes") to str > FAIL: tree_conflict_tests.py 26: endless loop when resolving local-missing > dir > ]]] > > This is caused by mixing bytes object drived from file contents and str > object to construct log message.
I agree: this FAIL indicates str and bytes are mixed. My question is: Why do you think svntest.verify.compare_and_display_lines() needs to be changed? That function's names implies it deals with text files, so, why should compare_and_display_lines() support the case that its third and fourth parameters (EXPECTED and ACTUAL) are both lists of bytes objects? In other words, why would changing «'rb'» to «'r'» on line 1544 — without changing the str literals to bytes literals on line 1547 — not be a correct solution? Hope I'm clearer this time. If not, I'd be happy to clarify. Cheers, Daniel