Does anybody know why dbus exists? I’ve been wracking my brain trying to come up with a usecase for dbus that isn’t already covered by Unix sockets.

You want to remotely control a daemon? Use sockets. You want the daemon to respond to the client? Sockets. Want to exchange information in json? plaintext? binary data? Sockets can do it. Want to restrict access to a socket? Go ahead, change the socket’s permissions. Want to prevent unauthorized programs from pretending to be someone they’re not? Change the permissions of the directory containing the socket. Want network transparency? That’s why we have abstract sockets.

Plenty of well-established software uses sockets. Music player daemon uses sockets. BSPWM uses sockets. Tmux uses sockets. Pipewire uses sockets. Dhcpcd uses sockets. Heck, dbus itself relies on sockets!

For developers, using sockets is easy. I once wrote a program that interfaced with BSPWM, and it was a breeze. Dbus, on the other hand, not so much. I tried writing a Python script that would contact Network Manager and check the WiFi signal strength. Right off the bat I’m using some obscure undocumented package for interfacing with dbus. What is an introspection? What is a proxy object? What is an interface? Why do I need 60 lines of (Python!) code for a seemingly trivial operation?

So why do some developers decide to use dbus when they could just use unix sockets and save a lot of hassle for themselves and others?

  • Quazatron@lemmy.world
    link
    fedilink
    arrow-up
    30
    arrow-down
    11
    ·
    6 months ago

    It would not be created if existing plumbing covered all use cases.

    Don’t assume you know better and that developers are simply reinventing the wheel.

    • Bobby Turkalino@lemmy.yachts
      link
      fedilink
      English
      arrow-up
      19
      arrow-down
      7
      ·
      6 months ago

      Reinventing the wheel? Making new systems which create more problems than they solve? Adding abstractions which actually make things more complex?

      Nah, those things have never happened in software

      • redcalcium@lemmy.institute
        link
        fedilink
        arrow-up
        9
        ·
        6 months ago

        Every 10 years, a new abstraction layer will be added to the system. I wonder how an average linux desktop would look like under the hood in 100 years.

      • Quazatron@lemmy.world
        link
        fedilink
        arrow-up
        4
        ·
        6 months ago

        There is a lot of ‘reinventing the wheel’ in software, and I did not claim otherwise.

        When new abstractions are beneficial, other programs take advantage of them and the whole ecosystem moves forward. When they are not, nobody cares and they are ignored and die. In that respect, open source software development is very much like evolution.

        Judging by apps using it, looks like this abstraction is indeed useful.