News for hackers. Stuff that matters.
Re:DBus, FreeDesktop, and lots of madness by captainmuon on Sunday November 23, 2014 @07:42AM (#8648617)
I really liked the "predecessor" DCOP better. Applications publish objects, others can call methods (one-shot) or functions (wait for response).

From DBUS' own (old) FAQ:

> D-Bus is a bit more complex than DCOP, though the Qt binding for D-Bus should not be more complex for programmers. The additional complexity of D-Bus arises from its separation of object references vs. bus names vs. interfaces as distinct concepts, and its support for one-to-one connections in addition to connections over the bus. The libdbus reference implementation has a lot of API to support multiple bindings and main loops, and performs data validation and out-of-memory handling in order to support secure applications such as the systemwide bus.

> D-Bus is probably somewhat slower than DCOP due to data validation and more "layers" in the reference implementation. A comparison hasn't been posted to the list though.

IMHO DBus suffers from the kind of overengineering that's been endemic in Desktop Linux in the last few years: DConf/GSettings (as a less flexible, IMHO unneccessary replacement for GConf), PulseAudio and NetworkManager (initially really bad, now work nicely, as long as you don't have to debug problems...), all the *Kit stuff, systemd, and so on. For me, libraries like this don't really solve problems on average, but cause regressions.

