Skip to content

Commit 25e283f

Browse files
committed
protobuf: recompile using gogoproto 1.2 from CRDB master
Generated Protobufs have been a mix of gogoproto 1.2 and 1.3 types, since different packages have been compiled with different Protobuf compilers. This was in part because `Makefile.update-protos` only covered `errorspb/*.proto`, with other Protobufs compiled ad hoc. This was problematic since CockroachDB currently uses gogoproto 1.2 and thus could not make use of the 1.3-generated types. This patch changes `Makefile.update-protos` to compile all Protobufs in the repo, and recompiles all Protobufs using the current Protobuf compiler used in CockroachDB. Note in particular that this downgrades generated Protobufs for `extgrpc`, `exthttp`, and `grpc` from gogoproto 1.3 to 1.2, which might be considered a breaking change. This also addresses [CVE-2021-3121](https://nvd.nist.gov/vuln/detail/CVE-2021-3121).
1 parent 4c16368 commit 25e283f

File tree

17 files changed

+611
-244
lines changed

17 files changed

+611
-244
lines changed

Makefile.update-protos

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,33 @@
2323
#
2424
# 2. run `make -f Makefile.update-protos` with this PATH active.
2525

26-
PROTOS := $(wildcard errorspb/*.proto)
26+
export SHELL := env PWD=$(CURDIR) bash
27+
28+
PROTOS := $(wildcard \
29+
errbase/internal/*.proto \
30+
errorspb/*.proto \
31+
extgrpc/*.proto \
32+
exthttp/*.proto \
33+
grpc/*.proto \
34+
markers/internal/*.proto \
35+
)
2736
GO_SOURCES = $(PROTOS:.proto=.pb.go)
2837

2938
SED = sed
3039
SED_INPLACE := $(shell $(SED) --version 2>&1 | grep -q GNU && echo -i || echo "-i ''")
3140

3241
all: $(PROTOS)
33-
protoc \
34-
-I$$GOPATH/src/ \
35-
-I$$GOPATH/src/github.com \
36-
-I$$GOPATH/src/github.com/cockroachdb/errors \
37-
-I$$GOPATH/src/github.com/gogo/protobuf \
38-
-I$$GOPATH/src/github.com/gogo/protobuf/protobuf \
39-
--gogoroach_out=Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,plugins=grpc,import_prefix=:. \
40-
$(PROTOS)
42+
set -e; for dir in $(sort $(dir $(PROTOS))); do \
43+
protoc \
44+
-I. \
45+
-I$$GOPATH/src/ \
46+
-I$$GOPATH/src/github.com \
47+
-I$$GOPATH/src/github.com/cockroachdb/errors \
48+
-I$$GOPATH/src/github.com/gogo/protobuf \
49+
-I$$GOPATH/src/github.com/gogo/protobuf/protobuf \
50+
--gogoroach_out=Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,plugins=grpc,import_prefix=:. \
51+
$$dir/*.proto; \
52+
done
4153
$(SED) $(SED_INPLACE) -E \
4254
-e '/import _ /d' \
4355
-e 's!import (fmt|math) "github.com/(fmt|math)"! !g' \

errbase/internal/unknown.pb.go

Lines changed: 17 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

errorspb/errors.pb.go

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

errorspb/hintdetail.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

errorspb/markers.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

errorspb/tags.pb.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

errorspb/testing.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extgrpc/ext_grpc.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
package extgrpc
1616

17-
//go:generate protoc ext_grpc.proto --gogofaster_out=.
18-
1917
import (
2018
"context"
2119
"fmt"

0 commit comments

Comments
 (0)