Skip to content

Calls to dbus hang when using invalid characters #13

@bcwaldon

Description

@bcwaldon

Repro steps

  1. Create a new instance of go-systemd's dbus.Conn
  2. Call GetUnitInfo with a dbus path containing unsupported characters

Result:
The process will hang

Expected:
Return an error telling me I've asked to do the impossible

Here's a script to illustrate the problem:

package main

import (
        systemdDbus "github.com/coreos/go-systemd/dbus"
        "github.com/guelfey/go.dbus"
        "os"
)

func main() {
        systemd := systemdDbus.New()
        path := dbus.ObjectPath(os.Args[1])
        info, _ := systemd.GetUnitInfo(path)
        println(info["ActiveState"].Value().(string))
}

Build this and run something like

./test ./test /org/freedesktop/systemd1/unit/ping.service

vs.

./test /org/freedesktop/systemd1/unit/ping_2eservice

This describes valid dbus paths: http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-marshaling-object-path

This should illustrate what encoding systemd expects: http://cgit.freedesktop.org/systemd/systemd/tree/src/shared/util.c#n1360

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions