canonical / checkbox

Checkbox is a testing framework used to validate device compatibility with Ubuntu Linux. It’s the testing tool developed for the purposes of the Ubuntu Certification program.
https://checkbox.readthedocs.io
GNU General Public License v3.0
33 stars 50 forks source link

Fix the parser so that it doesn't loop forever (bugfix) #1555

Closed Hook25 closed 1 month ago

Hook25 commented 1 month ago

Description

When validating units, Checkbox tries to parse fields to see if there are any errors with them. Turns out that if a field contains an un-terminated string"..., that will cause the parser to always loop forever or crash with an assertion error. This was affecting a test run today due to a non-sluggified name getting templated into a job. This manifested itself as an infinited crash-restore loop due to also an un-related error (if the session gets stuck on an infinite loop, the controller tries to reconnect eventually, Checkbox refuses to "recover" during bootstrapping, restarting the session)

Resolved issues

Fixes: https://warthogs.atlassian.net/browse/CHECKBOX-1622

Documentation

This also documents how the parser works because it is quite something

Tests

This also adds the tests I used to reproduce the issue

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 47.78%. Comparing base (b6d5bfa) to head (a8a7abe). Report is 3 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1555 +/- ## ========================================== + Coverage 47.76% 47.78% +0.02% ========================================== Files 370 370 Lines 39750 39751 +1 Branches 6720 6720 ========================================== + Hits 18987 18997 +10 + Misses 20048 20042 -6 + Partials 715 712 -3 ``` | [Flag](https://app.codecov.io/gh/canonical/checkbox/pull/1555/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=canonical) | Coverage Δ | | |---|---|---| | [checkbox-ng](https://app.codecov.io/gh/canonical/checkbox/pull/1555/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=canonical) | `68.28% <100.00%> (+0.06%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=canonical#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.