DRMacIver's Notebook

Computer ghost stories

Computer ghost stories

I was talking to a friend the other day and she related a story about a friend of hers which she described as “Exactly the sort of story that happens to him” and it occurred to me that I had recently had a story that feels like exactly the sort of thing that happens to me. Given my current interest in writing stories about life it seems worth trying to develop a feel for that sort of characteristic story.

Anyway, this is one of my characteristic sorts of stories: Ones in which computers are haunted, and then Scooby Doo style you pull off the mask and find it was old man unintended feature interactions all along.

Let me set the scene: A week or so ago I was doing some work. All of a sudden, focus was stolen out from under me,This is, of course, one of the worst crimes that a computer can commit. Even worse than playing sound that I haven’t asked for. Unfortunately we live in a high computer crime world. as my browser insisted that I absolutely had to see the following webcomic:

XKCD comic about flying using Python

I want you to pause for a moment and think about why this might have happened. I’ll explain shortly. Here’s a placeholder image to prevent you from reading the spoilers too soon:

A snake offering someone an apple

Anyway, the first thing you need to know is that this is what happens when someone types “import antigravity” in Python. It’s a longstanding and very tedious easter egg, of the sort that programmers think is funny.

The second thing you need to know is that I was in VS Code. Also my Python virtualenv was lightly broken and as a result VS Code was failing to find imports and I hadn’t gotten around to fixing this.

This meant that when I was typing import attrs it didn’t find the attrs library.

And this means that VS Code went into its aggressively fuzzy search mode, where it tries its hardest to find anything that might match what you’re looking for.

So, when I went back to VS Code to recreate what I’d just been doing to trigger this, I tried retyping import attrs and what happened is that as I got to import attr I saw that it was displaying “import antigravity”. The fact that all the characters in “attr” exist in “antigravity” (albeit not in the same order) was enough to trigger that as a suggestion.

And apparently, the fact that it was being suggested was enough to trigger an import. Which runs arbitrary code. In this case, opening a web browser.

I like this example because of how totally cursed it is, but it’s also interesting in terms of how utterly inscrutable it is until you put together two very easy pieces. Nobody I presented it to was able to figure it out without me essentially giving the game away (I doubt I would have been able to either). If you know about the easter egg it’s at least clear what must have happened, but not how. But if you’re there in front of the problem you can just retrace your steps and it’s almost immediately clear what must have happened.