-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Incorrect code generation for systemd StartTransientUnit #254
Comments
Thanks for the report. I fixed this in my latest commit. I also improved the naming for the created struct classes to include the name of the argument/parameter it belongs to. This means you will get a StartTransientUnitAuxStruct and a StartTransientUnitPropertiesStruct class. I think this would improve the understanding on where the struct classes are used instead of naming them StartTransientUnitStruct and StartTransientUnitStructStruct etc. |
Fantastic. I've updated my code to use your latest code and it works perfectly. Thank you! It isn't a concern for me, but wouldn't the new naming scheme for structs be a backwards-incompatible change? It seems like that could be a suprising change in a minor release. I don't know what your compatibility model for the library is, or if this change only affects the broken codegen anyways. |
Yes this is indeed a breaking change, but it only affects the code generator - therefore I'm fine that. The InterfaceCodeGenerator is usually used once by a developer to create the required classes/interfaces. After that there is no need to re-run it. The only reason to re-run would be updating the interfaces due to changes on the program exposing those interfaces on DBus. In this case it would be necessary to review and test your own code anyway. The compatibility model is usually "no breaking changes in same major". But this is only true for the library (core) and the required transports - not for the utils or examples. |
The code generated by the code generator seems to add an extra parameter, or maybe I'm just confused about what the parameter should contain?
Code generation code snippet:
Generated method in the generated class:
Based on this dbus spec:
The "properties" parameter should be a key-value pairs array where the key is a string and the value is a Variant. D-Spy lists it as
StartTransientUnit(string name, string mode, a(sv) properties, a(sa(sv)) aux) -> (Object Path job)
(also not sure whyproperties
andaux
are the same in the generated code when they have different dbus signatures).Here's what a run of
systemd-run --user --pty ps aux
looks like in Bustle (dbus traffic capture):Signature
ssa(sv)a(sa(sv))
Body (notice that the angle brackets represent a Variant, and the aux param is the empty array starting with
@a
):"run-u228.service", "fail", [("Description", <"/usr/bin/ps aux">), ("AddRef", <true>), ("StandardInput", <"tty">), ("StandardOutput", <"tty">), ("StandardError", <"tty">), ("TTYPath", <"/dev/pts/1">), ("Environment", <["TERM=xterm-256color"]>), ("ExecStart", <[("/usr/bin/ps", ["/usr/bin/ps", "aux"], false)]>)], @a(sa(sv)) [])
Generated StartTransientUnitStruct class (see my inserted java comments):
I think
StartTransientUnitStruct
may actually be the type for the aux array type, but it'susing it for both
properties
andaux
?StartTransientUnitStructStruct
seems like it's the actual appropriate type for values in theproperties
array.Generated StartTransientUnitStructStruct class:
Lastly, here's my data types that I'm using for now since the generated code isn't correct:
And here's my code to call
StartTransientUnit
:Thank you for your time. Please let me know if I can provide any more information.
dbus-java version info:
Commit 0e8a16d (built from master 2024-3-24) (5.0.1-SNAPSHOT)
The text was updated successfully, but these errors were encountered: