From 2ed33345667706c5755708e88c989ede06f2414f Mon Sep 17 00:00:00 2001 From: David Lakin Date: Fri, 9 Aug 2024 00:06:44 -0400 Subject: [PATCH] Fix order of environment setup and git module import 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. --- fuzzing/fuzz-targets/fuzz_submodule.py | 2 +- pyproject.toml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/fuzzing/fuzz-targets/fuzz_submodule.py b/fuzzing/fuzz-targets/fuzz_submodule.py index 634572bf2..997133b70 100644 --- a/fuzzing/fuzz-targets/fuzz_submodule.py +++ b/fuzzing/fuzz-targets/fuzz_submodule.py @@ -3,7 +3,6 @@ import os import tempfile from configparser import ParsingError -from git import Repo, GitCommandError, InvalidGitRepositoryError from utils import ( setup_git_environment, handle_exception, @@ -12,6 +11,7 @@ # Setup the git environment setup_git_environment() +from git import Repo, GitCommandError, InvalidGitRepositoryError def TestOneInput(data): diff --git a/pyproject.toml b/pyproject.toml index 603e2597c..6cf4b3f5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -78,6 +78,10 @@ lint.unfixable = [ "test/**" = [ "B018", # useless-expression ] +"fuzzing/fuzz-targets/**" = [ + "E402", # environment setup must happen before the `git` module is imported, thus cannot happen at top of file +] + [tool.codespell] ignore-words-list="gud,doesnt"