protocolbuffers/protobuf

protoc cli returns success with --fatal_warnings switch when warnings are detected

Open

#10.486 geöffnet am 1. Sept. 2022

Auf GitHub ansehen
 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C++ (16.128 Forks)batch import
help wantedprotoc

Repository-Metriken

Stars
 (71.223 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 2T 11h) (185 gemergte PRs in 30 T)

Beschreibung

Version: libprotoc 3.19.4 Language: NA OS: OSX, installed via brew

Steps to reproduce the behavior:

  1. open a terminal (I use zsh)
  2. decode a protobuf file for which a warning will be emitted using the --fatal_warnings switch
  3. check the command return value
$ cat temp.in.pbuf | protoc  --decode job_definition.job_t --fatal_warnings --proto_path ~/workspace/engine/proto/ job.proto > /dev/null
warning:  Input message is missing required fields:  country[0].id, country[1].id
$ echo $?
0

notice the contract include

message country_t {
	required int32 id = 1;
	required string country = 2;
}

and the encode file does not indeed have an id field, i.e. the warning is correct.

What did you expect to see protoc shall return a non-zero error

What did you see instead? protoc returns 0

Contributor Guide