Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[setuptools] Fix Broken Build & Improve Fuzz Harness #12340

Merged

Conversation

DaveLak
Copy link
Contributor

@DaveLak DaveLak commented Aug 13, 2024

Fixes Issue 68958: setuptools: Fuzzing Build Failure

Fixes the setuptools fuzzer builds that have been broken since May 12, 2024.

Key Changes

  • Pyinstaller Upgrade: Updated Pyinstaller to version 3.10.0, which is the minimum version supporting setuptools >= 71.0.0. This upgrade addresses the new dependency vendoring approach in setuptools. For more details, refer to the setuptools history.

  • Tomli Import Fix: Replaced the tomli import from setuptools.extern with a direct import. This change resolves the ModuleNotFoundError: No module named 'setuptools.extern' exception. Using setuptools.extern for imports is discouraged, as noted in pypa/setuptools#4498.

Additional Improvements

  • Dictionary Addition: Added a dictionary for setuptools fuzz harnesses.

  • Fuzzer Optimization: Improved fuzzer cold-start time by using atheris.instrument_imports instead of atheris.instrument_all. For additional details on other minor changes, see commit e01e5aeb3da0e55cec36887f5adda32b97dc2256.

  • Docker Image Enhancement: Cached the cloned dependency during the Docker image build step.

Upgrades Pyinstaller to 3.10.0 as it is the minimum version that
implements support for setuptools >= 71.0.0 and its new approach
to vendoring its dependencies.
See: https://setuptools.pypa.io/en/latest/history.html

Replaces `tomli` import from `setuptools.extern` with a direct import
to resolve a `ModuleNotFoundError: No module named 'setuptools.extern'`
exception. Importing from `setuptools.extern` appears to be discouraged
as per comments on: pypa/setuptools#4498
- Speed up fuzzer cold-starts by using `atheris.instrument_imports`
  instead of `atheris.instrument_all`.
- Use the TemporaryDirectory context manager to obtain a new temporary
directory instead of hardocing the path.
- Write a variable amount of fuzzed data to the test file.
- Remove deprecated Atheris argument.
- Return from the fuzz test after handled exceptions to signal to the
  fuzzing engine that the test is done.
There is no need to clone the distutils repo more than once.

Also adds `git clone` flags to minimize the size of cloned repos.
Copy link

DaveLak is a new contributor to projects/setuptools. The PR must be approved by known contributors before it can be merged.

@DonggeLiu
Copy link
Contributor

@DavidKorczynski Could you please help double-check this?
Thank you : )

@DonggeLiu
Copy link
Contributor

Gentle ping @DavidKorczynski, thanks!

@DavidKorczynski
Copy link
Collaborator

I'll take a look at this in detail tomorrow!

@DavidKorczynski DavidKorczynski merged commit bb88821 into google:master Oct 6, 2024
15 checks passed
@DaveLak DaveLak deleted the projects/setuptools/fix-build branch October 7, 2024 00:19
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.

3 participants