protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

protoc: does not verify that json_name does not conflict

Open dsnet opened this issue 6 years ago • 6 comments

Using protoc v3.6.1.

Compile this file:

syntax = "proto3";
message M {
	string f1 = 1 [json_name = "fooBar"];
	string f2 = 2 [json_name = "fooBar"];
}

What I see: compile succeeds. What I expect: compilation failure since fooBar is specified twice.

dsnet avatar Aug 21 '18 01:08 dsnet

Is there appetite for reviewing and accepting a fix for this and for #7192, if I were to open a pull request?

jhump avatar Sep 18 '20 02:09 jhump

@jhump Sure, I can review the pull request if you would like to work on it.

acozzette avatar Sep 18 '20 18:09 acozzette

@mcy, @mkruskal-google, can this be reopened since the fix was reverted in #10657?

jhump avatar Sep 28 '22 23:09 jhump

I think you can roll both of these forward. Part of the issue is that our full test suite wasn't even run over your initial PR. The other part of the problem was that downstream code (both internal and external) was broken by it. That's not necessarily a blocker, but it does mean we need to be more careful about merging it in

mkruskal-google avatar Sep 28 '22 23:09 mkruskal-google

@mkruskal-google, to make sure I understand your comment above: are you suggesting I open a new PR with this same fix, and that it simply needs to be merged more carefully next time (like running more tests and possibly requiring some internal changes before those tests all pass)?

jhump avatar Oct 03 '22 17:10 jhump

Yes exactly! If you can get some information from jaysachs about why that one failed in kythe it would be helpful. But part of the problem is that our tests weren't even fully run on your PRs, so it's likely they'll show some of the issues. I can also manually port it into Google to check it internally

mkruskal-google avatar Oct 03 '22 19:10 mkruskal-google