Search code examples
linuxsystemddbus

How do I set a dbus property to a negative value with busctl?


I'm trying to use busctl to set a property of type double to a negative value. Positive values are fine:

busctl set-property com.acme.foo /com/acme/foo com.acme.foo.Interface inflation d 1.0

but trying to change this to a negative value gives the following error:

busctl set-property com.acme.foo /com/acme/foo com.acme.foo.Interface inflation d -1.0
busctl: invalid option -- '1'

I've tried the obvious things like putting -1.0 in single, double quotes or using a backslash to escape the -. There is a -- option but that doesn't seem to have any effect.


Solution

  • busctl -- set-property com.acme.foo /com/acme/foo com.acme.foo.Interface inflation d -1.0

    The -- option tells busctl that everything after the -- is not an option. Like many unix tools, busctl uses optarg for it's command line parsing. See man optarg for more info on this.