Skip to content

Conversation

@owen-mc
Copy link
Contributor

@owen-mc owen-mc commented Jan 13, 2026

The script was falling over on this log, I believe because of the unexpected getSignatureParameterName line in this section:

--- expected
+++ actual
@@ -135,6 +135,7 @@
 | stl.h:678:33:678:38 | format | std | (format_string,Args &&) |  | format<Args> | 0 |
 | stl.h:678:33:678:38 | format | std | (format_string,Args &&) |  | format<Args> | 1 |
 | stl.h:678:33:678:38 | format | std | (format_string,Args &&) |  | format<Args> | 1 |
+| taint.cpp:735:7:735:12 | malloc |  | (size_t) |  | malloc | 0 |
 | taint.cpp:847:5:847:11 | toupper |  | (int) |  | toupper | 0 |
 | taint.cpp:848:5:848:11 | tolower |  | (int) |  | tolower | 0 |
 getSignatureParameterName
Error: [3/3] [1477/2812 comp 17.7s eval 3.9s] FAILED(RESULT) /home/runner/work/semmle-code/semmle-code/ql/cpp/ql/test/library-tests/dataflow/taint-tests/test_mad-signatures.ql

The terminal output was as follow:

INFO: 'Java Language Tests Linux': Making patches
INFO: 'CPP Language Tests Linux': Making patches
Traceback (most recent call last):
  File "/Users/owen-mc/workspace/code/ql/misc/scripts/accept-expected-changes-from-ci.py", line 504, in <module>
    main(pr_number, override_sha, force=args.force, wait_for_ci=args.wait_for_ci)
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/owen-mc/workspace/code/ql/misc/scripts/accept-expected-changes-from-ci.py", line 392, in main
    patches = make_patches_from_log_file(log_content.splitlines())
  File "/Users/owen-mc/workspace/code/ql/misc/scripts/accept-expected-changes-from-ci.py", line 132, in make_patches_from_log_file
    error_line = parse_log_line(next(lines))
                                ~~~~^^^^^^^
StopIteration

I asked copilot to fix it and it added this try-except block so that at least other patches could be produced. Now when I run the script I get this output:

INFO: 'Java Language Tests Linux': Making patches
INFO: 'CPP Language Tests Linux': Making patches
WARNING: Encountered unexpected end of logs while parsing failure block.
INFO: 'C# Language Tests Linux': Making patches
INFO: 'Go Language Tests Linux': Making patches

(And then a C# patch failed to apply, but I assume that's unrelated.)

Copilot AI review requested due to automatic review settings January 13, 2026 11:44
@owen-mc owen-mc requested a review from RasmusWL as a code owner January 13, 2026 11:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the robustness of the test log parsing script by adding exception handling to prevent crashes when encountering unexpected log formats. The script previously failed with a StopIteration error when parsing logs with unexpected content.

Changes:

  • Added try-except block to handle StopIteration gracefully when parsing test failure blocks
  • Logs a warning message when encountering unexpected end of logs instead of crashing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

error_line = parse_log_line(next(lines))
except StopIteration:
LOGGER.warning("Encountered unexpected end of logs while parsing failure block.")
break
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

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

The variable filename_match may be undefined when accessed at this line. If StopIteration is caught at line 134, the code breaks out of the try block, but filename_match will not have been assigned if the exception occurred before line 127 or if no match was found before the exception. This will cause an UnboundLocalError. The continue statement should be used instead of break in the exception handler to skip to the next iteration of the outer for loop.

Suggested change
break
continue

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant