Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

service side: interface must be optional for methods if unambiguous #45

Open
NTCoding opened this issue May 23, 2013 · 3 comments
Open

Comments

@NTCoding
Copy link

If I create the service from the example, I get the following on the command line

╰─➤ qdbus org.ruby.service /org/ruby/MyInstance
signal void org.ruby.SampleInterface.SomethingJustHappened(QString toto, uint tutu)
method void org.ruby.SampleInterface.hello(QString name, QString name2)
method void org.ruby.SampleInterface.test_variant(QDBusVariant stuff)
method QString org.ruby.AnotherInterface.Reverse(QString instr)
method void org.ruby.AnotherInterface.ThatsALongMethodNameIThink()

Notice there is no introspect method. Also, I can't call any of the methods, I get the following error:

╰─➤ qdbus org.ruby.service /org/ruby/MyInstance Reverse "yay"
Error: org.freedesktop.DBus.Error.UnknownMethod
Interface "" of object "/org/ruby/MyInstance" doesn't exist

I have created multiple service, in different applications, but still keep getting this error. When the method genuinely doesn't exist, there is another different error saying it cannot be found.

@mvidner
Copy link
Owner

mvidner commented May 27, 2013

Thanks for the report!

  • Not introspectable: yes and no

It is true that org.freedesktop.DBus.Introspectable.Introspect is missing from the qdbus output, but introspection does work, in fact qdbus uses it to get that output.

$ qdbus org.ruby.service /org/ruby/MyInstance org.freedesktop.DBus.Introspectable.Introspect
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.ruby.SampleInterface">
<method name="hello">
<arg name="name" direction="in" type="s"/>
<arg name="name2" direction="in" type="s"/>
</method>
<method name="test_variant">
<arg name="stuff" direction="in" type="v"/>
</method>
<signal name="SomethingJustHappened">
<arg name="toto" type="s"/>
<arg name="tutu" type="u"/>
</signal>
</interface>
<interface name="org.ruby.AnotherInterface">
<method name="ThatsALongMethodNameIThink">
</method>
<method name="Reverse">
<arg name="instr" direction="in" type="s"/>
<arg name="outstr" direction="out" type="s"/>
</method>
</interface>
</node>

@mvidner
Copy link
Owner

mvidner commented May 27, 2013

  • Cannot call methods: yes and no

As the error message is trying to tell you (Interface "" of ... does not exist), ruby-dbus requires method names to be qualified with the interface name. So this works:

$ qdbus org.ruby.service /org/ruby/MyInstance org.ruby.AnotherInterface.Reverse gateman
nametag

Also, ruby-dbus as the caller is able to fill in the interface from the introspection data (see PR #35), but as I've just realized on rereading the specification, that's a wrong place to fix it since the service should handlle it:

A method call message is required to have a MEMBER header field indicating the name of the method. Optionally, the message has an INTERFACE field giving the interface the method is a part of. In the absence of an INTERFACE field, if two interfaces on the same object have a method with the same name, it is undefined which of the two methods will be invoked. Implementations may also choose to return an error in this ambiguous case. However, if a method name is unique implementations must not require an interface field.

So I will fix that.

stoffie pushed a commit to stoffie/ruby-dbus that referenced this issue Sep 12, 2013
stoffie pushed a commit to stoffie/ruby-dbus that referenced this issue Sep 12, 2013
stoffie pushed a commit to stoffie/ruby-dbus that referenced this issue Sep 12, 2013
stoffie pushed a commit to stoffie/ruby-dbus that referenced this issue Sep 12, 2013
stoffie pushed a commit to stoffie/ruby-dbus that referenced this issue Sep 12, 2013
@mvidner
Copy link
Owner

mvidner commented Jan 7, 2014

Funny thing, the newest release of the DBus specification (0.23 from yesterday) no longer requires that a missing interface works. It is discussed in bug#68597. But I'll fix it anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants