New issue
Advanced search Search tips

Issue 908239 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

Consider adding Go bindings for cryptohome protobufs in system_api

Project Member Reported by derat@chromium.org, Nov 25

Issue description

I made a brief effort to create Go bindings for cryptohome's rpc.proto file in system_api so that some Tast code could call cryptohomed over D-Bus instead of running the cryptohome command, but I kept getting errors like this:

>>> Installing (1 of 1) chromeos-base/system_api-9999::chromiumos to /build/caroline/
 * Running stacked hooks for pre_pkg_preinst
 *    wrap_old_config_scripts ...                                                                                                        [ ok ]
[/build/caroline/usr/lib/gopath/src/chromiumos/system_api/cryptohome/rpc.pb.go:61:8: local import "." in non-local package]

If I'm remembering correctly, it was objecting to a line like this in the generated code:

  import cryptohome1 "."

I think that all of the existing system_api .proto files that we generate Go bindings for are using proto3. rpc.proto is still proto2, so I suspect that that may be related to the error. Switching the files to proto3 felt a bit more involved than I was up for, so I wasn't able to confirm that.
 
I think I ran into this before. I suspect the problem isn't proto2, but rather the import in rpc.proto. I think protoc for go prefers to have all of the .proto files provided at once, but it should be possible to do them one at a time if the paths are set correctly: https://github.com/twitchtv/twirp/issues/15#issuecomment-359325934

And from https://developers.google.com/protocol-buffers/docs/proto
"In general you should set the --proto_path flag to the root of your project and use fully qualified names for all imports."

So maybe instead of setting proto_in_path to "dbus/cryptohome" we need to set that to "." and then provide the full paths for the .proto files.
Status: Available (was: Untriaged)
Thanks for the details, Stephen!

Sign in to add a comment