varlink / go

Golang implementation of the Varlink protocol
https://godoc.org/github.com/varlink/go/varlink
Apache License 2.0
55 stars 57 forks source link

Can not parse Systemd's varlink definitions #28

Closed arianvp closed 2 years ago

arianvp commented 2 years ago

I am not sure if this is a bug in your implementation or systemd not implementing the spec correctly

But systemd defines a varlink interface here:

https://systemd.io/USER_GROUP_API/

But this library fails to parse it with the following error:

Error parsing file 'io.systemd.UserDatabase.varlink': unknown keyword ''

Trial and error seems to suggest this library is choking over the fact that UserDatabase is capitalized in the interface name. Are interface definitions not allowed to have capital letters in them? Or is this a bug in this library?

interface io.systemd.UserDatabase

method GetUserRecord(
        uid : ?int,
        userName : ?string,
        service : string
) -> (
        record : object,
        incomplete : bool
)

method GetGroupRecord(
        gid : ?int,
        groupName : ?string,
        service : string
) -> (
        record : object,
        incomplete : bool
)

method GetMemberships(
        userName : ?string,
        groupName : ?string,
        service : string
) -> (
        userName : string,
        groupName : string
)

error NoRecordFound()
error BadService()
error ServiceNotAvailable()
error ConflictingRecordFound()
error EnumerationNotSupported()
arianvp commented 2 years ago

Hmmm the spec seems to suggest that indeed interface_name needs to be lower case https://varlink.org/Interface-Definition#grammar

I'll open a bug with systemd then

poettering commented 2 years ago

It's a known incompat of systemd's varlink logic and the original specs. I am not convinced we should change this nowadays though, it's API after all. Given that systemd is the only major user of varlink these days I am not too concerned that this is refused elsewhere.

Limiting the domains to lowercase is pretty arbitrary I would say, given that both cases are allowed for everything else.

poettering commented 2 years ago

(there's already a bug somewhere about this)

arianvp commented 2 years ago

Ah super! thanks for the quick comment. I'll hunt down the duplicate bug (or if you can find it let me know); and then see if we can open a discussion on lfiting this limitation from the code generators.

arianvp commented 2 years ago

Hunted down the issue for reference: https://github.com/systemd/systemd/issues/15952

haraldh commented 2 years ago

Also fixed python: https://github.com/varlink/python/pull/28