Support patch fuzzing #23959
Labels
team-ExternalDeps
External dependency handling, remote repositiories, WORKSPACE file.
type: feature request
untriaged
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 usepatch
, 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:
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)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
returnsdevelopment 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
The text was updated successfully, but these errors were encountered: