Only the root element can omit the node name, as it's known to be the object that was introspected. If the root does have a name attribute, it must be an absolute object path. If child have object paths, they must be relative.
If a child has any sub-elements, then they must represent a complete introspection of the child. If a child is empty, then it may or may not have sub-elements; the child must be introspected in order to find out. The intent is that if an object knows that its children are "fast" to introspect it can go ahead and return their information, but otherwise it can omit it.
I suggest we return 0 (exit(0)) in such case.
Steps to reproduce
generate interfaces from root node without a name
echo $? => 3
Screenshots
<!--
This is a comment.
Please fill in the required fields below.
The comments provide instructions on how to do so.
Note: You do not need to remove comments.
-->
## Basic information
- TDE version: R14.1.0
- Distribution: Debian Buster
- Hardware: amd64
<!--
Use SL/* labels to set the severity level.
Please do not set a milestone.
-->
## Description
[Introspection Data Format](https://dbus.freedesktop.org/doc/dbus-specification.html#introspection-format) states that only root node name can be omitted
> Only the root <node> element can omit the node name, as it's known to be the object that was introspected. If the root <node> does have a name attribute, it must be an absolute object path. If child <node> have object paths, they must be relative.
>
> If a child <node> has any sub-elements, then they must represent a complete introspection of the child. If a child <node> is empty, then it may or may not have sub-elements; the child must be introspected in order to find out. The intent is that if an object knows that its children are "fast" to introspect it can go ahead and return their information, but otherwise it can omit it.
I suggest we return 0 (exit(0)) in such case.
## Steps to reproduce
1. generate interfaces from root node without a name
2. echo $? => 3
## Screenshots
<!-- If it seems useful, please provide provide one or more screenshots. -->
The problem is that it should not exit with error, because it is a valid use case.
So if you want to generate the interfaces you can do this without dbusxml2qt3 exiting with error and if you want a code for the root node you can generate with -n -c.
Returning 3 breaks cmake in a legitim use case.
The error message is OK (should be interpreted as warning).
I came upon this when trying to use automated interface generated.
When using dbusxml2qt3 on the command line no one is checking the exit code.
The problem is that it should not exit with error, because it is a valid use case.
So if you want to generate the interfaces you can do this without dbusxml2qt3 exiting with error and if you want a code for the root node you can generate with -n -c.
Returning 3 breaks cmake in a legitim use case.
The error message is OK (should be interpreted as warning).
I came upon this when trying to use automated interface generated.
When using dbusxml2qt3 on the command line no one is checking the exit code.
Hi Emanoil, first of all thanks for the explanation.
Say you have a "test.xml" file with a root node without a name.
If you run
dbusxml2qt3 test.xml
you get the error you described. This happens because you are trying to generate a class node and there is no class name specified (either in the .xml file or on CLI) so it is not possible to continue correctly. The program is exiting because it is invoked incorrectly.
If you run
dbusxml2qt3 -c testNode test.xml
the interfaces and the class node are correctly generated and there is no error.
If you run
dbusxml2qt3 test.xml -i
the interfaces are correctly generated and there is no error, since you are not asking to generate any class node.
In light of the above, the fix you proposed in #26 is wrong and not necessary in my opinion. So if you agree with me, I will close that PR.
One thing where dbusxml2qt3 could be improved, is the way parameters are passed. Invoking
dbusxml2qt3 test.xml -i
is weird. It should be something like one of the following:
where the options are specified before the xml file and we use a mean to specify when the interface name is not required (otherwise "dbusxml2qt3 -i test.xml" would use test.xml as an interface name :-( ).
What do you think?
Hi Emanoil, first of all thanks for the explanation.
Say you have a "test.xml" file with a root node without a name.<br/>
If you run
```
dbusxml2qt3 test.xml
```
you get the error you described. This happens because you are trying to generate a class node and there is no class name specified (either in the .xml file or on CLI) so it is not possible to continue correctly. The program is exiting because it is invoked incorrectly.<br/>
If you run
```
dbusxml2qt3 -c testNode test.xml
```
the interfaces and the class node are correctly generated and there is no error.
If you run
```
dbusxml2qt3 test.xml -i
```
the interfaces are correctly generated and there is no error, since you are not asking to generate any class node.
In light of the above, the fix you proposed in #26 is wrong and not necessary in my opinion. So if you agree with me, I will close that PR.
One thing where dbusxml2qt3 could be improved, is the way parameters are passed. Invoking
```
dbusxml2qt3 test.xml -i
```
is weird. It should be something like one of the following:
```
dbusxml2qt3 -i <interface name> test.xml
dbusxml2qt3 -I test.xml
dbusxml2qt3 -i -- test.xml
```
where the options are specified before the xml file and we use a mean to specify when the interface name is not required (otherwise "dbusxml2qt3 -i test.xml" would use test.xml as an interface name :-( ).
What do you think?
you might be correct, I don't know for sure. TBH I was expecting the opposite as in the code it says "generateAll", means it should generate all.
If I supply -i it will generate only the interfaces, if I supply only -p it will generate only the proxies. So I was expecting by invoking the command without parameters to create whatever it can and subsequentially run it with -n -c if I would need a RootNode class to refer to all interfaces included.
regarding the arguments indeed it can be improved ...
Leave it in WIP, I will play a bit more with that.
Hi Michele,
you might be correct, I don't know for sure. TBH I was expecting the opposite as in the code it says "generateAll", means it should generate all.
If I supply -i it will generate only the interfaces, if I supply only -p it will generate only the proxies. So I was expecting by invoking the command without parameters to create whatever it can and subsequentially run it with -n -c if I would need a RootNode class to refer to all interfaces included.
regarding the arguments indeed it can be improved ...
Leave it in WIP, I will play a bit more with that.
So I was expecting by invoking the command without parameters to create whatever it can
Hi Emanoil, it may be a matter of interpretation. Without parameters it is more like "try to generate all" which of course includes a class node as well. When the root node has a name attribute, this works fine. If there is no node attribute and none is provided on the command line, either we skip the class node in full (meaning we don't exit, we simply skip the class node) or we keep the current behavior.
I see in the usage of dbusxml2qt3 that it says "Generates as much as possible, i.e. interfaces, proxies and, if a node name is specified in 'myinterface.xml', the node files", so perhaps you can come up with a PR where if no class node exists, we skip the class node and we simply print a warning message.
> So I was expecting by invoking the command without parameters to create whatever it can
Hi Emanoil, it may be a matter of interpretation. Without parameters it is more like "try to generate all" which of course includes a class node as well. When the root node has a name attribute, this works fine. If there is no node attribute and none is provided on the command line, either we skip the class node in full (meaning we don't exit, we simply skip the class node) or we keep the current behavior.
I see in the usage of dbusxml2qt3 that it says "Generates as much as possible, i.e. interfaces, proxies and, if a node name is specified in 'myinterface.xml', the node files", so perhaps you can come up with a PR where if no class node exists, we skip the class node and we simply print a warning message.
this sounds like a great idea and is exactly what I was looking for and what was confusing me, because a node without a name is assumed to be a root node. In such case if desired run dbusxml2qt3 a second time for that purpose with node and class arguments.
I'll do a new PR when ready
thanks and regards
Hi Michele,
this sounds like a great idea and is exactly what I was looking for and what was confusing me, because a node without a name is assumed to be a root node. In such case if desired run dbusxml2qt3 a second time for that purpose with node and class arguments.
I'll do a new PR when ready
thanks and regards
Basic information
Description
Introspection Data Format states that only root node name can be omitted
I suggest we return 0 (exit(0)) in such case.
Steps to reproduce
Screenshots
Hi Emanoil, I am not sure I understand what the problem is here exactly.
Could you explain in more detail?
The problem is that it should not exit with error, because it is a valid use case.
So if you want to generate the interfaces you can do this without dbusxml2qt3 exiting with error and if you want a code for the root node you can generate with -n -c.
Returning 3 breaks cmake in a legitim use case.
The error message is OK (should be interpreted as warning).
I came upon this when trying to use automated interface generated.
When using dbusxml2qt3 on the command line no one is checking the exit code.
Hi Emanoil, first of all thanks for the explanation.
Say you have a "test.xml" file with a root node without a name.
If you run
you get the error you described. This happens because you are trying to generate a class node and there is no class name specified (either in the .xml file or on CLI) so it is not possible to continue correctly. The program is exiting because it is invoked incorrectly.
If you run
the interfaces and the class node are correctly generated and there is no error.
If you run
the interfaces are correctly generated and there is no error, since you are not asking to generate any class node.
In light of the above, the fix you proposed in #26 is wrong and not necessary in my opinion. So if you agree with me, I will close that PR.
One thing where dbusxml2qt3 could be improved, is the way parameters are passed. Invoking
is weird. It should be something like one of the following:
where the options are specified before the xml file and we use a mean to specify when the interface name is not required (otherwise "dbusxml2qt3 -i test.xml" would use test.xml as an interface name :-( ).
What do you think?
Hi Michele,
you might be correct, I don't know for sure. TBH I was expecting the opposite as in the code it says "generateAll", means it should generate all.
If I supply -i it will generate only the interfaces, if I supply only -p it will generate only the proxies. So I was expecting by invoking the command without parameters to create whatever it can and subsequentially run it with -n -c if I would need a RootNode class to refer to all interfaces included.
regarding the arguments indeed it can be improved ...
Leave it in WIP, I will play a bit more with that.
Hi Emanoil, it may be a matter of interpretation. Without parameters it is more like "try to generate all" which of course includes a class node as well. When the root node has a name attribute, this works fine. If there is no node attribute and none is provided on the command line, either we skip the class node in full (meaning we don't exit, we simply skip the class node) or we keep the current behavior.
I see in the usage of dbusxml2qt3 that it says "Generates as much as possible, i.e. interfaces, proxies and, if a node name is specified in 'myinterface.xml', the node files", so perhaps you can come up with a PR where if no class node exists, we skip the class node and we simply print a warning message.
Hi Michele,
this sounds like a great idea and is exactly what I was looking for and what was confusing me, because a node without a name is assumed to be a root node. In such case if desired run dbusxml2qt3 a second time for that purpose with node and class arguments.
I'll do a new PR when ready
thanks and regards
no problem. I will close #26 as invalid. Just create a new one when you are done 😉
IMO PR#27 seems to be working as suggested
Solved by PR #27.