Hacker News new | past | comments | ask | show | jobs | submit login
I hate the X11 ICCCM selection system (call-with-current-continuation.org)
36 points by fanf2 on Oct 16, 2019 | hide | past | favorite | 33 comments



Everything in the X11 ecosystem seems to be a pile of hacks on top of hacks on top of hacks. It sometimes works pretty well and that's amazing! It's kind of beautiful in a silly way to realize how many layers of hacks are used to build the desktop experience on Linux.

I don't think terminals are much better. Fun fact about terminal escape sequences: some of them are timing-dependent. If a byte arrives too slowly, it will do something different.

The web is also a pile of hacks but at least we have multiple independent implementations and some standards.

The mess is beautiful. Keep adding layers.


> The mess is beautiful. Keep adding layers.

No, it's really not. In many ways X11 is behind what the other operating systems offer, and the emphasis on backwards compatibility above all else is the reason. For example, Windows has the notion of window privilege, in which lower-privilege windows are isolated from higher-privilege windows. X11 technically has the XSECURITY extension, but nobody uses it as it breaks everything, so in practice every X11 app can keylog your browser. It's really unfortunate that the Linux community is so divided over Wayland, as from a technical perspective Wayland is sorely needed.


MS Windows manages to be binary backward compatible with win95 and in some cases even win32s. The graphics model is mostly the same as windows 3.0 . So MS has backward compatibility in spite of security.

Otoh, wayland has gaping functionality holes that MS windows has not: Screen recording is basic, normal usage. UI automation isn't that weird of a use case either.

I can't believe that this is unsolvable with some security model in wayland if the political will would be there. If a lot of people have the same complaint, and they are ignored, that's really unfortunate. Basically, Wayland should deal with reality or it will stay in limbo.

UPDATE: This post has a more harsh tone than intended. Sorry for that. I did my share of X11 programming,so I agree that something better is needed. And wayland is after years and years of no advancement a great initiative. But it pains me to see it stumble a few meters before the finish line, because of a stupid self inflicted wound.


Wayland is problematic as it goes entirely the opposite direction of X11, which means, for example, that screenshot programs and custom key binding daemons will not work.


We now understand that a program that can secretly take screenshots at will can spy on all your conversations and steal your credit card number. That isn't quite as bad as root, but, honestly, for most users it's pretty close.

Wayland is absolutely doing the sensible, conservative thing when it comes to screenshots.


No, I'm pretty sure that was always understood. What Wayland is doing -- breaking expected desktop functionality -- is not sensible at all. Window's permission model is more sensible as it actually accomplishes something.

Wayland's "fix" isn't one because on the vast, vast majority of systems any compromised program running under your uid can begin debugging another under your uid, completely circumventing any permission system Wayland tries to create. Have a root terminal logged in, or maybe open one later? Any program under your account now has root if it tries hard enough.

People started freaking out about the completely normal and expected things you could do under X11 and kneejerked themselves into the current Wayland. Maybe it will eventually be relaxed. If it isn't, I can't expected it to replace X11.


I mean this kind of in jest. It's obviously just garbage engineering, but I think the mess is kind of pretty.


> ... and the emphasis on backwards compatibility above all else is the reason ...

Not entirely; from memory the entire X11 development team are also heavily invested in Wayland.

There was a long period of time where graphics drivers lived in userspace, in X11, and nobody could use an alternative window system. That was the way things were up until 2010-2012 era. Even then the graphics drivers in the kernel weren't in a great way.

Now the drivers in the kernel work well and the graphics stack is slowly migrating away from X11. They are moving as fast as they can without breaking things.


The folks who work on Xorg are perfectly fine. The problem is the segment of the Linux community that wants to keep X11 around forever.


The problem is that Wayland never going to reach feature parity by design for security and other opinionated reasons that alienate many power users.


Wayland is a sub-par product with the following sufficent reasons: Performance Stability Features Number of supported windowing managers


I want better windowing security, but I also need to be able to present my desktop in a video conference call. Expecting people to switch before they can do normal desktopy things isn't reasonable.


I think the way forward is to adopt Wayland and use compatibility layers to allow old apps to work forever. And to not feel bad about that.


The fun thing about terminals is that many terminals pretend to be xterm, but in fact fail to implement some of the many, many terminal escape sequences xterm supports. So complex terminal applications pretty much need to double-check if terminals are actually xterm or if they're something broken pretending to be xterm.


