Patches constructed from 16-bit charset neither error nor apply in single_version_mode
#23,843 opened on Oct 2, 2024
Description
Description of the bug:
I ended up trying to build a patch from a git diff I performed on a windows system. As far as I could tell the patch was having no effect (https://stackoverflow.com/questions/79018238/single-version-override-with-patch-has-no-effect). I eventually dove into adding System.err.printf to bazel's patch code to see what was going on, and it eventually led me to look at my patch not in a text editor but with od -hc foo.patch.
Doing so I saw "\xff \xfe '\0' d '\0' i ..." which looks like a 16-bit encoding of the file.
I would have expected an error somewhere for a case like this.
If I have a non-trivial patch and it doesn't actually cause any effects, I would expect to see an error.
I did some perl -spi -e 's/[\xff\xfe\0]//g' benchmark.patch' magic and then started seeing the errors I had originally hoped for.
Which category does this issue belong to?
No response
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
I tried to do this in my MODULES.bazel
bazel_dep(name = "google_benchmark", version = "1.8.5")
single_version_override(
module_name = "google_benchmark",
patches = ["//:benchmark.patch"],
)
Which operating system are you running Bazel on?
OsX
What is the output of bazel info release?
release 7.3.1
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
If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response