Fix Several Bugs in the `fuzz_submodule` Causing a lot of False Alarms in the OSS-Fuzz Bug Tracker by DaveLak · Pull Request #1950 · gitpython-developers/GitPython

and others added 6 commits

August 7, 2024 22:07
This reduces false positive test failures by identifying and
gracefully handling exceptions that are explicitly raised by GitPython,
thus reducing the false-positive fuzzing test failure rate.
Changes:
   - `match_exception_with_traceback` uses regular expressions for more
     flexible matching of file paths and line numbers. This allows for
     partial matches and more complex patterns.

   - Improve `check_exception_against_list` by delegating to
     `match_exception_with_traceback` for checking tracebacks against
     exception list entries.

   - `load_exception_list`: Remains largely unchanged, as it correctly
     parses the file and line number from each exception entry. However,
     we ensure the set consists of regex patterns to match against
     tracebacks.
Changes:

   - Simplify exception handling in test harnesses via `handle_exception(e)`
     in the `except Exception as e:` block.

   - `setup_git_environment` is a step towards centralizing environment
     variable and logging configuration set up consistently across
     different fuzzing scripts. **Only applying it to a single test for
     now is an intentional choice in case it fails to work in the
     ClusterFuzz environment!** If it proves successful, a follow-up
     change set will be welcome.
To ensure that all necessary files are included in the
explicit-exceptions-list.txt file and unwanted files and directories are
not.
The environment setup must happen before the `git` module is imported,
otherwise GitPython won't be able to find the Git executable and raise
an exception that causes the ClusterFuzz fuzzer runs to fail.

DaveLak

@DaveLak DaveLak deleted the fix-fuzz-submodules-filename-exception branch

August 9, 2024 07:36