Re:DBus, FreeDesktop, and lots of madness by hp on Sunday November 23, 2014 @08:37AM (#8648750)
I think people who haven't hacked on making nice UIs for system features don't understand what problems these things solve. But people who have do, and that's why they code them.

Is there a simpler, less-engineered way? Probably, in the truism sense that all software sucks. But then, anyone could have coded this better way and made it work, and they didn't. So the current work has the advantage that somebody did it and it exists. I'll take that.

Knowing the problems solved here I actually think the current stuff is pretty good. Not flawless -it's software - but good. It does pretty much work. Go use 15 year old Linux if you want to replace nostalgic memories with a good dose of how much it sucked :-p

Re:DBus, FreeDesktop, and lots of madness by djcb on Sunday November 23, 2014 @09:27AM (#8648860)
Agreed -- I remember some of the alternative ways to solve the same problems, such as CORBA and various custom protocols, but they were painful to use...

Now, early DBus was a bit lacking in that respect as well, but with GDBus (GLib's DBus implementation) it's become as straightforward as IPC can be, even in plain C; I've seen quite a few people new to the technology that were able to get up to speed with it quickly.

It'll be interesting to see how people are taking DBus and pushing the boundaries of what it can be used for, such as kdbus.

Thank you hp!

Re:DBus, FreeDesktop, and lots of madness by emcrazyone on Sunday November 23, 2014 @12:45PM (#8649320)
Interesting perspective. I thought I read somewhere that ZeroMQ was championing becoming apart of the Kernel. I work in the embedded space and not knowing much about DBUS other than it's some fancy IPC and ZeroMQ, we went with ZeroMQ just because we saw a clear path for what we needed get done. Granted all our IPC communication was between our own apps. but after reading your post I keep wondering what REAL problems does DBUS solve besides having a standard messaging format? Could someone explain why a simple messaging format couldn't be deployed on top of something like ZeroMQ?
Re:DBus, FreeDesktop, and lots of madness by hp on Sunday November 23, 2014 @01:37PM (#8649459)
This probably deserves a long blog post or something (maybe I already wrote it somewhere) but here's a teaser.

dbus is not mostly about IPC.

Linux desktops, including gnome, KDE, and those before them and alternatives to them now, use a "swarm of processes" architecture. This is as opposed to an alternative like smalltalk, Eclipse, Firefox, or Emacs where lots of plugins are loaded into one huge process.

Problems common in server side IPC which aren't as big an issue here: scalability; network partitioning; protocol interoperability.

Problems which are more of an issue: service discovery (can't just use DNS); tracking lifecycle of other processes; inherent singleton, stateful nature of hardware, the kernel, and user interfaces.

The main way dbus helps with this is the star topology with a daemon that can start on demand and track all the processes. IPC is then coordinated with this in such a way that race conditions can be avoided, for example you can start a service and send it a command without a race that your command arrives too soon.

Anyhow this is just enough to get an interested person tracking down the details, I'm not spelling it out obviously.

Re:DBus, FreeDesktop, and lots of madness by mikepurvis on Sunday November 23, 2014 @01:44PM (#8649477)
dbus handles a lot of cases where you have an unprivileged process like a GUI widget communicating information to a root process like a network manager. Because it's centralized and everything flows through the dbus process, a lot of it is about policy enforcement— ie, these methods can be called by this user or group, these other ones by this other group, etc.

Examples of the configuration which controls this kind of thing:

https://github.com/mungerd/vncbox/blob/master/data/dbus-conf... http://git.kernel.org/cgit/network/connman/connman.git/tree/...

Re:DBus, FreeDesktop, and lots of madness by tenfingers on Sunday November 23, 2014 @08:34AM (#8648741)
I'm not against any of these projects in particular (they all solve a specific problem), however as you describe, all the recent infrastructure being pushed on desktop and servers is poorly designed and initially badly implemented. I cannot even blame the distributions, as projects such as DBus/-Kit/etc were initially just part of other, unrelated, projects that got mass adoption.

The implementation got better (actually, systemd partially got rid of many -Kit components which never truly worked, which IMHO, doing us a favor), but the design is still wonky, still poorly documented, very difficult to debug as a result and understand as a whole.

The fact that these tools rely on self-describing protocols with one single implementation without documentation also results in very tight coupling.

It's also shifting the idea of having a cli interface to perform a task to a dbus interface. Often without any documentation of the dbus interface itself to begin with (or with a crappy cli wrapper).

Re:DBus, FreeDesktop, and lots of madness by catern on Sunday November 23, 2014 @04:38PM (#8650031)
How exactly is a CLI wrapper supposed to work without some kind of IPC? Most components of the system have an associated daemon running and maintaining them. You need some kind of way to communicate to that daemon. DBUS is the most common and easiest way.
Re:DBus, FreeDesktop, and lots of madness by stevejones on Monday November 24, 2014 @08:25AM (#8652236)
Most components of the system /are/ a daemon. Most of the terrible decisions in Linux infrastructure of the last 10 years have been making daemons where a protocol would would do the job more simply.
Re:DBus, FreeDesktop, and lots of madness by userbinator on Sunday November 23, 2014 @12:00PM (#8649195)
IMHO DBus suffers from the kind of overengineering that's been endemic in Desktop Linux in the last few years

It's not just Desktop Linux; I've noticed the overengineering trend in basically... all software. There's many contributing factors, probably one of the biggest being the second-system effect ("there were some problems with the old way of doing it so let's find a new way that fixes them - and all the problems that could possibly occur in the future, whether or not they may actually become problems"). I think YAGNI needs to be applied far more often than it currently is.

The solution to complexity should not involve adding more complexity.

Re:DBus, FreeDesktop, and lots of madness by guard-of-terra on Sunday November 23, 2014 @08:03AM (#8648669)
The main problem is, DCOP was explicit about it being a quick hack.

While DBus featured a huge amount of bombast from the day one while being really slow on useful things. I think they did not even have a proper console client a few years into development and some shipping.

"due to data validation and more "layers""

You can't really have data validation and proper layers without a spec. You just can't, it would be an annoyance instead of useful feature.

Re:DBus, FreeDesktop, and lots of madness by hp on Sunday November 23, 2014 @09:06AM (#8648814)
Speed wasn't the right design goal for a mechanism used mostly for control purposes that simply didn't have to be fast. Least-common-denominator flexible implementation was the most important thing (threads or main loop, no dependencies, etc) in order to be adopted. And then validation was required to use it on system contexts not only trusted in-user-session contexts. It also had to swap in for both DCOP (KDE) and CORBA (GNOME). These were the choices that made it viable and why it became widely used.

Many years later people decided it would be nice to have performance too so they reimplemented with more assumptions that didn't used to be safe, and did the kdbus work. The result is still compatible with the original protocol because it was always possible to make a fast implementation.

This is how open source works. People do what they care about. When speed came to the top of the list people did it.

Adoption speaks for itself. Things are adopted when they are a viable solution. Others thought speed was the key and they were wrong; dbus was adopted precisely because it focused elsewhere. But speed wasn't precluded by the design and when people cared they solved it.

Re:DBus, FreeDesktop, and lots of madness by toyg on Sunday November 23, 2014 @09:46AM (#8648898)
> Adoption speaks for itself

Well, DBus was politically pushed onto KDE back in the day, when there was a strong interest in making a success out of cooperation efforts in the Linux desktop space. IIRC, KDE was basically strong-armed out of DCOP.

Once it was established as "the official IPC on the two dominant Linux desktops", it would have been difficult to ignore it regardless of its actual quality.

Re:DBus, FreeDesktop, and lots of madness by hp on Sunday November 23, 2014 @10:34AM (#8648995)
In creating dbus, I talked to a bunch of developers at KDE, specifically those who worked on Qt and DCOP, about their requirements. Then I met the requirements they said I had to meet for them to use dbus. I did the same for developers at GNOME. Because dbus met the requirements that the actual decision-making developers had, and allowed them to do useful things, it was adopted.

There was no mechanism to strongarm anybody into anything. KDE and GNOME devs told many ideas and many people to take a hike over the years. dbus was simply a matter of figuring out what those developers wanted and focusing on solving the actual problem, rather than hypothetical or philosophical problems.

When dbus was adopted, remember, people had already been down many roads; ad hoc IPC mechanisms, ad hoc communication through files and timestamps, hacks over X11 protocol, DCOP, multiple implementations of CORBA, SOAP, ICE (the old X-associated one), etc. People had wrestled with this problem space a lot and they had some pretty developed ideas about how to do things ideally. dbus was about coalescing those ideas into running code, and that was successful and stuck for a decade-plus now.

People sometimes have a "wtf" reaction coming from Internet protocols or kernel concerns, and while there are some wtf-worthy details in any piece of software, lots of the time people just don't understand the problem. Just as GNOME and KDE both took years to understand it and flailed around with all those protocols that didn't work out well.

Re:DBus, FreeDesktop, and lots of madness by toyg on Sunday November 23, 2014 @01:20PM (#8649409)
The chronology I remember is a bit different (GNOME needed a replacement for CORBA and came up with DBUS; KDE already had DCOP; then Freedesktop happened, with big players pushing to reduce mismatches so that they could ship both environments with less hassle; and KDE scored some and GNOME scored some (more), with DBUS being one of them), but I was just a random observer so I might have got it wrong.

Still, it's a fact that DCOP back then felt much nicer and more humane (I wouldn't know about speed). I haven't used Linux in a while so I honestly don't know now.

Re:DBus, FreeDesktop, and lots of madness by flying-sheep on Sunday November 23, 2014 @07:17PM (#8650481)
i’m usually reading usernames after reading the posts and voting, and i caught myself upvoting every single post of you and nothing else.

you seem to do it right: most level-headed, most informative. thanks.

Re:DBus, FreeDesktop, and lots of madness by digi_owl on Sunday November 23, 2014 @10:27AM (#8648976)
That seems to be the story of freedesktop.org in total.

It was, iirc, supposed to be a place for KDE and Gnome to hammer out some cooperative issues, so that programs related to each project would coexist better.

These days it seems like Gnome (or maybe i should say Red Hat?) is running the place, with KDE doing its own thing and glancing over the fence from time to time.

Re:DBus, FreeDesktop, and lots of madness by johnny22 on Sunday November 23, 2014 @09:09PM (#8650712)
i really don't see how you're getting that impression. We've seen cooperation on shared menus, mime types, dbus, and wayland (among others).
Re:DBus, FreeDesktop, and lots of madness by guard-of-terra on Sunday November 23, 2014 @09:33AM (#8648876)
I'm not talking about runtime speed or latency, rather about development speed.
Re:DBus, FreeDesktop, and lots of madness by hp on Sunday November 23, 2014 @09:39PM (#8650809)
I should have mentioned here earlier, the original thought with dbus was that nobody would use libdbus directly; KDE would use an API more or less exactly like DCOP and GNOME would use soemthing like gdbus. For that reason, libdbus was lowlevel and flexible in a way that made it annoying to use - convenience API in libdbus would have been bloat.

What actually happened is that the high-level wrappers didn't get written for a long time because libdbus was just good enough that people didn't bother to work on alternatives. So that sucked, but it does seem to have finally been sorted out and libdbus is now on the way out AIUI.