Sounds like a standard configure.sh script.


No, you have to do it at runtime, which is why curses exist. (Ncurses and pdcurses especially.)


Wasn’t referring to terminal compatibility as much as the “stuff that doesn’t necessarily do what it says it does”.

A big portion of most configure.sh scripts is logic that doesn’t just check for something, but that it can be trusted to do what the compiler will be expecting.


> realize how many layers of hacks are used to build the desktop experience on Linux.

Still a better experience than Windows.

> Keep adding layers.

Coup is full. Instructions misunderstood.


Only when all one expects from X is to manage xterms and position Windows, with some kind of 2D acceleration.


Sorry, I'm an adult, I don't need distracting bells and whistles, quite the opposite.

Windows is a poor desktop IMO. There is too much horizontal waste planting the user into a short and wide letter box that is nothing more than a portal into a malware universe.


Yeah, as if ChromeOS and Android distributions had less distracting bells, or were malware free.

In fact the first malware was designed for UNIX, and the mechanisms exploited are still pretty much available.


>Everything in the X11 ecosystem seems to be a pile of hacks on top of hacks on top of hacks.

You can say the same thing about any legacy system. X11 is 36 years old, but it was designed in a way that can be extended forever.


> Fun fact about terminal escape sequences: some of them are timing-dependent. If a byte arrives too slowly, it will do something different

As someone working on a couple of different VT100 emulations, can you provide an example of this? I'm curious now, as none of the specifications I've seen mention this that I can think of off the top of my head.


Isn't cursor keys like that? If you get stalls when it sends the 4-5 byte sequence, you get to see ]^A instead of cursor moving.

Having dog slow links and tcp set to send each char instead of waiting for a whole line or packet probably helps to see it, but I'm somewhat certain the whole code for a cursor movement needs to arrive within a certain time in order for it to actually be a movement and not the individual chars.


Sounds like you might be dealing with a particular implementation quirk, or perhaps with SSH or some other network transport issue. In general terminal emulators tend to implement control character processing with a state machine:

https://vt100.net/emu/dec_ansi_parser

In theory that shouldn't be affected by latency or delay in processing characters or groups of characters, and should be independent of the line speed, after all, the VT100 was able to operate at speeds between 50bits/second and 19,200 bits/second.

https://en.wikipedia.org/wiki/VT100

That said, there are so many terminal emulators out there (xterm, gnome-terminal, linux console, just to name a few) and so many potential transport protocols (telnet, SSH, serial etc) and modern pty layers to deal with as well, so there are bound to be differences/quirks with different combinations.


Linux is pretty much hacks all the way down. It's the other Unix philosophy.


> don't think terminals are much better

Terminal, as in "Causing, ending in, or approaching death; fatal". It's not an accident.


(2001)

Aside, why the few X11 related articles recently?

Has something happened? Is there a debate?

Correction - the author is Conrad Parker aka kfish. Dunno why that is elided in this version. Conrad has some good rants.

Complete version at https://raw.githubusercontent.com/kfish/xsel/1a1c5edf0dc1290...

Trivia, JW here is jdub and was an early Canonical/Ubuntu employee and their evangelist.

https://en.wikipedia.org/wiki/Jeff_Waugh


Well, it's certainly a rant.

Honestly, I can see why you might want two kinds of objects to pass via selection: strings, and blobs. But two is an odd number; it ought to be zero, one, or infinite. Zero doesn't help, and one would be hijacked by incompatible systems that would have to guess "are they going to want a JSON representation of this, or a MIME type followed by base64 encoded data?", so I guess that an updatable registry of types would be ok, just really unwieldy, and ... nightmares to follow.


> But two is an odd number

This is very tangential, but I was very confused when I read this at first due to the arithmetic meaning of "odd".


Horses have an even number of legs. Behind they have two legs, and in front they have fore-legs. This makes six legs, which is certainly an odd number of legs for a horse. But the only number that is both even and odd is infinity. Therefore, horses have an infinite number of legs. (from fortune).


I use a program with multiple selection every day: my text editor. And not only does it have that, it has multiple cursors, too!


The icccm uses selection for what we call clipboard. A lot of x11 software used to put what you selected on the clipboard automatically.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: