Thompson’s Reflections on Trusting Trust revisited

As Irreal oldtimers know, My absolute favorite Computer Science paper is Ken Thompson’s Reflections on Trusting Trust. It is truly a thing of beauty. This is a beauty that should be appreciated in stages.

In the first stage, we’re introduced to, as the Jargon File puts it, a truly moby hack perpetrated by Thompson. He changed the C compiler to recognize when the login function was being compiled and insert a backdoor that would allow anyone knowing a special password to login. There’s nothing special about that, of course but the clever part was that he also changed the compiler to recognize when it was compiling itself and to insert the code that generated the back door. He used that compiler to compile a version of the compiler without the changes. Now he had a compiler that would insert the backdoor and replicate the code to insert the back door if the compiler itself was recompiled. But the compiler sources no longer showed any signs of this.

The second stage is understanding how this was done. It turns out to be pretty simple. Thompson worked at the source level by changing the C preprocessor so that he could work at the source level of the code being compiled. The login backdoor insertion code simply looked for some specific code that called crypt and installed the book door there.

The really clever part was installing the code to replicate the backdoor insertion code in a new compiler. Keep in mind that the source for that was no longer present in the C compiler source. Think, for a moment how you would do that. Remember, you’re working at the source level. The answer has to do with quines.

Back in 2023, Russ Cox asked Thompson if he still had a copy of the code for the hack. Thompson did and he sent it to Cox who wrote an excellent exegesis of it. I wrote about his explanation here. Now Micah Kepe has revisited that code and provided his own explanation of it. Take a look at the explanation and try to understand it. You’ll have to bear down but once you understand the details, a whole new world of understanding will be open to you.

The final stage of appreciation is realizing that it’s really hard to be sure your computing environment is secure. Even if you’re paranoid or use a distribution like Gentoo in which you compile everything by default, you still can’t be sure someone hasn’t slipped in a backdoor. There are, of course, ways of mitigating Thompson’s type of attack but who knows what else is out there?

Posted in General | Tagged , | Leave a comment

Oil.el

It’s a lazy Sunday and there’s nothing much going on in the Internet to interest Irreal or its readers so I’m offering you this little nugget that popped up this morning. Oil.el is a tiny package that brings the functionality of Oil.nvim to Emacs.

The idea is that you can batch create files in a given directory by simply listing their names, one per line, into the app. When you’re done, simply type Ctrl+c Ctrl+c and the files are created. Or, you can cancel the operation with Ctrl+c Ctrl+k.

It’s not clear to me why this app is as popular as it seems to be—at least in the Vim world. It’s not that there’s anything wrong with the app itself, I just don’t see the need for it, especially given the existence of Dired. Nonetheless, Emacs is all about letting you have it your way so if Oil’s workflow appeals to you, its existence is a good thing.

The package is not (yet?) on Melpa but you can download it directly from GitHub if you’re interested. I’m guessing that this app will be mostly of value to refuges from Vim who are used to its Vim analog. Regardless, it’s there for you if you’re interested.

Posted in General | Tagged | Leave a comment

Bending Emacs 4: Batch Renaming Of Files

Álvaro Ramírez has a new video up. This one, Bending Emacs 4, demonstrates several ways of batch renaming files. The secret sauce in most of these methods is the ability of the Dired buffer to become writable and have the changes reflected in the underlying file system. Every time I use it, it seems like magic.

Ramírez’s video shows several ways of performing bulk renamings in the Dired environment. Probably the easiest—or the most natural to me—is simply using a keyboard macro. For instance, if you have a directory full of files ending in .org and want them all to end in .txt, you simply start recording a macro, change the first file, move to the next line, and close the macro. Then you can run the macro on the rest of the buffer to rename all the files. After the renaming, all you need do is type C-c C-c to instantiate the changes into the file system.

Ramírez’s favored way of making the changes is to use Magnor Sveen’s wonderful Multiple Cursors package. It’s a bit more flexible than a keyboard macro because you have finer control over which lines will be changed. Once you’ve got the desired files marked, you simple make the change on one and they are all affected.

The video is only 6 minutes, 42 seconds long so it should be easy to fit in. Ramírez even includes a DWIM command line method of renaming the files. The nice thing about using Dired is that you can arrange for Git to be aware of the renaming. Take a look at the video for the details.

Posted in General | Tagged | Leave a comment

Red Meat Friday: AWS Is Down, I Can’t Sleep

Farce comes to the Internet. All right, farce comes to the Internet again. With the failure of AWS this week, many, many services were interrupted, including my Spanish learning app. It was annoying but, after all, you can always practice Spanish or do your banking, or whatever a little bit later.

But one group of users is especially aggrieved. It turns out that some people actually have their mattress connected to the Internet. What could go wrong? Apparently, a bunch of people found out with the AWS outage. So called “smart mattresses” monitor your sleep patterns and can adjust the mattress temperature on the fly.

Imagine the consternation from the purchasers of these $2000 mattresses when their sleeping temperature is disrupted. How can one possibly get a decent night’s sleep if the mattress isn’t adjusting the temperature according to our sleep patterns? Of course, the vast majority of the world knows the answer to that question and deals with it every night. They raise or lower the covers, put a leg outside the blankets, or do any of a number of things to adjust their sleep temperature.

Of course, all of this is in good fun. I doubt even the people—or at least most of them—who own these smart mattresses are taking this very seriously but it does make a point: we are—more and more—relying on a stable Internet connection for many aspects of our lives but that connection is extremely fragile. A large part of the problem is that a huge number of these services depend on Amazon, Google, or Microsoft to provide those services. That’s a lot of eggs in every few baskets.

Posted in General | Tagged , , | Leave a comment

A Simple Emacs Dashboard

Randy Ridenour, whom I’ve written about before, has an interesting post on customizing the Emacs Dashboard. The Dashboard is something that appears when Emacs starts. It typically shows recently visited files and the current agenda items.

It’s configurable—of course, it’s Emacs—but Ridenour wasn’t happy with the default configurations. Emacs being Emacs, it was pretty easy to get things just the way he liked them. Part of that was displaying the agenda in a the usual way rather than just a list of activities. In particular, he like having the current time displayed—the way it is in grid view—and even arranged for it to appear in red so that it would stand out. He also arranged to have the agenda updated every minute so the time would always be up to date.

In addition to the agenda, he has a list of links that he wants to appear in the Dashboard so he has an Org file with a table of those links that he imports and then activates the links. At the end, he has a Dashboard with exactly the information he wants.

To be honest, I’ve never seen the point of Emacs Dashboards. My Emacs is always running so startup Dashboards don’t make any sense to me. I know you can start them whenever you like but, again, I’ve never seen the point. When I start Emacs, the first thing I do is start the agenda and mu4e. I could easily automate that but it’s so easy to start them by hand and I start Emacs so infrequently that it’s not worthwhile.

In any event, if you’re one of the many people who do like an Emacs Dashboard, Ridenour’s post may have some ideas that you can use.

Update [2025-10-24 Fri 14:12]: Added link.

Posted in General | Tagged , | Leave a comment

Mistakes Startups Make

Over at Reddit, MeirDavid has a truly terrifying post on why startups fail. He presents himself as a troubleshooter and his post is based on common problems startups in extremis experience. Like everything on the Internet these days, it’s hard to know how true his story is but it does have the sound of truth. If you’ve been around for a while, you’ve doubtless seen the type of basic mistakes that he describes.

MeirDavid begins by saying he’s audited the code base of 47 failed startups and has found the same patterns in all of them. He are some of the things he found:

  • 89% didn’t bother indexing their databases. I don’t know how this is possible. The whole point of databases is indexes that make it easy to access data. Otherwise, why not use a flat file?
  • 76% were over provisioned. They typically were using only 13% of the resources they were paying for. One of the points of renting virtual servers is that you can spin them up as you need them. Why in the world would you have eight times the number you need?
  • 68% had auth vulnerabilities. That, at least, is understandable. It’s notoriously difficult that get security right but there are, after all, out of the box solutions for that sort of thing.
  • 91% had no automated tests. This is all too common and a really serious mistake. My enlightenment came when I read that Walter Bright, known for his C and C++ compilers and for the development of the D language and its compilers, has a test for every single error his compilers have ever made and that he runs those tests with every change to the compilers. That’s the sort of thing that helps you not revisit previous errors.

MeirDavid expands on these themes and the lessons to be learned from them so you should definitely take a look at his post.There’s really no reason to be making these mistakes but they are depressingly common.

Posted in General | Tagged | Leave a comment

Rendering SVG Images In Org Generated HTML

I’ve recently discovered to my surprise that rendering an SVG image in HTML from Org mode is difficult or at least poorly documented. It comes as news to me because the images that I want to render are always JPEGs so I’ve never stumbled on the problem.

It turns out that there are two solutions. The first, from Norman Walsh, converts the Org mode link to the SVG file into an HTML div containing the image. Unfortunately, Walsh doesn’t give any details.

