-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Bazel fails to patch external repos on macOS 13 #16550
Comments
Hi @linzhp! It would be really helpful if you can provide a minimal reproduce case with Sample code, Thank you! |
Repro would def be nice, I've been using macOS 13 for a while with repo patches without issue. At some point (not sure when) bazel started using an internal patch command, (maybe only in some cases?), so maybe somehow that difference is the key |
Updated the ticket with repro |
Looking at this a bit it seems that macOS 13's version of patch is just more strict about the patch content than gpatch. The problem is your patch content doesn't appear to match what is generated in the BUILD file in that example before the patch:
If you update the patch to have less content: diff -urN a/gogoproto/BUILD.bazel b/gogoproto/BUILD.bazel
--- a/gogoproto/BUILD.bazel 2020-05-26 15:48:27.000000000 -0700
+++ b/gogoproto/BUILD.bazel 2020-05-26 16:06:33.000000000 -0700
@@ -30,0 +31,2 @@
+
+exports_files(["gogo.proto"]) Or to have the new correct content: diff -urN a/gogoproto/BUILD.bazel b/gogoproto/BUILD.bazel
--- a/gogoproto/BUILD.bazel 2020-05-26 15:48:27.000000000 -0700
+++ b/gogoproto/BUILD.bazel 2020-05-26 16:06:33.000000000 -0700
@@ -28,3 +28,5 @@
actual = ":gogoproto",
visibility = ["//visibility:public"],
)
+
+exports_files(["gogo.proto"]) Things do work as expected. I'm not sure what bazel should do about this case in general though. |
I think in general, Bazel should not call local |
In Bazel, we do use a native patch implementation by default and exposes this as an API for Starlark rules. I believe this is a problem in the go_repository implementation and is already fixed by bazel-contrib/bazel-gazelle@ce5a762. |
Description of the bug:
Bazel uses local
patch
command by default to apply patches to external repositories. macOS 13 downgraded the system patch command from 2.5.8 to 2.0, causing many patches in Bazel repositories failed to apply:On macOS 12:
On macOS 13:
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Which operating system are you running Bazel on?
macOS 13
What is the output of
bazel info release
?release 5.3.1
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 master; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
Manually install newer version of gpatch with
brew install gpatch
works. However, Bazel should not rely on the locally installedpatch
command. Instead, it should download either the source code or binary for GNU patch and use that when users don't providepatch_tool
:bazel/tools/build_defs/repo/utils.bzl
Line 139 in b422719
The text was updated successfully, but these errors were encountered: