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

Support patch fuzzing #23959

Open
rickeylev opened this issue Oct 11, 2024 · 0 comments
Open

Support patch fuzzing #23959

rickeylev opened this issue Oct 11, 2024 · 0 comments
Labels
team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: feature request untriaged

Comments

@rickeylev
Copy link
Contributor

Description of the feature request:

When uses patches, its easy for lines to slightly change or become out of data between different versions of things. This can make simple patch applying fail. Fuzzing is a feature of many patch tools that allows the patcher to look around the location the patch specifies to try and match a slightly different location. This makes it easier for patches to apply to slightly different versions of a file.

While there exists patch_tool to call an external program, using it introduces platform-specific problems. e.g., I could use patch, but now it won't work on windows. Similarly, for all I know, Mac and BSD might ship with some ancient forked version of patch, which doesn't support the same args. etc.

Surely there must be an acceptable fuzz-capable Java implementation of a patch algorithm out there somewhere?

If so, I would propose the following:

  • Have e.g. patch_tool = ":internal:" to indicate "use the bazel native implementation" (inspired from mercurial, where they have special strings to indicate special mercurial-native merge algorithms)
  • Have it read patch_args for e.g. the amount of fuzz to tolerate.

Which category does this issue belong to?

No response

What underlying problem are you trying to solve with this feature?

To make it easier for patches to apply when the file they patch has changed.

As an example, I had a patch to rules_python's MODULE.bazel file. It was a one-line patch where all it did was change a boolean from True to False.

Unfortunately, the line of interest changed from line 60 to line 67 in the upstream code. The surrounding context (i.e. the surrounding 5-10 lines) were identical. But, the patch failed to apply. So I then had to go check out/extract the exact copy of code i was trying to patch and alter my patch accordingly.

Which operating system are you running Bazel on?

Linux

What is the output of bazel info release?

Bazel 8

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

I searched for "patch fuzz" on all and also google search with site:github.com/bazelbuild restriction; didn't find anything.

Any other information, logs, or outputs that you want to share?

No response

@iancha1992 iancha1992 added the team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. label Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: feature request untriaged
Projects
None yet
Development

No branches or pull requests

4 participants