The second solution, from tusharhero, leverages the Org Babel interface to make and display an SVG image. I like his solution better but that’s probably because it seems more familiar. It’s certainly what I would try to do if I didn’t have the advantage of Walsh’s and tusharhero’s wisdom.

As I said, I never deal with SVG images so there may be better ways of handling all this but here, at least, are two solutions in case you are having the same problem.

Posted in General | Tagged , | Leave a comment

World Clock Improved

In the old days, World Clocks were a sort of curiosity. There wasn’t a lot of need for them because most folks communicated with distant friends and colleagues with snail mail and later, I suppose, with email. In any event you didn’t need to know what time it was at the destination unless you were making an almost certainly hideously expensive phone call.

Now, of course, you can instantly message someone—or even call them in many circumstances—with no charge and it’s best to know that it’s not 3 AM where they are. That’s why, today, a world clock is almost a necessity. You can always ask the Duck or whatever you use but if you’re communicating with several people, it’s convenient to have your own world clock with all the appropriate times.

Emacs, as usual, has us covered. There’s the world-clock command that gives you the current time in a few cities but if you’re parochial like me, knowing what time it is in London doesn’t help much if I want to talk to someone in, say Glasgow. Maybe it’s the same time zone; maybe it isn’t. I have no idea. Like most things in Emacs, the cities displayed are configurable but it’d be pretty inconvenient to add cities on the fly.

The other problem is that only the current time is displayed. What if you’re trying to set up a meeting and want to know what time it will be sometime in the future? It would be nice to be able to adjust both the cities and the time displayed.

Álvaro Ramírez had these problems and being Ramírez he wrote a package that solves both of them. You can add cities on the fly and adjust the base time forward and backward. Right now, the package is only on GitHub so you have to get it from his GitHub repository but he’ll probably put it up on Melpa eventually.

This is a great package that makes figuring out what time it is/will be/was in some arbitrary place in the world easy. Take a look. It may be something you didn’t realize you needed.

Posted in General | Tagged | Leave a comment

Emacs On The Go

It’s Sunday and nobody—especially me—feels like working so here’s a short interlude while we’re waiting for the new week to begin. The subject of today’s post falls in the broad category of what could be called “mobile Emacs”.

Most of us have wished for a way to take Emacs with us when we’re out and about. Certainly, no one would want to do any serious editing on a smart phone—although Po Lu has produced an Android port—but it’s not hard to imagine using it on an iPad or other powerful tablet.

Then there’s this guy who literally wears his computer complete with a heads up display so that he always has access to his Emacs. When I saw the video, I immediately thought of Neal Stephenson’s gargoyles from Snow Crash. It’s the exact same idea: people wearing computers—and looking odd—so they can stay continuously connected to the metaverse or what we in this world call “the net”.

As much as some of us would like to be permanently connected, I doubt that many of us are prepared to embrace the solution suggested in the video. Of course, I could be wrong and it’s just what people are looking for. Let us know what you think.

Posted in General | Tagged | Leave a comment

How To Speed Up Emacs

Over at the Emacs subredit, iinnssdd says he was looking for a guide to speed up Emacs but couldn’t find one. Therefore, he put together his own. This is more than the usual “how to make Emacs load faster” article, which we all know are silly and a waste of time. Although there are some suggestions for making Emacs load faster, the useful parts are how to make Emacs run faster once it’s loaded.

Some of that are compile time options when building Emacs from source. Iinnssdd’s particular options may or may not apply to your situation but they’re worth taking a look at. Another obvious strategy is to make sure that you have native compilation enabled. Iinnssdd has some suggestions for that.

A couple of specific recommendations are applicable to many of us. They’re both pretty simple and easy to implement. The first is a hook function to the find-file function that looks at how many lines the function has and turns off display-lne-numbers-mode when there are more than 1000 lines. It’s easy to see why this would speed things up on large files.

The second speedup is similar. It’s another find-file hook that looks for C files that have more than 1000 lines and turns on simpc-mode when it finds one. Simpc performs minimal syntax highlighting and indentation and, according to its author, is much faster than c-mode, c++-mode, cc-mode, and so on.

Even though I don’t have native compilation enabled on my older MacBook (2019), I still don’t find Emacs insufferably slow. That could be one of the benefits of having grown up with much older computers that were really slow. Regardless, if you’re intent on squeezing every bit of performance from Emacs, Iinnssdd’s post may give you some ideas.

Posted in General | Tagged | Leave a comment