Mon, 13 Jan 2025 16:23:05 +0000 Fullscreen Open in Tab
Pluralistic: They were warned; Picks and Shovels Chapter One (Part 4) (13 Jan 2025)


Today's links



A faded, crumpled, sepia-toned 19th century wanted poster reading '$100,000 REWARD/THE MURDERER/IS STILL AT LARGE.' Three photos above the caption depict caricatures of furious businessmen in 19th century garb.

They were warned (permalink)

Truth is provisional! Sometimes, the things we understand to be true about the world change, and stuff we've "always done" has to change, too. There comes a day when the evidence against using radium suppositories is overwhelming, and then you really must dig that radium out of your colon and safely dispose of it:

https://pluralistic.net/2024/09/19/just-stop-putting-that-up-your-ass/#harm-reduction

So it's natural and right that in the world, there will be people who want to revisit the received wisdom and best practices for how we live our lives, regulate our economy, and organize our society. But not a license to simply throw out the systems we rely on. Sure, maybe they're outdated or unnecessary, but maybe not. That's where "Chesterton's Fence" comes in:

Let us say, for the sake of simplicity, a fence or gate erected across a road. The more modern type of reformer goes gaily up to it and says, "I don't see the use of this; let us clear it away." To which the more intelligent type of reformer will do well to answer: "If you don't see the use of it, I certainly won't let you clear it away. Go away and think. Then, when you can come back and tell me that you do see the use of it, I may allow you to destroy it."

https://en.wikipedia.org/wiki/G._K._Chesterton#Chesterton's_fence

In other words, it's not enough to say, "This principle gets in the way of something I want to do, so let's throw it out because I'm pretty sure the inconvenience I'm experiencing is worse than the consequences of doing away with this principle." You need to have a theory of how you will prevent the harms the principle protects us from once you tear it down. That theory can be "the harms are imaginary" so it doesn't matter. Like, if you get rid of all the measures that defend us from hexes placed by evil witches, it's OK to say, "This is safe because evil witches aren't real and neither are hexes."

But you'd better be sure! After all, some preventative measures work so well that no living person has experienced the harms they guard us against. It's easy to mistake these for imaginary or exaggerated. Think of the antivaxers who are ideologically committed to a world in which human beings do not have a shared destiny, meaning that no one has a moral claim over the choices you make. Motivated reasoning lets those people rationalize their way into imagining that measles – a deadly and ferociously contagious disease that was a scourge for millennia until we all but extinguished it – was no big deal:

https://en.wikipedia.org/wiki/Measles:_A_Dangerous_Illness

There's nothing wrong with asking whether longstanding health measures need to be carried on, or whether they can be sunset. But antivaxers' sloppy, reckless reasoning about contagious disease is inexcusable. They were warned, repeatedly, about the mass death and widespread lifelong disability that would follow from their pursuit of an ideological commitment to living as though their decisions have no effect on others. They pressed ahead anyway, inventing ever-more fanciful reasons why health is a purely private matter, and why "public health" was either a myth or a Communist conspiracy:

https://www.conspirituality.net/episodes/brief-vinay-prasad-pick-me-campaign

When RFK Jr kills your kids with measles or permanently disables them with polio, he doesn't get to say "I was just inquiring as to the efficacy of a longstanding measure, as is right and proper." He was told why the vaccine fence was there, and he came up with objectively very stupid reasons why that didn't matter, and then he killed your kids. He was warned.

Fuck that guy.

Or take Bill Clinton. From 1933 until 1999, American banks were regulated under the Glass-Steagall Act, which "structurally separated" them. Under structural separation, a "retail bank" – the bank that holds your savings and mortgage and provides you with a checkbook – could not be "investment bank." That meant it couldn't own or invest in businesses that competed with the businesses its depositors and borrowers ran. It couldn't get into other lines of business, either, like insurance underwriting.

Glass-Steagall was a fence that stood between retail banks and the casino economy. It was there for a fucking great reason: the failure to structurally separate banks allowed them to act like casinos, inflating a giant market bubble that popped on Black Friday in October 1929, kicking off the Great Depression. Congress built the structural separation fence to keep banks from doing it again.

In the 1990s, Bill Clinton agitated for getting rid of Glass-Steagall. He argued that new economic controls would allow the government to prevent another giant bubble and crash. This time, the banks would behave themselves. After all, hadn't they demonstrated their prudence for seven decades?

In fact, they hadn't. Every time banks figured out how to slip out of regulatory constraints they inflated another huge bubble, leading to another massive crash that made the rich obscenely richer and destroyed ordinary savers' lives. Clinton took office just as one of these finance-sector bombs – the S&L Crisis – was detonating. Clinton had no basis – apart from wishful thinking – to believe that deregulating banks would lead to anything but another gigantic crash.

But Clinton let his self interest – in presiding over a sugar-high economic expansion driven by deregulation – overrule his prudence (about the crash that would follow). Sure enough, in the last months of Clinton's presidency, the stock market imploded with the March 2000 dot-bomb. And because Congress learned nothing from the dot-com crash and declined to restore the Glass-Steagall fence, the crash led to another bubble, this time in subprime mortgages, and then, inevitably, we suffered the Great Financial Crisis.

Look: there's no virtue in having bank regulations for the sake of having them. It is conceptually possible for bank regulations to be useless or even harmful. There's nothing wrong with investigating whether the 70-year old Glass-Steagall Act was still needed in 1999. But Clinton was provided with a mountain of evidence about why Glass-Steagall was the only thing standing between Americans and economic chaos, including the evidence of the S&L Crisis, which was still underway when he took office, and he ignored all of them. If you lost everything – your home, your savings, your pension – in the dot-bomb or the Great Financial Crisis, Bill Clinton is to blame. He was warned. he ignored the warnings.

Fuck that guy.

No, seriously, fuck Bill Clinton. Deregulating banks wasn't Clinton's only passion. He also wanted to ban working cryptography. The cornerstone of Clinton's tech policy was the "Clipper Chip," a backdoored encryption chip that, by law, every technology was supposed to use. If Clipper had gone into effect, then cops, spooks, and anyone who could suborn, bribe, or trick a cop or a spook could break into any computer, server, mobile device, or embedded system in America.

When Clinton was told – over and over, in small, easy-to-understand words – that there was no way to make a security system that only worked when "bad guys" tried to break into it, but collapsed immediately if a "good guy" wanted to bypass it. We explained to him – oh, how we explained to him! – that working encryption would be all that stood between your pacemaker's firmware and a malicious update that killed you where you stood; all that stood between your antilock brakes' firmware and a malicious update that sent you careening off a cliff; all that stood between businesses and corporate espionage, all that stood between America and foreign state adversaries wanting to learn its secrets.

In response, Clinton said the same thing that all of his successors in the Crypto Wars have said: NERD HARDER! Just figure it out. Cops need to look at bad guys' phones, so you need to figure out how to make encryption that keeps teenagers safe from sextortionists, but melts away the second a cop tries to unlock a suspect's phone. Take Malcolm Turnbull, the former Australian Prime Minister. When he was told that the laws of mathematics dictated that it was impossible to build selectively effective encryption of the sort he was demanding, he replied, "The laws of mathematics are very commendable but the only law that applies in Australia is the law of Australia":

https://www.eff.org/deeplinks/2017/07/australian-pm-calls-end-end-encryption-ban-says-laws-mathematics-dont-apply-down

Fuck that guy. Fuck Bill Clinton. Fuck a succession of UK Prime Ministers who have repeatedly attempted to ban working encryption. Fuck 'em all. The stakes here are obscenely high. They have been warned, and all they say in response is "NERD HARDER!"

https://pluralistic.net/2023/03/05/theyre-still-trying-to-ban-cryptography/

Now, of course, "crypto means cryptography," but the other crypto – cryptocurrency – deserves a look-in here. Cryptocurrency proponents advocate for a system of deregulated money creation, AKA "wildcat currencies." They say, variously, that central banks are no longer needed; or that we never needed central banks to regulate the money supply. Let's take away that fence. Why not? It's not fit for purpose today, and maybe it never was.

Why do we have central banks? The Fed – which is far from a perfect institution and could use substantial reform or even replacement – was created because the age of wildcat currencies was a nightmare. Wildcat currencies created wild economic swings, massive booms and even bigger busts. Wildcat currencies are the reason that abandoned haunted mansions feature so heavily in the American imagination: American towns and cities were dotted with giant mansions built by financiers who'd grown rich as bubbles expanded, then lost it all after the crash.

Prudent management of the money supply didn't end those booms and busts, but it substantially dampened them, ending the so-called "business cycle" that once terrorized Americans, destroying their towns and livelihoods and wiping out their savings.

It shouldn't surprise us that a new wildcat money sector, flogging "decentralized" cryptocurrencies (that they are nevertheless weirdly anxious to swap for your gross, boring old "fiat" money) has created a series of massive booms and busts, with insiders getting richer and richer, and retail investors losing everything.

If there was ever any doubt about whether wildcat currencies could be made safe by putting them on a blockchain, it is gone. Wildcat currencies are as dangerous today as they were in the 18th and 19th century – only moreso, since this new bad paper relies on the endless consumption of whole rainforests' worth of carbon, endangering not just our economy, but also the habitability of the planet Earth.

And nevertheless, the Trump administration is promising a new crypto golden age (or, ahem, a Gilded Age). And there are plenty of Democrats who continue to throw in with the rotten, corrupt crypto industry, which flushed billions into the 2024 election to bring Trump to office. The result is absolutely going to be more massive bubbles and life-destroying implosions. Fuck those guys. They were warned, and they did it anyway.

Speaking of the climate emergency: greetings from smoky Los Angeles! My city's on fire. This was not an unforeseeable disaster. Malibu is the most on-fire place in the world:

https://longreads.com/2018/12/04/the-case-for-letting-malibu-burn/

Since 1919, the region has been managed on the basis of "total fire suppression." This policy continued long after science showed that this creates "fire debt" in the form of accumulated fuel. The longer you go between fires, the hotter and more destructive those fires become, and the relationship is nonlinear. A 50-year fire isn't 250% more intense than a 20-year fire: it's 50,000% more intense.

Despite this, California has invested peanuts in regular controlled burns, which has created biennial uncontrolled burns – wildfires that cost thousands of times more than any controlled burn.

Speaking of underinvestment: PG&E has spent decades extracting dividends for its investors and bonuses for its execs, while engaging in near-total neglect of maintenance of its high-voltage transmission lines. Even with normal winds, these lines routinely fall down and start blazes.

But we don't have normal winds. The climate emergency has been steadily worsening for decades. LA is just the latest place to be on fire, or under water, or under ice, or baking in wet bulb temperatures. Last week in southern California, we were warned to expect gusts of 120mph.

They were warned. #ExxonKnew: in the early 1970s, Exxon's own scientists warned them that fossil fuel consumption would kick off climate change so drastic that it would endanger human civilzation. Exxon responded by burying the reports and investing in climate denial:

https://exxonknew.org/

They were warned! Warned about fire debt. Warned about transmission lines. Warned about climate change. And specific, named people, who individually had the power to heed these warnings and stave off disaster, ignored the warnings. They didn't make honest mistakes, either: they ignored the warnings because doing so made them extraordinarily, disgustingly rich. They used this money to create dynastic fortunes, and have created entire lineages of ultra-wealthy princelings in $900,000 watches who owe it all to our suffering and impending dooml

Fuck those guys. Fuck 'em all.

We've had so many missed opportunities, chances to make good policy or at least not make bad policy. The enshitternet didn't happen on its own. It was the foreseeable result of choices – again, choices made by named individuals who became very wealthy by ignoring the warnings all around them.

Let's go back to Bill Clinton, because more than anyone else, Clinton presided over some terrible technology regulations. In 1998, Clinton signed the Digital Millennium Copyright Act, a bill championed by Barney Frank (fuck that guy, too). Under Section 1201 of the Digital Millennium Copyright Act, it's a felony, punishable by a five year prison sentence, and a $500,000 fine, to tamper with a "digital lock."

That means that if HP uses a digital lock to prevent you from using third-party ink, it's a literal crime to bypass that lock. Which is why HP ink now costs $10,000/gallon, and why you print your shopping lists with colored water that costs more, ounce for ounce, than the sperm of a Kentucky Derby winner:

https://pluralistic.net/2024/09/30/life-finds-a-way/#ink-stained-wretches

Clinton was warned that DMCA 1201 would soon metastasize into every kind of device – not just the games consoles and DVD players where it was first used, but medical implants, tractors, cars, home appliances – anything you could put a microchip into (Jay Freeman calls this "felony contempt of business-model"):

https://pluralistic.net/2023/07/24/rent-to-pwn/#kitt-is-a-demon

He ignored those warnings and signed the DMCA anyway (fuck that guy). Then, under Bush (fuck that guy), the US Trade Representative went all around the world demanding that America's trading partners adopt versions of this law (fuck that guy). In 2001, the European Parliament capitulated, enacting the EU Copyright Directive, whose Article 6 is a copy-paste of DMCA 1201 (fuck all those people).

Fast forward 20 years, and boy is there a lot of shit with microchips that can be boobytrapped with rent-extracting logic bombs that are illegal to research, describe, or disable.

Like choo-choo trains.

Last year, the Polish hacking group Dragon Sector was contacted by a public sector train company whose Newag trains kept going out of service. The operator suspected that Newag had boobytrapped the trains to punish the train company for getting its maintenance from a third-party contractor. When Dragon Sector investigated, they discovered that Newag had indeed riddled the trains' firmware with boobytraps. Trains that were taken to locations known to have third-party maintenance workshops were immediately bricked (hilariously, this bomb would detonate if trains just passed through stations near to these workshops, which is why another train company had to remove all the GPSes from its trains – they kept slamming to a halt when they approached a station near a third-party workshop). But Newag's logic bombs would brick trains for all kinds of reasons – merely keeping a train stationary for too many days would result in its being bricked. Installing a third-party component in a locomotive would also trigger a bomb, bricking the train.

In their talk at last year's Chaos Communications Congress, the Dragon Sector folks describe how they have been legally terrorized by Newag, which has repeatedly sued them for violating its "intellectual property" by revealing its sleazy, corrupt business practices. They also note that Newag continues to sell lots of trains in Poland, despite the widespread knowledge of its dirty business model, because public train operators are bound by procurement rules, and as long as Newag is the cheapest bidder, they get the contract:

https://media.ccc.de/v/38c3-we-ve-not-been-trained-for-this-life-after-the-newag-drm-disclosure

The laws that let Newag make millions off a nakedly corrupt enterprise – and put the individuals who blew the whistle on it at risk of losing everything – were passed by Members of the European Parliament who were warned that this would happen, and they ignored those warnings, and now it's happening. Fuck those people, every one of 'em.

It's not just European parliamentarians who ignored warnings and did the bidding of the US Trade Representative, enacting laws that banned tampering with digital locks. In 2010, two Canadian Conservative Party ministers in the Stephen Harper government brought forward similar legislation. These ministers, Tony Clement (now a disgraced sex-pest and PPE grifter) and James Moore (today, a sleazeball white-shoe corporate lawyer), held a consultation on this proposal.

6, 138 people wrote in to say, "Don't do this, it will be hugely destructive." 54 respondents wrote in support of it. Clement and Moore threw out the 6,138 opposing comments. Moore explained why: these were the "babyish" responses of "radical extremists." The law passed in 2012.

Last year, the Canadian Parliament passed bills guaranteeing Canadians the Right to Repair and the right to interoperability. But Canadians can't act on either of these laws, because they would have to tamper with a digital lock to do so, and that's illegal, thanks to Tony Clement and James Moore. Who were warned. And who ignored those warnings. Fuck those guys:

https://pluralistic.net/2024/11/15/radical-extremists/#sex-pest

Back in the 1990s, Bill Clinton had a ton of proposals for regulating the internet, but nowhere among those proposals will you find a consumer privacy law. The last time an American president signed a consumer privacy law was 1988, when Reagan signed the Video Privacy Protection Act and ensured that Americans would never have to worry that video-store clerks where telling the newspapers what VHS cassettes they took home.

In the years since, Congress has enacted exactly zero consumer privacy laws. None. This has allowed the out-of-control, unregulated data broker sector to metastasize into a cancer on the American people. This is an industry that fuels stalkers, discriminatory financial and hiring algorithms, and an ad-tech sector that lets advertisers target categories like "teenagers with depression," "seniors with dementia" and "armed service personnel with gambling addictions."

When the people cry out for privacy protections, Congress – and the surveillance industry shills that fund them – say we don't need a privacy law. The market will solve this problem. People are selling their privacy willingly, and it would be an "undue interference in the market" if we took away your "freedom to contract" by barring companies from spying on you after you clicked the "I agree" button.

These people have been repeatedly warned about the severe dangers to the American public – as workers, as citizens, as community members, and as consumers – from the national privacy free-for-all, and have done nothing. Fuck them, every one:

https://pluralistic.net/2023/12/06/privacy-first/#but-not-just-privacy

Now, even a stopped clock is right twice a day, and not every one of Bill Clinton's internet policies was terrible. He had exactly one great policy, and, ironically, that's the one there's the most energy for dismantling. That policy is Section 230 of the Communications Decency Act (a law that was otherwise such a dumpster fire that the courts struck it down). Chances are, you have been systematically misled about the history, use, and language of Section 230, which is wild, because it's exactly 26 words long and fits in a single tweet:

No provider or user of an interactive computer service shall be treated as the publisher or speaker of any information provided by another information content provider.

Section 230 was passed because when companies were held liable for their users' speech, they "solved" this problem by just blocking every controversial thing a user said. Without Section 230, there would be no Black Lives Matter, no #MeToo – no online spaces where the powerful were held to account. Meanwhile, rich and powerful people would continue to enjoy online platforms where they and their bootlickers could pump out the most grotesque nonsense imaginable, either because they owned those platforms (ahem, Twitter and Truth Social) or because rich and powerful people can afford the professional advice needed to navigate the content-moderation bureaucracies of large systems.

We know exactly what the internet looks like when platforms are civilly liable for their users' speech: it's an internet where marginalized and powerless people are silenced, and where the people who've got a boot on their throats are the only voices you can hear:

https://www.techdirt.com/2020/06/23/hello-youve-been-referred-here-because-youre-wrong-about-section-230-communications-decency-act/

The evidence for this isn't limited to the era of AOL and Prodigy. In 2018, Trump signed SESTA/FOSTA, a law that held platforms liable for "sex trafficking." Advocates for this law – like Ashton Kutcher, who campaigns against sexual assault unless it involves one of his friends, in which case he petitions the judge for leniency – were warned that it would be used to shut down all consensual sex work online, making sex workers's lives much more dangerous. This warnings were immediately borne out, and they have been repeatedly borne out every month since. Killing CDA 230 for sex work brought back pimping, exposed sex workers to grave threats to their personal safety, and made them much poorer:

https://decriminalizesex.work/advocacy/sesta-fosta/what-is-sesta-fosta/

It also pushed sex trafficking and other nonconsensual sex into privateforums that are much harder for law enforcement to monitor and intervene in, making it that much harder to catch sex traffickers:

https://cdt.org/insights/its-all-downsides-hybrid-fosta-sesta-hinders-law-enforcement-hurts-victims-and-speakers/

This is exactly what SESTA/FOSTA's advocates were warned of. They were warned. They did it anyway. Fuck those people.

Maybe you have a theory about how platforms can be held civilly liable for their users' speech without harming marginalized people in exactly the way that SESTA/FOSTA, it had better amount to more than "platforms are evil monopolists and CDA 230 makes their lives easier." Yes, they're evil monopolists. Yes, 230 makes their lives easier. But without 230, small forums – private message boards, Mastodon servers, Bluesky, etc – couldn't possibly operate.

There's a reason Mark Zuckerberg wants to kill CDA 230, and it's not because he wants to send Facebook to the digital graveyard. Zuck knows that FB can operate in a post-230 world by automating the deletion of all controversial speech, and he knows that small services that might "disrupt" Facebook's hegemony would be immediately extinguished by eliminating 230:

https://www.nbcnews.com/tech/tech-news/zuckerberg-calls-changes-techs-section-230-protections-rcna486

It's depressing to see so many comrades in the fight against Big Tech getting suckered into carrying water for Zuck, demanding the eradication of CDA 230. Please, I beg you: look at the evidence for what happens when you remove that fence. Heed the warnings. Don't be like Bill Clinton, or California fire suppression officials, or James Moore and Tony Clement, or the European Parliament, or the US Trade Rep, or cryptocurrency freaks, or Malcolm Turnbull.

Or Ashton fucking Kutcher.

Because, you know, fuck those guys.



A remix of the cover of the Tor Books edition of 'Picks and Shovels,' depicting a vector art vintage PC, whose blue screen includes a male figure stepping out of the picture to the right. Superimposed on the art is the book's title in a custom, modernist font.

Picks and Shovels Chapter One (Part 4) (permalink)

This month, I'm serializing the first chapter of my next novel, Picks and Shovels, a standalone Martin Hench novel that drops on Feb 17:

https://us.macmillan.com/books/9781250865908/picksandshovels

The book is up for presale on a Kickstarter that features the whole series as print books (with the option of personalized inscriptions), DRM-free ebooks, and a DRM-free audiobook read by Wil Wheaton:

https://www.kickstarter.com/projects/doctorow/picks-and-shovels-marty-hench-at-the-dawn-of-enshittification

It's a story of how the first seeds of enshittification were planted in Silicon Valley, just as the first PCs were being born.

Here's part one:

https://pluralistic.net/2025/01/09/the-reverend-sirs/#fidelity-computing

Part two:

https://pluralistic.net/2025/01/10/smoke-filled-room-where-it-happens/#computing-freedom

Part three:

https://pluralistic.net/2025/01/11/socialism-for-the-rich/#a-lighter-shade-of-mauveor

And now, onto part four!

The San Antonio girl—the daughter of a local real-estate broker—had no idea what floppy disks the president was talking about, so he showed her the catalog and she immediately called the rep in Colma. The receptionist was on the ball and passed the call on to Shlomo, who immediately grasped the catalog’s significance and approved an expensive Federal Express courier.

“Our general counsel advised us to seek an injunction and file a suit,” Bishop Clarke said.

“It would have been better to talk, of course,” the rabbi said. “Nobody wanted to drag those three little girls into court. They’re like family, even though they left.”

Up until then, they’d all been telling the same story, but something about what Rabbi Finkel said stopped its momentum. I’d been practicing my listening, trying to be like Lucille, listening with my eyes and my ears. The rabbi’s statement jolted the other two. Now we’re coming to the crux, I thought. This is the part where I come in.

“They were good at their jobs,” Bishop Clarke said, almost wistful.

“They surprised us,” Father Marek said.

“Perhaps we could find an accommodation,” the rabbi said. The three men looked at each other. How long had they been in business together, in each other’s pockets, maybe at each other’s throats? The story of interfaith harmony was such a juicy one, the stuff of magazine cover stories. Was it true, though?

“They just need convincing,” Bishop Clarke said. His smile flickered on and off. He must have had dental work. The standard-issue teeth just didn’t come that way: shining, white, perfect symmetry. On, off. Maybe he practiced it in front of a mirror.

Discovery is the part of a lawsuit where the parties can demand relevant documents from one another: memos, contracts, correspondence.

Tortious interference is the legal offense of stepping between two contracting parties in a way that induces one of them to violate their contractual obligations. Suing for tortious interference is the commercial version of a jilted wife confronting her erstwhile husband’s lover, as though his infidelity was her fault.

Fidelity’s lawyers—an outside firm with a reputation for aggression and a roster of blue-chip clients and high-profile cases, including IBM’s ongoing troubles with the Department of Justice over its alleged antitrust violations—had drawn up a complaint asserting that CF had induced Fidelity’s suppliers to violate their confidentiality and exclusivity agreements, while simultaneously inducing the company’s best customers to forgo their contractual obligations (and semireligious duty) to buy their supplies from Fidelity and its sales agents in their congregations.

These sweeping allegations gave Fidelity’s lawyers sweeping discovery powers: all documents and accounts related to CF’s manufacturing, promotion, and sales, right down to the printers who supplied their catalogs.

CF wasn’t powerless in the face of this onslaught. Their lawyers—a much cheaper and hungrier firm of lawyers, without the pedigree or track record of their opposing counsel—had secured the right to redact irrelevant, sensitive material from the documents they turned over, and, more crucially, they had convinced the judge to let them do something novel.

The bishop hoisted a banker’s box onto the table and set it down with a thud. He lifted the lid like a conjurer’s trick and brought out two thick binders of paperwork, bristling with dividers. “This is the hardcopy,” he said. “It’s almost nothing. Photocopies of handwritten memos, mostly.”

He reached back in and produced a mauve box of floppy disks, the five – and – a – quarter – inch kind that already seemed slightly quaint, compared to the small, rigid three – and – a – half – inch floppies that all the new computers were using. He produced a second box. A third. A fourth. A fifth. The pile grew.

“Ten boxes of floppy disks,” the bishop said. “No one had ever asked such a thing of our judge, but he said that two computer companies should be able to accept electronic submissions from one another. He said it was obvious that this was the future of discovery, and that we were the perfect litigants to start with, since our dispute was about their piracy of our formats and disks, so of course we’d have compatible systems.

“Somewhere in here is the evidence that they are going to fail in court, the evidence that will force them to come back to the table and negotiate, to talk, the way they should have in the first place. They’ve found some good ways of doing things, and we’re interested in that. We want to work with them, not ruin them. We could arrange a sale of their little company to Fidelity, on preferable terms, but with something in there to recognize their clever little inventions and innovations. They’d get something, rather than nothing.” The bishop spread his hands, patted the air. It’s only reasonable, his hands said.

“Better they get the money than the lawyers,” the rabbi said.

“Something is always better than nothing,” Father Marek said. “Even an idiot should be able to see that.” The other two shot him looks. He scowled at them.

“We need someone who can make sense of all this.” The bishop pointed at his precarious tower of floppy disks. “They thought that they’d overwhelm us with electronic records. That our lawyers were so conservative that they wouldn’t be able to sort through them. It’s true, they’re not set up for this. No one is, but someone could be. We think that for the right kind of person, someone who understands accounting and computers, these records will be easier to handle.”

There it was. They looked at me, three worried sets of eyes. This wasn’t how they normally operated. They were taking a risk. I wondered whose idea this was. Not Father Marek: he wanted vengeance. He’d be happy to smash CF, make an example of them. Rabbi Finkel? Perhaps. I could see that he was a thinker, someone who looked around corners. The bishop? He’d done most of the talking. But I got the impression he always did most of the talking: a Mormon bishop, after all, didn’t wear a dog collar or a beard and yarmulke. Mormon bishops are laypeople, after all. They look secular.


Hey look at this (permalink)



A Wayback Machine banner.

This day in history (permalink)

#20yrsago Handbag embossed with handgun https://web.archive.org/web/20050114061719/http://www.popgadget.net/2005/01/guardian-angel-bags.html

#15yrsago Stripped of opportunites for wonder, gratitude and guilt https://www.bunniestudios.com/blog/2010/the-enlightening-bridge-between-art-and-work/

#15yrsago France’s anti-piracy goon squad pirates the font in its logo https://torrentfreak.com/french-3-strikes-group-unveils-copyright-infringing-logo-100112/

#15yrsago Steven Brust’s IORICH: sword and sorcery and law and order https://memex.craphound.com/2010/01/12/steven-brusts-iorich-sword-and-sorcery-and-law-and-order/

#15yrsago Bruce Sterling’s wonderful novella Kiosk in podcast form http://www.starshipsofa.com/blog/2010/01/13/aural-delights-no-116-bruce-sterling/

#15yrsago Bob Basset’s latest steampunk mask https://web.archive.org/web/20100118104624/http://bobbasset.com/?p=300

#15yrsago EFF’s trends for 2010 https://www.eff.org/deeplinks/2010/01/trends-2010

#15yrsago Hiaasen’s BASKET CASE: hilarious mystery novel about the last newspaperpocalypse https://memex.craphound.com/2010/01/13/hiaasens-basket-case-hilarious-mystery-novel-about-the-last-newspaperpocalypse/

#10yrsago Teens’ use of social media is significantly shaped by race, class, geography, cultural background https://medium.com/message/an-old-fogeys-analysis-of-a-teenagers-view-on-social-media-5be16981034d

#10yrsago Freedom of speech is now compulsory https://scarfolk.blogspot.com/2015/01/freedom-of-speech-public-information.html

#10yrsago What David Cameron just proposed would endanger every Briton and destroy the IT industry https://memex.craphound.com/2015/01/13/what-david-cameron-just-proposed-would-endanger-every-briton-and-destroy-the-it-industry/

#10yrsago Jo Walton’s “The Just City” https://memex.craphound.com/2015/01/13/jo-waltons-the-just-city/

#10yrsago Recipe: picture book that introduces sloppy cooking and social engineering https://memex.craphound.com/2015/01/12/recipe-picture-book-that-introduces-sloppy-cooking-and-social-engineering/

#5yrsago Glossary: Chinese futurist military jargon https://memex.craphound.com/2020/01/12/glossary-chinese-futurist-military-jargon/

#5yrsago The DHS classes nonviolent environmental activists in the same “domestic terrorist” category as Dylan Roof and James Fields https://www.theguardian.com/environment/2020/jan/13/us-listed-climate-activist-group-extremists

#5yrsago Charter/Spectrum sold customers expensive home security systems, then killed the program and left them high and dry https://gizmodo.com/spectrum-kills-home-security-business-refuses-refunds-1840931761

#5yrsago Olympics warns athletes that kneeling, fist-raising and other political actions will be banned at the Tokyo 2020 games https://www.nakedcapitalism.com/2020/01/cowardice-olympics-committee-slammed-for-new-guidelines-barring-athletes-from-kneeling-raising-fists.html

#5yrsago Top tech grads are increasingly unwilling to work for Big Tech, viewing it as a new, unethical Wall Street https://www.nytimes.com/2020/01/11/style/college-tech-recruiting.html

#5yrsago The bubbles in VR, cryptocurrency and machine learning are all part of the parallel computing bubble https://memex.craphound.com/2020/01/13/the-bubbles-in-vr-cryptocurrency-and-machine-learning-are-all-part-of-the-parallel-computing-bubble/

#1yrago Tech workers and gig workers need each other https://pluralistic.net/2024/01/13/solidarity-forever/#tech-unions

#1yrago The Cult of Mac https://pluralistic.net/2024/01/12/youre-holding-it-wrong/#if-dishwashers-were-iphones


Upcoming appearances (permalink)

A photo of me onstage, giving a speech, holding a mic.



A screenshot of me at my desk, doing a livecast.

Recent appearances (permalink)



A grid of my books with Will Stahle covers..

Latest books (permalink)



A cardboard book box with the Macmillan logo.

Upcoming books (permalink)

  • Picks and Shovels: a sequel to "Red Team Blues," about the heroic era of the PC, Tor Books, February 2025

  • Enshittification: Why Everything Suddenly Got Worse and What to Do About It, Farrar, Straus, Giroux, October 2025
    https://us.macmillan.com/books/9780374619329/enshittification/

  • Unauthorized Bread: a middle-grades graphic novel adapted from my novella about refugees, toasters and DRM, FirstSecond, 2025



Colophon (permalink)

Today's top sources:

Currently writing:

  • Enshittification: a nonfiction book about platform decay for Farrar, Straus, Giroux. Status: second pass edit underway (readaloud)

  • A Little Brother short story about DIY insulin PLANNING

  • Picks and Shovels, a Martin Hench noir thriller about the heroic era of the PC. FORTHCOMING TOR BOOKS FEB 2025

Latest podcast: Picks and Shovels Chapter One https://craphound.com/overclocked/2025/01/10/picks-and-shovels-chapter-one/


This work – excluding any serialized fiction – is licensed under a Creative Commons Attribution 4.0 license. That means you can use it any way you like, including commercially, provided that you attribute it to me, Cory Doctorow, and include a link to pluralistic.net.

https://creativecommons.org/licenses/by/4.0/

Quotations and images are not included in this license; they are included either under a limitation or exception to copyright, or on the basis of a separate license. Please exercise caution.


How to get Pluralistic:

Blog (no ads, tracking, or data-collection):

Pluralistic.net

Newsletter (no ads, tracking, or data-collection):

https://pluralistic.net/plura-list

Mastodon (no ads, tracking, or data-collection):

https://mamot.fr/@pluralistic

Medium (no ads, paywalled):

https://doctorow.medium.com/

Twitter (mass-scale, unrestricted, third-party surveillance and advertising):

https://twitter.com/doctorow

Tumblr (mass-scale, unrestricted, third-party surveillance and advertising):

https://mostlysignssomeportents.tumblr.com/tagged/pluralistic

"When life gives you SARS, you make sarsaparilla" -Joey "Accordion Guy" DeVilla

2025-01-12T22:24:32+00:00 Fullscreen Open in Tab
Note published on January 12, 2025 at 10:24 PM UTC
Sat, 11 Jan 2025 18:58:53 +0000 Fullscreen Open in Tab
Pluralistic: The cod-Marxism of personalized pricing; Picks and Shovels Chapter One (Part 3) (11 Jan 2025)


Today's links



A Soviet propaganda poster depicting two workers holding flags in front of a locomotive. The flags have been replaced with US flags. The locomotive's face has been replaced with the glaring red eye of HAL 9000 from Kubrick's '2001: A Space Odyssey.' The maxim below has been replaced with the lettering from a Walmart 'everyday low prices' sign. The background has been replaced with a posterized grocery aisle.

The cod-Marxism of personalized pricing (permalink)

The social function of the economics profession is to explain, over and over again, that your boss is actually right and that you don't really want the things you want, and you're secretly happy to be abused by the system. If that wasn't true, why would your "choose" commercial surveillance, abusive workplaces and other depredations?

In other words, economics is the "look what you made me do" stick that capitalism uses to beat us with. We wouldn't spy on you, rip you off or steal your wages if you didn't choose to use the internet, shop with monopolists, or work for a shitty giant company. The technical name for this ideology is "public choice theory":

https://pluralistic.net/2022/06/05/regulatory-capture/

Of all the terrible things that economists say we all secretly love, one of the worst is "price discrimination." This is the idea that different customers get charged different amounts based on the merchant's estimation of their ability to pay. Economists insist that this is "efficient" and makes us all better off. After all, the marginal cost of filling the last empty seat on the plane is negligible, so why not sell that seat for peanuts to a flier who doesn't mind the uncertainty of knowing whether they'll get a seat at all? That way, the airline gets extra profits, and they split those profits with their customers by lowering prices for everyone. What's not to like?

Plenty, as it turns out. With only four giant airlines who've carved up the country so they rarely compete on most routes, why would an airline use their extra profits to lower prices, rather than, say, increasing their dividends and executive bonuses?

For decades, the airline industry was the standard-bearer for price discrimination. It was basically impossible to know how much a plane ticket would cost before booking it. But even so, airlines were stuck with comparatively crude heuristics to adjust their prices, like raising the price of a ticket that didn't include a Saturday stay, on the assumption that this was a business flyer whose employer was footing the bill:

https://pluralistic.net/2024/06/07/drip-drip-drip/#drip-off

With digitization and mass commercial surveillance, we've gone from pricing based on context (e.g. are you buying your ticket well in advance, or at the last minute?) to pricing based on spying. Digital back-ends allow vendors to ingest massive troves of commercial surveillance data from the unregulated data-broker industry to calculate how desperate you are, and how much money you have. Then, digital front-ends – like websites and apps – allow vendors to adjust prices in realtime based on that data, repricing goods for every buyer.

As digital front-ends move into the real world (say, with digital e-ink shelf-tags in grocery stores), vendors can use surveillance data to reprice goods for ever-larger groups of customers and types of merchandise. Grocers with e-ink shelf tags reprice their goods thousands of times, every day:

https://pluralistic.net/2024/03/26/glitchbread/#electronic-shelf-tags

Here's where an economist will tell you that actually, your boss is right. Many groceries are perishable, after all, and e-ink shelf tags allow grocers to reprice their goods every minute or two, so yesterday's lettuce can be discounted every fifteen minutes through the day. Some customers will happily accept a lettuce that's a little gross and liztruss if it means a discount. Those customers get a discount, the lettuce isn't thrown out at the end of the day, and everyone wins, right?

Well, sure, if. If the grocer isn't part of a heavily consolidated industry where competition is a distant memory and where grocers routinely collude to fix prices. If the grocer doesn't have to worry about competitors, why would they use e-ink tags to lower prices, rather than to gouge on prices when demand surges, or based on time of day (e.g. making frozen pizzas 10% more expensive from 6-8PM)?

And unfortunately, groceries are one of the most consolidated sectors in the modern world. What's more, grocers keep getting busted for colluding to fix prices and rip off shoppers:

https://www.cbc.ca/news/business/loblaw-bread-price-settlement-1.7274820

Surveillance pricing is especially pernicious when it comes to apps, which allow vendors to reprice goods based not just on commercially available data, but also on data collected by your pocket distraction rectangle, which you carry everywhere, do everything with, and make privy to all your secrets. Worse, since apps are a closed platform, app makers can invoke IP law to criminalize anyone who reverse-engineers them to figure out how they're ripping you off. Removing the encryption from an app is a potential felony punishable by a five-year prison sentence and a $500k fine (an app is just a web-page skinned in enough IP to make it a crime to install a privacy blocker on it):

https://pluralistic.net/2024/08/15/private-law/#thirty-percent-vig

Large vendors love to sell you shit via their apps. With an app, a merchant can undetectably change its prices every few seconds, based on its estimation of your desperation. Uber pioneered this when they tweaked the app to raise the price of a taxi journey for customers whose batteries were almost dead. Today, everyone's getting in on the act. McDonald's has invested in a company called Plexure that pitches merchants on the use case of raising the cost of your normal breakfast burrito by a dollar on the day you get paid:

https://pluralistic.net/2024/06/05/your-price-named/#privacy-first-again

Surveillance pricing isn't just a matter of ripping off customers, it's also a way to rip off workers. Gig work platforms use surveillance pricing to titrate their wage offers based on data they buy from data brokers and scoop up with their apps. Veena Dubal calls this "algorithmic wage discrimination":

https://pluralistic.net/2023/04/12/algorithmic-wage-discrimination/#fishers-of-men

Take nurses: increasingly, American hospitals are firing their waged nurses and replacing them with gig nurses who are booked in via an app. There's plenty of ways that these apps abuse nurses, but the most ghastly is in how they price nurses' wages. These apps buy nurses' financial data from data-brokers so they can offer lower wages to nurses with lots of credit card debt, on the grounds that crushing debt makes nurses desperate enough to accept a lower wage:

https://pluralistic.net/2024/12/18/loose-flapping-ends/#luigi-has-a-point

This week, the excellent Lately podcast has an episode on price discrimination, in which cohost Vass Bednar valiantly tries to give economists their due by presenting the strongest possible case for charging different prices to different customers:

https://www.theglobeandmail.com/podcasts/lately/article-the-end-of-the-fixed-price/

Bednar really tries, but – as she later agrees – this just isn't a very good argument. In fact, the only way charging different prices to different customers – or offering different wages to different workers – makes sense is if you're living in a socialist utopia.

After all, a core tenet of Marxism is "from each according to his ability, to each according to his needs." In a just society, people who need more get more, and people who have less, pay less:

https://en.wikipedia.org/wiki/From_each_according_to_his_ability,_to_each_according_to_his_needs

Price discrimination, then, is a Bizarro-world flavor of cod-Marxism. Rather than having a democratically accountable state that sets wages and prices based on need and ability, price discrimination gives this authority to large firms with pricing power, no regulatory constraints, and unlimited access to surveillance data. You couldn't ask for a neater example of the maxim that "What matters isn't what technology does. What matters is who it does it for; and who it does it to."

Neoclassical economists say that all of this can be taken care of by the self-correcting nature of markets. Just give consumers and workers "perfect information" about all the offers being made for their labor or their business, and things will sort themselves out. In the idealized models of perfectly spherical cows of uniform density moving about on a frictionless surface, this does work out very well:

https://pluralistic.net/2023/04/03/all-models-are-wrong/#some-are-useful

But while large companies can buy the most intimate information imaginable about your life and finances, IP law lets them capture the state and use it to shut down any attempts you make to discover how they operate. When an app called Para offered Doordash workers the ability to preview the total wage offered for a job before they accepted it, Doordash threatened them with eye-watering legal penalties, then threw dozens of full-time engineers at them, changing the app several times per day to shut out Para:

https://pluralistic.net/2021/08/07/hr-4193/#boss-app

And when an Austrian hacker called Mario Zechner built a tool to scrape online grocery store prices – discovering clear evidence of price-fixing conspiracies in the process – he was attacked by the grocery cartel for violating their "IP rights":

https://pluralistic.net/2023/09/17/how-to-think-about-scraping/

This is Wilhoit's Law in action:

Conservatism consists of exactly one proposition, to wit: There must be in-groups whom the law protects but does not bind, alongside out-groups whom the law binds but does not protect.

https://en.wikipedia.org/wiki/Francis_M._Wilhoit#Wilhoit's_law

Of course, there wouldn't be any surveillance pricing without surveillance. When it comes to consumer privacy, America is a no-man's land. The last time Congress passed a new consumer privacy law was in 1988, when they enacted the Video Privacy Protection Act, which bans video-store clerks from revealing which VHS cassettes you take home. Congress has not addressed a single consumer privacy threat since Die Hard was still playing in theaters.

Corporate bullies adore a regulatory vacuum. The sleazy data-broker industry that has festered and thrived in the absence of a modern federal consumer privacy law is absolutely shameless. For example, every time an app shows you an ad, your location is revealed to dozens of data-brokers who pretend to be bidding for the right to show you an ad. They store these location data-points and combine them with other data about you, which they sell to anyone with a credit card, including stalkers, corporate spies, foreign governments, and anyone hoping to reprice their offerings on the basis of your desperation:

https://www.404media.co/candy-crush-tinder-myfitnesspal-see-the-thousands-of-apps-hijacked-to-spy-on-your-location/

Under Biden, the outgoing FTC did incredible work to fill this gap, using its authority under Section 5 of the Federal Trade Commission Act (which outlaws "unfair and deceptive" practices) to plug some of the worst gaps in consumer privacy law:

https://pluralistic.net/2024/07/24/gouging-the-all-seeing-eye/#i-spy

And Biden's CFPB promulgated a rule that basically bans data brokers:

https://pluralistic.net/2024/06/10/getting-things-done/#deliverism

But now the burden of enforcing these rules falls to Trump's FTC, whose new chairman has vowed to end the former FTC's "war on business." What America desperately needs is a new privacy law, one that has a private right of action (so that individuals and activist groups can sue without waiting for a public enforcer to take up their causes) and no "pre-emption" (so that states can pass even stronger privacy laws):

https://www.eff.org/deeplinks/2022/07/federal-preemption-state-privacy-law-hurts-everyone

How will we get that law? Through a coalition. After all, surveillance pricing is just one of the many horrors that Americans have to put up with thanks to America's privacy law gap. The "privacy first" theory goes like this: if you're worried about social media's impact on teens, or women, or old people, you should start by demanding a privacy law. If you're worried about deepfake porn, you should start by demanding a privacy law. If you're worried about algorithmic discrimination in hiring, lending, or housing, you should start by demanding a privacy law. If you're worried about surveillance pricing, you should start by demanding a privacy law. Privacy law won't entirely solve all these problems, but none of them would be nearly as bad if Congress would just get off its ass and catch up with the privacy threats of the 21st century. What's more, the coalition of everyone who's worried about all the harms that arise from commercial surveillance is so large and powerful that we can get Congress to act:

https://pluralistic.net/2023/12/06/privacy-first/#but-not-just-privacy

Economists, meanwhile, will line up to say that this is all unnecessary. After all, you "sold" your privacy when you clicked "I agree" or walked under a sign warning you that facial recognition was in use in this store. The market has figured out what you value privacy at, and it turns out, that value is nothing. Any kind of privacy law is just a paternalistic incursion on your "freedom to contract" and decide to sell your personal information. It is "market distorting."

In other words, your boss is right.

(Image: Ser Amantio di Nicolao, CC BY-SA 3.0; Cryteria, CC BY 3.0, modified)



A remix of the cover of the Tor Books edition of 'Picks and Shovels,' depicting a vector art vintage PC, whose blue screen includes a male figure stepping out of the picture to the right. Superimposed on the art is the book's title in a custom, modernist font.

Picks and Shovels Chapter One (Part 3) (permalink)

This week, I'm serializing the first chapter of my next novel, Picks and Shovels, a standalone Martin Hench novel that drops on Feb 17:

https://us.macmillan.com/books/9781250865908/picksandshovels

The book is up for presale on a Kickstarter that features the whole series as print books (with the option of personalized inscriptions), DRM-free ebooks, and a DRM-free audiobook read by Wil Wheaton:

https://www.kickstarter.com/projects/doctorow/picks-and-shovels-marty-hench-at-the-dawn-of-enshittification

It's a story of how the first seeds of enshittification were planted in Silicon Valley, just as the first PCs were being born.

Here's part one:

https://pluralistic.net/2025/01/09/the-reverend-sirs/#fidelity-computing

Part two:

https://pluralistic.net/2025/01/10/smoke-filled-room-where-it-happens/#computing-freedom

And now, onto part three!

The logo for the Computing Freedom was a stylized version of an inverted Fidelity Computing logo, colored magenta, just a few shades off of the mauve of the Fidelity family of products.

Their catalog was slimmer than Fidelity’s, omitting the computers themselves. Instead, it was filled with all the things that went with the computers: printers, ribbons, paper, floppy drives and disks, RAM and modems. Unlike the Fidelity catalog, the CF’s catalog had prices. They were perfectly reasonable prices, maybe even a little on the high side.

“Our computers, they’re a system,” Bishop Clarke said. “We provide everything, and guarantee that it will all work together. Our customers aren’t sophisticated, they’re not high-tech people. They’re people who organize their lives around their faith, not chasing a fad or obsessing over gadgets.”

“We hold their hands,” Rabbi Finkel said. “There’s always someone who’ll answer the phone and help them, whatever problem they’re having. It’s like a family. One of their computers breaks, we send them another one! That way, they can keep working. We know the system is important to them.”

“It’s not cheap,” Father Marek said. “That kind of customer service isn’t cheap.”

“We filed suit as soon as we found out,” Bishop Clarke said. “We didn’t want to.” He looked sad. “What choice did we have.” It wasn’t a question.

CF managed to fly under the radar for a couple of months. They started with sales calls, cold calls to their old contacts, their best customers, explaining that they had created a new business, one that could supply them with high-quality, interchangeable products for their Fidelity systems. The prices were much lower than Fidelity’s, often less than half.

“Sure they were less than half,” Father Marek said. “When you don’t have to pay a roomful of customer-service people, you don’t have to charge as much.”

The customers were happy, but then a San Antonio stake president was invited to dinner at the home of a local prominent businessman, the owner of a large printshop who relied so heavily on Fidelity systems to run his business that he kept one at home, in his study, with a modem that let him dial into the plant and look at the day’s production figures and examine the hour sheets and payroll figures.

The president noticed the odd-colored box of fanfold printer paper behind the congregant’s desk, feeding a continuous river of paper into the printer’s sprockets. He asked after the odd packaging and the parishioner gave him a catalog (CF included a spare catalog with every order, along with a handwritten note on quarter-sized stationery thanking the customer for his business).

The president assumed that this was some kind of new division of Fidelity, and he was impressed with the prices and selection in the catalog. Naturally, when he needed a new box of floppy disks, he asked one of the girls in his congregation for a box of the low-cost items—

“Why would he ask a girl in his congregation? Didn’t he have a Fidelity sales rep?” I’d filled much of my little steno pad with notes by this point. It was quite a story but I wasn’t quite sure where I fit in with it.

Bishop Clarke started to answer, but Father Marek silenced him by clearing his throat in a loud and pointed way. The priest stared at me for a long time, seeming to weigh me and find me wanting. I can’t say I liked him, but he fascinated me. He had such a small bag of tricks, those glares and noises, but he was a virtuoso with them, like a diner cook who can only make a half dozen dishes but prepares them with balletic grace.

“Mr. Hench,” he said. He let the words hang in the air. “Mr. Hench,” he said again. I knew it was a trick but he performed it so well. I felt a zing of purely irrational, utterly involuntary anxiety. “We don’t have a traditional sales force. The sales groups are small, and their primary role is Empowerment.” He leaned so heavily on the word that I heard the capital letter.

“Our sales groups travel around, they meet people in each place who know their communities, people who have the knack for technology, who need a little side business to help them make ends meet. The sales groups train these people, teach them how to spot people who could use our systems, how to explain the benefits to them. They use their personal connections, the mutual trust, to put our machines where they can do the most good.”

Bishop Clarke could see I wasn’t quite following. “It’s like the Avon Lady. You know, ‘ding-dong Avon calling’? Those girls are talking to their neighbors, helping them find the right products. Their friends get the best products for their needs, the girls get a commission, and everyone is happy.”

I got it then. Fidelity was a pyramid scheme. Well, that was a waste of time. I almost said so, but then I held my tongue. I didn’t want to get into an argument with these men, I just wanted to leave.

“We’re not a pyramid scheme,” Rabbi Finkel said. Had it shown on my face? Maybe rabbis got a lot of practice reading people, hearing the unsaid words. “We follow the rules. The Federal Trade Commission set the rules in 1979 and we’ve always followed them. We are a community-oriented business, serving faith groups, and we want to give back to them. That’s why we pay commissions to local people. It’s our way of putting some of our profits into the communities that depend on us.”

“That’s so well said,” Bishop Clarke said. “So well said. Perfect, in fact.”

“Perfect,” Father Marek said, with a scowl that made it clear he wasn’t happy to have been interrupted.


Hey look at this (permalink)



A Wayback Machine banner.

This day in history (permalink)

#20yrsago Sheet-music for Super Mario https://web.archive.org/web/20050112012306/https://gprime.net/images/mariopiano/

#20yrsago Jailed for a Song: Human-readable copyfight explanation https://web.archive.org/web/20050121142031/http://www.jailedforasong.com/

#20yrsago Free beer that’s free as in speech https://web.archive.org/web/20050121093653/http://www.voresoel.dk/main.php?id=70

#20yrsago IBM turning 500 patents over for free implementation https://web.archive.org/web/20100505080603/http://www.groklaw.net/article.php?story=20050110235654673

#20yrsago Fundie denounces sf for atheism, nudism https://web.archive.org/web/20100111034704/https://www.wayoflife.org/files/2fd19aa02a25c87c4946a653a20f1344-486.html

#15yrsago Bruce Schneier’s TSA logo redesign contest https://www.schneier.com/blog/archives/2010/01/tsa_logo_contes.html

#15yrsago Secret London: guide to the weird and wonderful secrets of London-town https://memex.craphound.com/2010/01/11/secret-london-guide-to-the-weird-and-wonderful-secrets-of-london-town/

#5yrsago William Gibson talks about scrapping and rewriting a novel after the 2016 Trump election https://www.theguardian.com/books/2020/jan/11/william-gibson-i-was-losing-a-sense-of-how-weird-the-real-world-was

#5yrsago Departing Kotaku writers post a farewell message to their private equity asshole boss: “Sup dude. Suck it.” https://kotaku.com/goodbye-from-josh-and-gita-1840936478

#5yrsago America’s most popular governor: the lavishly corrupt Larry Hogan [R-MD] https://newrepublic.com/article/156183/popular-crook-america

#1yrago The real AI automation threat to workers https://pluralistic.net/2024/01/11/robots-stole-my-jerb/#computer-says-no


Upcoming appearances (permalink)

A photo of me onstage, giving a speech, holding a mic.



A screenshot of me at my desk, doing a livecast.

Recent appearances (permalink)



A grid of my books with Will Stahle covers..

Latest books (permalink)



A cardboard book box with the Macmillan logo.

Upcoming books (permalink)

  • Picks and Shovels: a sequel to "Red Team Blues," about the heroic era of the PC, Tor Books, February 2025

  • Enshittification: Why Everything Suddenly Got Worse and What to Do About It, Farrar, Straus, Giroux, October 2025

  • Unauthorized Bread: a middle-grades graphic novel adapted from my novella about refugees, toasters and DRM, FirstSecond, 2025



Colophon (permalink)

Today's top sources:

Currently writing:

  • Enshittification: a nonfiction book about platform decay for Farrar, Straus, Giroux. Status: second pass edit underway (readaloud)

  • A Little Brother short story about DIY insulin PLANNING

  • Picks and Shovels, a Martin Hench noir thriller about the heroic era of the PC. FORTHCOMING TOR BOOKS FEB 2025

Latest podcast: Picks and Shovels Chapter One https://craphound.com/overclocked/2025/01/10/picks-and-shovels-chapter-one/


This work – excluding any serialized fiction – is licensed under a Creative Commons Attribution 4.0 license. That means you can use it any way you like, including commercially, provided that you attribute it to me, Cory Doctorow, and include a link to pluralistic.net.

https://creativecommons.org/licenses/by/4.0/

Quotations and images are not included in this license; they are included either under a limitation or exception to copyright, or on the basis of a separate license. Please exercise caution.


How to get Pluralistic:

Blog (no ads, tracking, or data-collection):

Pluralistic.net

Newsletter (no ads, tracking, or data-collection):

https://pluralistic.net/plura-list

Mastodon (no ads, tracking, or data-collection):

https://mamot.fr/@pluralistic

Medium (no ads, paywalled):

https://doctorow.medium.com/

Twitter (mass-scale, unrestricted, third-party surveillance and advertising):

https://twitter.com/doctorow

Tumblr (mass-scale, unrestricted, third-party surveillance and advertising):

https://mostlysignssomeportents.tumblr.com/tagged/pluralistic

"When life gives you SARS, you make sarsaparilla" -Joey "Accordion Guy" DeVilla

2025-01-11T09:46:01+00:00 Fullscreen Open in Tab
What's involved in getting a "modern" terminal setup?

Hello! Recently I ran a terminal survey and I asked people what frustrated them. One person commented:

There are so many pieces to having a modern terminal experience. I wish it all came out of the box.

My immediate reaction was “oh, getting a modern terminal experience isn’t that hard, you just need to….”, but the more I thought about it, the longer the “you just need to…” list got, and I kept thinking about more and more caveats.

So I thought I would write down some notes about what it means to me personally to have a “modern” terminal experience and what I think can make it hard for people to get there.

what is a “modern terminal experience”?

Here are a few things that are important to me, with which part of the system is responsible for them:

  • multiline support for copy and paste: if you paste 3 commands in your shell, it should not immediatly run them all! That’s scary! (shell, terminal emulator)
  • infinite shell history: if I run a command in my shell, it should be saved forever, not deleted after 500 history entries or whatever. Also I want commands to be saved to the history immediately when I run them, not only when I exit the shell session (shell)
  • a useful prompt: I can’t live without having my current directory and current git branch in my prompt (shell)
  • 24-bit colour: this is important to me because I find it MUCH easier to theme neovim with 24-bit colour support than in a terminal with only 256 colours (terminal emulator)
  • clipboard integration between vim and my operating system so that when I copy in Firefox, I can just press p in vim to paste (text editor, maybe the OS/terminal emulator too)
  • good autocomplete: for example commands like git should have command-specific autocomplete (shell)
  • having colours in ls (shell config)
  • a terminal theme I like: I spend a lot of time in my terminal, I want it to look nice and I want its theme to match my terminal editor’s theme. (terminal emulator, text editor)
  • automatic terminal fixing: If a programs prints out some weird escape codes that mess up my terminal, I want that to automatically get reset so that my terminal doesn’t get messed up (shell)
  • keybindings: I want Ctrl+left arrow to work (shell or application)
  • being able to use the scroll wheel in programs like less: (terminal emulator and applications)

There are a million other terminal conveniences out there and different people value different things, but those are the ones that I would be really unhappy without.

how I achieve a “modern experience”

My basic approach is:

  1. use the fish shell. Mostly don’t configure it, except to:
    • set the EDITOR environment variable to my favourite terminal editor
    • alias ls to ls --color=auto
  2. use any terminal emulator with 24-bit colour support. In the past I’ve used GNOME Terminal, Terminator, and iTerm, but I’m not picky about this. I don’t really configure it other than to choose a font.
  3. use neovim, with a configuration that I’ve been very slowly building over the last 9 years or so (the last time I deleted my vim config and started from scratch was 9 years ago)
  4. use the base16 framework to theme everything

A few things that affect my approach:

  • I don’t spend a lot of time SSHed into other machines
  • I’d rather use the mouse a little than come up with keyboard-based ways to do everything
  • I work on a lot of small projects, not one big project

some “out of the box” options for a “modern” experience

What if you want a nice experience, but don’t want to spend a lot of time on configuration? Figuring out how to configure vim in a way that I was satisfied with really did take me like ten years, which is a long time!

My best ideas for how to get a reasonable terminal experience with minimal config are:

  • shell: either fish or zsh with oh-my-zsh
  • terminal emulator: almost anything with 24-bit colour support, for example all of these are popular:
    • linux: GNOME Terminal, Konsole, Terminator, xfce4-terminal
    • mac: iTerm (Terminal.app doesn’t have 256-colour support)
    • cross-platform: kitty, alacritty, wezterm, or ghostty
  • shell config:
    • set the EDITOR environment variable to your favourite terminal text editor
    • maybe alias ls to ls --color=auto
  • text editor: this is a tough one, maybe micro or helix? I haven’t used either of them seriously but they both seem like very cool projects and I think it’s amazing that you can just use all the usual GUI editor commands (Ctrl-C to copy, Ctrl-V to paste, Ctrl-A to select all) in micro and they do what you’d expect. I would probably try switching to helix except that retraining my vim muscle memory seems way too hard. Also helix doesn’t have a GUI or plugin system yet.

Personally I wouldn’t use xterm, rxvt, or Terminal.app as a terminal emulator, because I’ve found in the past that they’re missing core features (like 24-bit colour in Terminal.app’s case) that make the terminal harder to use for me.

I don’t want to pretend that getting a “modern” terminal experience is easier than it is though – I think there are two issues that make it hard. Let’s talk about them!

issue 1 with getting to a “modern” experience: the shell

bash and zsh are by far the two most popular shells, and neither of them provide a default experience that I would be happy using out of the box, for example:

  • you need to customize your prompt
  • they don’t come with git completions by default, you have to set them up
  • by default, bash only stores 500 (!) lines of history and (at least on Mac OS) zsh is only configured to store 2000 lines, which is still not a lot
  • I find bash’s tab completion very frustrating, if there’s more than one match then you can’t tab through them

And even though I love fish, the fact that it isn’t POSIX does make it hard for a lot of folks to make the switch.

Of course it’s totally possible to learn how to customize your prompt in bash or whatever, and it doesn’t even need to be that complicated (in bash I’d probably start with something like export PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ ', or maybe use starship). But each of these “not complicated” things really does add up and it’s especially tough if you need to keep your config in sync across several systems.

An extremely popular solution to getting a “modern” shell experience is oh-my-zsh. It seems like a great project and I know a lot of people use it very happily, but I’ve struggled with configuration systems like that in the past – it looks like right now the base oh-my-zsh adds about 3000 lines of config, and often I find that having an extra configuration system makes it harder to debug what’s happening when things go wrong. I personally have a tendency to use the system to add a lot of extra plugins, make my system slow, get frustrated that it’s slow, and then delete it completely and write a new config from scratch.

issue 2 with getting to a “modern” experience: the text editor

In the terminal survey I ran recently, the most popular terminal text editors by far were vim, emacs, and nano.

I think the main options for terminal text editors are:

  • use vim or emacs and configure it to your liking, you can probably have any feature you want if you put in the work
  • use nano and accept that you’re going to have a pretty limited experience (for example I don’t think you can select text with the mouse and then “cut” it in nano)
  • use micro or helix which seem to offer a pretty good out-of-the-box experience, potentially occasionally run into issues with using a less mainstream text editor
  • just avoid using a terminal text editor as much as possible, maybe use VSCode, use VSCode’s terminal for all your terminal needs, and mostly never edit files in the terminal. Or I know a lot of people use code as their EDITOR in the terminal.

issue 3: individual applications

The last issue is that sometimes individual programs that I use are kind of annoying. For example on my Mac OS machine, /usr/bin/sqlite3 doesn’t support the Ctrl+Left Arrow keyboard shortcut. Fixing this to get a reasonable terminal experience in SQLite was a little complicated, I had to:

  • realize why this is happening (Mac OS won’t ship GNU tools, and “Ctrl-Left arrow” support comes from GNU readline)
  • find a workaround (install sqlite from homebrew, which does have readline support)
  • adjust my environment (put Homebrew’s sqlite3 in my PATH)

I find that debugging application-specific issues like this is really not easy and often it doesn’t feel “worth it” – often I’ll end up just dealing with various minor inconveniences because I don’t want to spend hours investigating them. The only reason I was even able to figure this one out at all is that I’ve been spending a huge amount of time thinking about the terminal recently.

A big part of having a “modern” experience using terminal programs is just using newer terminal programs, for example I can’t be bothered to learn a keyboard shortcut to sort the columns in top, but in htop I can just click on a column heading with my mouse to sort it. So I use htop instead! But discovering new more “modern” command line tools isn’t easy (though I made a list here), finding ones that I actually like using in practice takes time, and if you’re SSHed into another machine, they won’t always be there.

everything affects everything else

Something I find tricky about configuring my terminal to make everything “nice” is that changing one seemingly small thing about my workflow can really affect everything else. For example right now I don’t use tmux. But if I needed to use tmux again (for example because I was doing a lot of work SSHed into another machine), I’d need to think about a few things, like:

  • if I wanted tmux’s copy to synchronize with my system clipboard over SSH, I’d need to make sure that my terminal emulator has OSC 52 support
  • if I wanted to use iTerm’s tmux integration (which makes tmux tabs into iTerm tabs), I’d need to change how I configure colours – right now I set them with a shell script that I run when my shell starts, but that means the colours get lost when restoring a tmux session.

and probably more things I haven’t thought of. “Using tmux means that I have to change how I manage my colours” sounds unlikely, but that really did happen to me and I decided “well, I don’t want to change how I manage colours right now, so I guess I’m not using that feature!”.

It’s also hard to remember which features I’m relying on – for example maybe my current terminal does have OSC 52 support and because copying from tmux over SSH has always Just Worked I don’t even realize that that’s something I need, and then it mysteriously stops working when I switch terminals.

change things slowly

Personally even though I think my setup is not that complicated, it’s taken me 20 years to get to this point! Because terminal config changes are so likely to have unexpected and hard-to-understand consequences, I’ve found that if I change a lot of terminal configuration all at once it makes it much harder to understand what went wrong if there’s a problem, which can be really disorienting.

So I usually prefer to make pretty small changes, and accept that changes can might take me a REALLY long time to get used to. For example I switched from using ls to eza a year or two ago and while I like it (because eza -l prints human-readable file sizes by default) I’m still not quite sure about it. But also sometimes it’s worth it to make a big change, like I made the switch to fish (from bash) 10 years ago and I’m very happy I did.

getting a “modern” terminal is not that easy

Trying to explain how “easy” it is to configure your terminal really just made me think that it’s kind of hard and that I still sometimes get confused.

I’ve found that there’s never one perfect way to configure things in the terminal that will be compatible with every single other thing. I just need to try stuff, figure out some kind of locally stable state that works for me, and accept that if I start using a new tool it might disrupt the system and I might need to rethink things.

Fri, 10 Jan 2025 22:15:42 +0000 Fullscreen Open in Tab
Pluralistic: Occupy the Democratic National Committee; Picks and Shovels Chapter One (Part 2) (10 Jan 2025)


Today's links



A ramshackle, tumbledown shack, draped in patriotic bunting. On its porch stands a miserable, weeping donkey, dressed in the livery of the Democratic Party. To its left is the circle-D logo of the DNC. The sky is filled with ominous stormclouds.

Occupy the Democratic National Committee (permalink)

Back in 2017, the Democratic National Committee's lawyers submitted a legal brief that didn't just say the quiet part out loud; they bellowed it: "[The DNC can] go into back rooms like they used to and smoke cigars and pick the [presidential] candidate that way":

https://observer.com/2017/05/dnc-lawsuit-presidential-primaries-bernie-sanders-supporters/

The brief was submitted in the lawsuit between Bernie Sanders and the DNC. Sanders sued over the DNC changing the rules midway through 2016 process in order to sideline him and give the nomination to Hillary Clinton. The DNC's response boiled down to, "Sure, we cheated. So what? We, the committee, are ultimately answerable only to ourselves, and we can choose anyone to lead the party into any election."

The DNC is a weak institution, in other words. There's a universe in which that would be OK. After all, there's a lot of overhead that comes with making strong institutions, all those checks and balances and oversight and transparency soak up resources that you could be using to do other stuff. In an ideal world, a badly run Democratic Party would be spurred to improve after it lost elections, which would result in the defenestration of bad party bosses and the ouster of bad candidates:

https://pluralistic.net/2023/04/30/weak-institutions/

But the US political system is not an ideal world. In the real world, it's possible for party bosses who pursue disastrous strategies that result in key electoral losses to remain in power. The Democratic Party still rakes in massive donations from people who hate Trump more than they hate the Democratic Party's incompetence. Candidates in gerrymandered safe seats can be wildly incompetent and still hold onto power for improbably long timescales, despite the manifest evidence of their total unfitness for office:

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

In the absence of real consequences for corruption, incompetence and utter moral turpitude, the Democratic National Committee needs some other form of discipline to get it into fighting form. We need to occupy the DNC, strengthen its institutional safeguards, and turn it into an election-winning, fascism-fighting, extinction-rebelling, worker-defending powerhouse.

Three weeks from now, the DNC will meet in National Harbor MD to elect its new president and officers. Who gets to vote on that? The 448 members of the party's national committee. Who are they? As Micah Sifry writes for The American Prospect, it's a secret, even to the committee members:

https://prospect.org/politics/2025-01-10-opening-dncs-black-box/

No, really. While nominally, members can request a list of their fellow members, the DNC stalls and stonewalls and does everything it can to prevent the committee from communicating in any way they can't control. This is incredible, but it's true. Which is why Sifry has published a leaked list of all 448 members:

https://docs.google.com/spreadsheets/d/1bQKIP3W1NWChRjSbsE0O5k5s7OdgXrJi5-CMfFECIBU/edit?gid=0#gid=0

Looking at the spreadsheet of members, we get a rare glimpse inside the Democratic sausage factory. There's te 73 "at large" members who were voted on as a single block after being handpicked by outgoing president Jaime Harrison. These members are a mix of great people and terrible people, and that's by design: it meant that Sanders and Warren voters could only get their people onto the committee if they voted for some of the most disgusting corporate shills you can imagine.

The fact that the national committee's membership is secret and their communications must pass through a DNC chokepoint means that they get up to all kinds of shenanigans, like at the 2023 summer meeting where they voted themselves the power to throw out any bylaw amendments passed at a national party convention. The vote was whipped by paid DNC staff, creating an atmosphere so poisonous that Jessica Chambers (a rep from Wyoming) called the DNC "the least democratic organization that I’m involved with."

Sifry's breakdown is really useful: he identifies the minority of members who are elected by the party rank-and-file, calling them "the people most responsive to what the base of the party cares about." He also calls out the corporate shills who "buckrake as lobbists," like Donna Brazile, "a partner at “corporate reputation strategy firm.”

But even where state party organizations have elections for their committee members, some states keep the results of those elections a secret. Illinois, Minnesota, Missouri, New Jersey, New York, Ohio, and Pennsylvania have 69 members, but the identities of all but 14 of them are a secret.

This is a rotten institution, and that's by design. If you want to know why we can't have nice things – or, you know, a world that's not on fire and haunted by creeping fascism – this is why. The takeover of the DNC won't be easy, but it can't start until we know who the DNC is.



A remix of the cover of the Tor Books edition of 'Picks and Shovels,' depicting a vector art vintage PC, whose blue screen includes a male figure stepping out of the picture to the right. Superimposed on the art is the book's title in a custom, modernist font.

Picks and Shovels Chapter One (Part 2) (permalink)

This week, I'm serializing the first chapter of my next novel, Picks and Shovels, a standalone Martin Hench novel that drops on Feb 15:

https://us.macmillan.com/books/9781250865908/picksandshovels

The book is up for presale on a Kickstarter that features the whole series as print books (with the option of personalized inscriptions), DRM-free ebooks, and a DRM-free audiobook read by Wil Wheaton:

https://www.kickstarter.com/projects/doctorow/picks-and-shovels-marty-hench-at-the-dawn-of-enshittification

It's a story of how the first seeds of enshittification were planted in Silicon Valley, just as the first PCs were being born.

Here's part one:

https://pluralistic.net/2025/01/09/the-reverend-sirs/#fidelity-computing

And now, onto part two!

Rivka Goldman was the only woman in Sales Group One, this being the group that serviced and supported synagogues and their worshippers. She’d traveled all around the country, sitting down with men who owned garment factories, grocery stores, jewelry stores, delis, and other small businesses, training their “girls” in the use of the Fidelity system. It could handle business correspondence, company books, payroll, and other functions that used to be handled by four or five “girls”—who could all be replaced with just one.

Rivka was the only woman, and often it wasn’t she who made the sale, because the men who owned these businesses talked to other men. It was her male colleagues in Sales Group One who closed those sales and pocketed the commissions, but Rivka never complained.

“She was very good at it,” the rabbi told me. “She had a knack for computers, and for explaining them. The girls she trained, they learned. When they had troubles, they wanted to talk to her.”


Sister Maria-Eva Fernandez led a very large, all-woman team that ran mostly autonomously within Sales Group Two, a group that exclusively serviced parochial schools across the U.S., with a few customers in Central America. She was a product of these schools—she’d graduated from Christ the King in Denver and gone straight from there into the order, doing some student teaching before finding her way to Fidelity Computing via an internal talent search that filtered down to the convent from the archdiocese.

Like Rivka, Sister Maria-Eva was a natural: she could patiently train school administrators, their secretaries, department heads, and even individual teachers on the use of the Fidelity system. A couple of schools—fat with money from wealthy patrons—had bought entire classrooms’ worth of machines, creating programming labs for ambitious high-schoolers, and they were universally a success.

“We valued her, we praised her, we sent her to the national sales conference to lead workshops and share her expertise,” Father Marek said. “She was a star.” He spat the word.


Elizabeth Amelia Shepard Taylor didn’t have to go on a mission, but there was never any question but that she would. Her family had been prominent in the Church of Jesus Christ of Latter-day Saints for over a century, and, as the eldest of eleven kids, she had a familial duty to set an example.

She had hoped for a posting in Asia—she’d studied Cantonese and Japanese in high school—but instead she drew San Jose, California. She staffed the Mission House, helping the boys who knocked on doors all day, serving as den mother, big sister, and the object of innumerable crushes.

She’d found a women’s computing club via a notice at the local library and had taken turns with four other women—two her age, and two retirees—prodding at a pair of Commodore PET computers, learning BASIC. Her letters home to her family were filled with the excitement of discovery and mastery, the esoteric world of assembly language that she’d dived into with the help of books and magazines from the library.

When her father heard that Fidelity was recruiting, he wrote her a letter. The same day she’d received it, she’d written a letter to Fidelity Computing Ltd., typing it up on the used ZX80 she’d bought at a swap meet (“for the Mission House”). It arrived at Fidelity in a #10 envelope, three neatly printed pages with the rough edges of fanfold paper that had had its perforations separated. The last page was all code examples.

She was promised a job by return post, starting the day she finished her mission, and she never ended up going back to Salt Lake City—just got a Caltrain train to the Daly City station and met with a Bishop Clarke’s personal assistant, a young man named John Garn who had done his mission in Taipei and chatted with her the whole way to the office in Taiwanese, which she laboriously parsed into Cantonese.

“She whipped Sales Group Three into a powerhouse,” Bishop Clarke said, with a sad shake of his head. “We went from last to first in under a year. Outsold the other two divisions combined, and we were on track to doubling this year.”


The three women had met at the annual sales conference, a huge event that took over the Fort Mason Center for a long weekend. Most of the event was segregated by sales group, but there were plenary sessions, mixers, and keynote addresses from leading sales staff that helped diffuse the winningest tactics across the whole business.

“We think they met in a women’s interfaith prayer circle,” Rabbi Finkel said. Father Marek made another of his disgusted grunts, which were his principal contributions to the conversation. Rabbi Finkel inclined his head a little in the priest’s direction and said, “Not everyone agreed that they were a good idea at first, but the girls loved them, and they created bonds of comity that served them well.”

“We don’t have a lot of turnover,” Rabbi Finkel said. “People like working here. They do well, and they do good. People from our faith communities sometimes feel like the future is passing them by, like their religion is an anchor around their necks, keeping them stuck in the past. A job here is a way to be faithful and modern, without sacrificing your faith.”

The bishop nodded. “When they turned in their resignation notices, of course we took notice. As Rabbi Finkel says, we just don’t get a lot of turnover. And of course, these three girls were special to us. So we took notice. I met with Elizabeth myself and asked her if there was anything wrong, and she refused to discuss it. I asked her what she did want to discuss and she went off on these wild tangents, not making any sense. I wrote a letter to her father, but I never heard back.”

“Rivka is a good girl,” the rabbi said. “She told me that she still loved God and wanted to live a pious, modest life, but that she had ‘differences’ with the teachings. I asked her about these ‘differences,’ but that was all she could say: ‘differences, differences.’ What’s a difference? She wants to uncover her hair? Eat a cheeseburger? Pray with men? She wouldn’t say.”

Father Marek cleared his throat, made a face, glared. “When Sister Maria-Eva ignored my memo asking her to come see me, I called her Mother Superior and that’s when I discovered that she’d left the order. Left the order! Of course, I assumed there was a man involved, but that wasn’t it, not according to her Mother Superior. She had taken new orders with a . . . fringe sect. It seemed she was lost to us.”


Hey look at this (permalink)



A Wayback Machine banner.

This day in history (permalink)

#1yrago Kickstarting "The Bezzle" audiobook, sequel to Red Team Blues https://pluralistic.net/2024/01/10/the-bezzle/#marty-hench

#5yrsago The Monsters Know What They’re Doing: an RPG sourcebook for DMs who want to imbue monsters with deep, smart tactics https://memex.craphound.com/2020/01/10/the-monsters-know-what-theyre-doing-an-rpg-sourcebook-for-dms-who-want-to-imbue-monsters-with-deep-smart-tactics/

#5yrsago For the first time, you can search the database of money that publicly funded researchers in Illinois received from pharma companies https://www.propublica.org/article/dollars-for-profs-illinois-professors-conflicts-of-interest

#5yrsago A company that makes spy-tech for cops threatened to sue Vice for publishing its sales literature (because Iran!) https://www.vice.com/en/article/this-secretive-surveillance-company-is-selling-cops-cameras-hidden-in-gravestones/

#5yrsago Virgin’s subsidized smartphones come with unremovable Chinese malware https://www.zdnet.com/article/unremovable-malware-found-preinstalled-on-low-end-smartphone-sold-in-the-us/

#5yrsago Pranksters produce enlistment ads featuring Trump Jr: “I’m not enlisting but YOU should” https://www.huffpost.com/entry/donald-trump-jr-army-enlisting-sign-pranksters_n_5e1874f1c5b650c621dd0041

#5yrsago Howto: file your taxes for free without getting defrauded into paying a big tax-prep firm https://www.propublica.org/article/how-to-file-state-federal-taxes-free-2020#175169

#5yrsago Boris the Babybot: a picture book about resisting surveillance https://memex.craphound.com/2020/01/10/boris-the-babybot-a-picture-book-about-resisting-surveillance/

#5yrsago NYPD ordered to disclose records of secret X-ray vans https://www.propublica.org/article/judge-orders-nypd-to-release-records-on-x-ray-vans

#15yrsago If HP Lovecraft wrote C manuals http://www.bobhobbs.com/files/kr_lovecraft.html

#15yrsago Britain’s Digital Economy Bill will cost ISPs £500M, knock 40K poor households offline https://torrentfreak.com/piracy-surcharge-set-to-force-40000-households-offline-091228/

#15yrsago Bugs in the Arroyo: sf podcast about metal-eating bug apocalypse https://reactormag.com/bugs-in-the-arroyo/

#15yrsago Slovak aviation cops sneak explosives into travellers’ luggage, jailarity ensues http://news.bbc.co.uk/2/hi/europe/8441891.stm

#15yrsago Orson Welles on privacy, prescient remarks from 1955 https://web.archive.org/web/20100114060742/http://www.thejanuarist.com/orson-welles-on-privacy-the-passport-and-personal-rights/

#20yrsago Desperate Ken Lay paying search-engines to return links to his “version” of Enron https://web.archive.org/web/20050108125640/https://www.chron.com/cs/CDA/ssistory.mpl/business/2982765/

#20yrsago EFF defends bloggers’ rights to keep informants’ identities secret https://web.archive.org/web/20050105112953/http://www.eff.org/news/archives/2005_01.php#002190


Upcoming appearances (permalink)

A photo of me onstage, giving a speech, holding a mic.



A screenshot of me at my desk, doing a livecast.

Recent appearances (permalink)



A grid of my books with Will Stahle covers..

Latest books (permalink)



A cardboard book box with the Macmillan logo.

Upcoming books (permalink)

  • Picks and Shovels: a sequel to "Red Team Blues," about the heroic era of the PC, Tor Books, February 2025

  • Enshittification: Why Everything Suddenly Got Worse and What to Do About It, Farrar, Straus, Giroux, October 2025

  • Unauthorized Bread: a middle-grades graphic novel adapted from my novella about refugees, toasters and DRM, FirstSecond, 2025



Colophon (permalink)

Today's top sources:

Currently writing:

  • Enshittification: a nonfiction book about platform decay for Farrar, Straus, Giroux. Status: second pass edit underway (readaloud)

  • A Little Brother short story about DIY insulin PLANNING

  • Picks and Shovels, a Martin Hench noir thriller about the heroic era of the PC. FORTHCOMING TOR BOOKS FEB 2025

Latest podcast: Picks and Shovels Chapter One https://craphound.com/overclocked/2025/01/10/picks-and-shovels-chapter-one/


This work – excluding any serialized fiction – is licensed under a Creative Commons Attribution 4.0 license. That means you can use it any way you like, including commercially, provided that you attribute it to me, Cory Doctorow, and include a link to pluralistic.net.

https://creativecommons.org/licenses/by/4.0/

Quotations and images are not included in this license; they are included either under a limitation or exception to copyright, or on the basis of a separate license. Please exercise caution.


How to get Pluralistic:

Blog (no ads, tracking, or data-collection):

Pluralistic.net

Newsletter (no ads, tracking, or data-collection):

https://pluralistic.net/plura-list

Mastodon (no ads, tracking, or data-collection):

https://mamot.fr/@pluralistic

Medium (no ads, paywalled):

https://doctorow.medium.com/

Twitter (mass-scale, unrestricted, third-party surveillance and advertising):

https://twitter.com/doctorow

Tumblr (mass-scale, unrestricted, third-party surveillance and advertising):

https://mostlysignssomeportents.tumblr.com/tagged/pluralistic

"When life gives you SARS, you make sarsaparilla" -Joey "Accordion Guy" DeVilla

2025-01-10T22:31:08+00:00 Fullscreen Open in Tab
Published on Citation Needed: "Issue 73 – Degen volunteer fire brigade"
2025-01-10T19:29:27+00:00 Fullscreen Open in Tab
Note published on January 10, 2025 at 7:29 PM UTC

update: the library director was in today and showed me his secret space opera hoard. new additions to the list:

  • August Kitko and the Mechas from Space, Alex White
  • You Sexy Thing, Cat Rambo

(haven’t read either yet, but he highly recommends)

he also had two of the books i’d been wanting to include in the display!

  • The Long Way to a Small, Angry Planet, Becky Chambers
  • Ninefox Gambit, Yoon Ha Lee
Two paperback books on a carpet: Cat Rambo’s You Sexy Thing and Alex White’s August Kitko and the Mechas from Space

(original post)

2025-01-10T01:01:45+00:00 Fullscreen Open in Tab
Note published on January 10, 2025 at 1:01 AM UTC
Thu, 09 Jan 2025 18:56:10 +0000 Fullscreen Open in Tab
Pluralistic: Chapter One of "Picks and Shovels" (Part 1) (09 Jan 2025)


Today's links



A remix of the cover of the Tor Books edition of 'Picks and Shovels,' depicting a vector art vintage PC, whose blue screen includes a male figure stepping out of the picture to the right. Superimposed on the art is the book's title in a custom, modernist font.

Chapter One of "Picks and Shovels" (Part 1) (permalink)

My next novel is Picks and Shovels, out next month. It's tells the origin story of Martin Hench, my hard-charging, scambusting, high-tech forensic accountant, in a 1980s battle over the soul of a PC company:

https://us.macmillan.com/books/9781250865908/picksandshovels

I'm currently running a Kickstarter to pre-sell the book in every format: hardcover, DRM-free ebook, and an independently produced, fabulous DRM-free audiobook read by Wil Wheaton, who just nailed the delivery:

https://www.kickstarter.com/projects/doctorow/picks-and-shovels-marty-hench-at-the-dawn-of-enshittification

Picks and Shovels opens with a long prologue that recounts Marty's misadventures as a failing computer science student at MIT, his love-affair with computers, and his first disastrous startup venture. It ends with him decamping to Silicon Valley with his roommate Art, a brilliant programmer, to seek their fortune.

Chapter one opens with Marty's first job, working for a weird PC company (there were so many weird PC companies back then!). I've posted Wil's audio reading of chapter one as a teaser for the Kickstarter:

https://www.youtube.com/watch?v=IGXz1mkAd2Q

(Here it is as an MP3 at the Internet Archive:)

https://ia600607.us.archive.org/5/items/picks-and-shovels-promo/audio.mp3

The audio is great, but I thought I'd also serialize the text of Chapter One here, in five or six chunks. If you enjoy this and want to pre-order the book, please consider backing the Kickstarter:

https://www.kickstarter.com/projects/doctorow/picks-and-shovels-marty-hench-at-the-dawn-of-enshittification

Chapter One

Fidelity Computing was the most colorful PC company in Silicon Valley.

A Catholic priest, a Mormon bishop, and an Orthodox rabbi walk into a technology gold rush and start a computer company. The fact that it sounded like the setup for a nerdy joke about the mid-1980s was fantastic for their bottom line. Everyone who heard their story loved it.

As juicy as the story of Fidelity Computing was, they flew under most people’s radar for years, even as they built a wildly profitable technology empire through direct sales through faith groups. The first time most of us heard of them was in 1983, when Byte ran its cover story on Fidelity Computing, unearthing a parallel universe of technology that had grown up while no one was looking.

At first, I thought maybe they were doing something similar to Apple’s new Macintosh: like Apple, they made PCs (the Wise PC), an operating system (Wise DOS), and a whole line of monitors, disk drives, printers, and software.

Like the Mac, none of these things worked with anything else—you needed to buy everything from floppy disks to printer cables specially from them, because nothing anyone else made would work with their system.

And like the Mac, they sold mostly through word of mouth. The big difference was that Mac users were proud to call themselves a cult, while Fidelity Computing’s customers were literally a religion.

Long after Fidelity had been called to the Great Beyond, its most loyal customers gave it an afterlife, nursing their computers along, until the parts and supplies ran out. They’d have kept going even then, if there’d been any way to unlock their machines and use the same stuff the rest of the computing world relied on. But that wasn’t something Fidelity Computing would permit, even from beyond the grave.


I was summoned to Fidelity headquarters—in unfashionable Colma, far from the white-hot start-ups of Palo Alto, Mountain View, and, of course, Cupertino—by a friend of Art’s. Art had a lot more friends than me. I was a skipping stone, working as the part-time bookkeeper/accountant/CFO for half a dozen companies and never spending more than one or two days in the same office.

Art was hardly more stable than me—he switched start-ups all the time, working for as little as two months (and never for more than a year) before moving on. His bosses knew what they were getting: you hired Art Hellman to blaze into your company, take stock of your product plan, root out and correct all of its weak points, build core code libraries, and then move on. He was good enough and sufficiently in demand to command the right to behave this way, and he wouldn’t have it any other way. My view was, it was an extended celebration of his liberation from the legal villainy of Nick Cassidy III: having narrowly escaped a cage, he was determined never to be locked up again.

Art’s “engagements”—as he called them—earned him the respect and camaraderie of half the programmers and hardware engineers in the Valley. This, in spite of the fact that he was a public and ardent member of the Lavender Panthers, wore the badge on his lapel, went to the marches, and brought his boyfriend to all the places where his straight colleagues brought their girlfriends.

He’d come out to me less than a week after I arrived by the simple expedient of introducing the guy he was watching TV with in our living room as Lewis, his boyfriend. Lewis was a Chinese guy about our age, and his wardrobe—plain white tee, tight blue jeans, loafers—matched the new look Art had adopted since leaving Boston. Lewis had a neat, short haircut that matched Art’s new haircut, too.

To call the Art I’d known in Cambridge a slob would be an insult to the natty, fashion-conscious modern slob. He’d favored old band T-shirts with fraying armpit seams, too-big jeans that were either always sliding off his skinny hips or pulled up halfway to his nipples. In the summer, his sneakers had holes in the toes. In the winter, his boots were road-salt-crusted crystalline eruptions. His red curls were too chaotic for a white-boy ’fro and were more of a heap, and he often went days without shaving.

There were members of the Newbury Street Irregulars who were bigger slobs than Art, but they smelled. Art washed, but otherwise, he looked like a homeless person (or a hacker). His transformation to a neatly dressed, clean-shaven fellow with a twenty-five-dollar haircut that he actually used some sort of hairspray on was remarkable. I’d assumed it was about his new life as a grown-up living far from home and doing a real job. It turned out that wasn’t the reason at all.

“Oh,” I said. “That makes a lot of sense.” I shook Lewis’s hand. He laughed. I checked Art. He was playing it cool, but I could tell he was nervous. I remembered Lucille and how she listened, and what it felt like to be heard. I thought about Art, and the things he’d never been able to tell me.

There’d been a woman in the Irregulars who there were rumors about, and there were a pair of guys one floor down in Art’s building who held hands in the elevator, but as far as I knew up until that moment, I hadn’t really ever been introduced to a homosexual person. I didn’t know how I felt about it, but I did know how I wanted to feel about it.


So Art didn’t just get to know all kinds of geeks from his whistle-stop tour of Silicon Valley’s hottest new tech ventures. He was also plugged into this other network of people from the Lavender Panthers, and their boyfriends and girlfriends, and the people he knew from bars and clubs. He and Lewis lasted for a couple of months, and then there were a string of weekends where there was a new guy at the breakfast table, and then he settled down again for a while with Artemis, and then he hit a long dry spell.

I commiserated. I’d been having a dry spell for nearly the whole two years I’d been in California. The closest I came to romance was exchanging a letter with Lucille every couple of weeks—she was a fine pen pal, but that wasn’t really a substitute for a living, breathing woman in my life.

Art threw himself into his volunteer work, and he was only half joking when he said he did it to meet a better class of boys than you got at a club. Sometimes, there’d be a committee meeting in our living room and I’d hear about the congressional committee hearing on the “gay plague” and the new wave of especially vicious attacks. It was pretty much the only time I heard about that stuff—no one I worked with ever brought it up, unless it was to make a terrible joke.

It was Murf, one of the guys from those meetings, who told me that Fidelity Computing was looking for an accountant for a special project. He had stayed after the meeting and he and Art made a pot of coffee and sat down in front of Art’s Apple clone, a Franklin Ace 1200 that he’d scored six months ahead of its official release. After opening the lid to show Murf the interior, Art fired it up and put it through its paces.

I hovered over his shoulder, watching. I’d had a couple of chances to play with the 1200, and I wanted one more than anything in the world except for a girlfriend.

“Marty,” Art said, “Murf was telling me about a job I thought you might be good for.”

The Ace 1200 would have a list price of $2,200. I pulled up a chair.


Fidelity Computing’s business offices were attached to their warehouse, right next to their factory. It took up half of a business park in Colma, and I had to circle it twice to find a parking spot. I was five minutes late and flustered when I presented myself to the receptionist, a blond woman with a ten – years – out – of – date haircut and a modest cardigan over a sensible white shirt buttoned to the collar, ring on her finger.

“Hello,” I said. “I’m Marty Hench. I—uh—I’ve got a meeting with the Reverend Sirs.” That was what the executive assistant I’d spoken to on the phone had called them. It sounded weird when he said it. It sounded weirder when I said it.

The receptionist gave me a smile that only went as far as her lips. “Please have a seat,” she said. There were only three chairs in the little reception area, vinyl office chairs with worn wooden armrests. There weren’t any magazines, just glossy catalogs featuring the latest Fidelity Computing systems, accessories, consumables, and software. I browsed one, marveling at the parallel universe of computers in the strange, mauve color that denoted all Fidelity equipment, including the boxes, packaging, and, now that I was attuned to it, the accents and carpet in the small lobby. A side door opened and a young, efficient man in a kippah and wire-rim glasses called for me: “Mr. Hench?” I closed the catalog and returned it to the pile and stood. As I went to shake his hand, I realized that something had been nagging me about the catalog—there were no prices.

“I’m Shlomo,” the man said. “We spoke on the phone. Thank you for coming down. The Reverend Sirs are ready to see you now.”

He wore plain black slacks, hard black shiny shoes, and a white shirt with prayer-shawl tassels poking out of its tails. I followed him through a vast room filled with chest-high Steelcase cubicles finished in yellowing, chipped wood veneer, every scratch pitilessly lit by harsh overhead fluorescents. Most of the workers at the cubicles were women with headsets, speaking in hushed tones. The tops of their heads marked the interfaith delineators: a block of Orthodox headscarves, then a block of nuns’ black and white scarves (I learned to call them “veils” later), then the Mormons’ carefully coiffed, mostly blond dos.

“This way,” Shlomo said, passing through another door and into executive row. The mauve carpets were newer, the nap all swept in one direction. The walls were lined with framed certificates of appreciation, letters from religious and public officials (apparently, the church and state were not separate within the walls of Fidelity Computing), photos of groups of progressively larger groups of people ranked before progressively larger offices—the company history.

We walked all the way to the end of the hall, past closed doors with nameplates, to a corner conference room with a glass wall down one side, showing a partial view of a truck-loading dock behind half-closed vertical blinds. Seated at intervals around a large conference table were the Reverend Sirs themselves, each with his own yellow pad, pencil, and coffee cup.

Shlomo announced me: “Reverend Sirs, this is Marty Hench. Mr. Hench, these are Rabbi Yisrael Finkel, Bishop Leonard Clarke, and Father Marek Tarnowski.” He backed out of the door, leaving me standing, unsure if I should circle the table shaking hands, or take a seat, or—

“Please, sit,” Rabbi Finkel said. He was fiftyish, round-faced and bear-shaped with graying sidelocks and beard and a black suit and tie. His eyes were sharp behind horn-rimmed glasses. He gestured to a chair at the foot of the table.

I sat, then rose a little to undo the button of my sport coat. I hadn’t worn it since my second job interview, when I realized it was making the interviewers uncomfortable. It certainly made me uncomfortable. I fished out the little steno pad and stick pen I’d brought with me.

“Thank you for coming, Mr. Hench.” The rabbi had an orator’s voice, that big chest of his serving as a resonating chamber like a double bass.

“Of course,” I said. “Thanks for inviting me. It’s a fascinating company you have here.”

Bishop Clarke smiled at that. He was the best dressed of the three, in a well-cut business suit, his hair short, neat, side-parted. His smile was very white, and very wide. He was the youngest of the three—in his late thirties, I’d guess. “Thank you,” he said. “We know we’re very different from the other computer companies, and we like it that way. We like to think that we see something in computers—a potential—that other people have missed.”

Father Tarnowski scowled. He was cadaverously tall and thin, with the usual dog collar and jacket, and a heavy gold class ring. His half-rim glasses flashed. He was the oldest, maybe sixty, and had a sour look that I took for habitual. “He doesn’t want the press packet, Leonard,” he said. “Let’s get to the point.” He had a broad Chicago accent like a tough-guy gangster in The Untouchables.

Bishop Clarke’s smile blinked off and on for an instant and I was overcome with the sudden knowledge that these two men did not like each other at all, and that there was some kind of long-running argument simmering beneath the surface. “Thank you, Marek, of course. Mr. Hench’s time is valuable.” Father Tarnowski snorted softly at that and the bishop pretended he didn’t hear it, but I saw Rabbi Finkel grimace at his yellow pad.

“What can I help you Reverend Sirs with today?” Reverend Sirs came more easily now, didn’t feel ridiculous at all. The three of them gave the impression of being a quarter inch away from going for each other’s throats, and the formality was a way to keep tensions at a distance.

“We need a certain kind of accountant,” the rabbi said. He’d dated the top of his yellow pad and then circled the date. “A kind of accountant who understands the computer business. Who understands computers, on a technical level. It’s hard to find an accountant like that, believe it or not, even in Silicon Valley.” I didn’t point out that Colma wasn’t in Silicon Valley.

“Well,” I said, carefully. “I think I fit that bill. I’ve only got an associate’s degree in accounting, but I’m a kind of floating CFO for half a dozen companies and I’ve been doing night classes at UCSF Extension to get my bachelor’s. I did a year at MIT and built my own computer a few years back. I program pretty well in BASIC and Pascal and I’ve got a little C, and I’m a pretty darned good debugger, if I do say so myself.”

Bishop Clarke gave a small but audible sigh of relief. “You do indeed sound perfect, and I’m told that Shlomo spoke to your references and they were very enthusiastic about your diligence and . . . discretion.”

I’d given Shlomo a list of four clients I’d done extensive work with, but I hadn’t had “discretion” in mind when I selected them. It’s true that doing a company’s accounts made me privy to some sensitive information—like when two employees with the same job were getting paid very different salaries—but I got the feeling that wasn’t the kind of “discretion” the bishop had in mind.

“I’m pretty good at minding my own business,” I said, and then, “even when I’m being paid to mind someone else’s.” I liked that line, and made a mental note about it. Maybe someday I’d put it on my letterhead. Martin Hench: Confidential CPA.

The bishop favored me with a chuckle. The rabbi nodded thoughtfully. The priest scowled.

“That’s very good,” the bishop said. “What we’d like to discuss today is of a very sensitive nature, and I’m sure you’ll understand if we would like more than your good word to rely on.” He lifted his yellow pad, revealing a single page, grainily photocopied, and slid it over the table to me. “That’s our standard nondisclosure agreement,” he said. He slid a pen along to go with it.

I didn’t say anything. I’d signed a few NDAs, but only after I’d taken a contract. This was something different. I squinted at the page, which was a second- or third-generation copy and blurry in places. I started to read it. The bishop made a disgusted noise. I pretended I didn’t hear him.

I crossed out a few clauses and carefully lettered in an amendment. I initialed the changes and slid the paper back across the table to the bishop, and found the smile was gone from his face. All three of them were now giving me stern looks, wrath-of-God looks, the kind of looks that would make a twenty-one-year-old kid like me very nervous indeed. I felt the nerves rise and firmly pushed them down.

“Mr. Hench,” the bishop said, his tone low and serious, “is there some kind of problem?”

It pissed me off. I’d driven all the way to for-chrissakes Colma and these three weirdo God-botherers had ambushed me with their everything – and – the – kitchen – sink contract. I had plenty of work, and I didn’t need theirs, especially not if this was the way they wanted to deal. This had suddenly become a negotiation, and my old man had always told me the best negotiating position was a willingness to get up from the table. I was going to win this negotiation, one way or another.

“No problem,” I said.

“And yet you appear to have made alterations to our standard agreement.”

“I did,” I said. That’s not a problem for me, I didn’t say.

He gave me more of that stern eyeball-ray stuff. I let my negotiating leverage repel it. “Mr. Hench, our standard agreement can only be altered after review by our general counsel.”

“That sounds like a prudent policy,” I said, and met his stare.

He clucked his tongue. “I can get a fresh one,” he said. “This one is no good.”

I cocked my head. “I think it’d be better to get your general counsel, wouldn’t it?”

The three of them glared at me. I found I was enjoying myself. What’s more, I thought Rabbi Finkel might be suppressing a little smile, though the beard made it hard to tell.

“Let me see it,” he said, holding his hand out.

Bishop Clarke gave a minute shake of his head. The rabbi half rose, reached across the table, and slid it over to himself, holding it at arm’s length and adjusting his glasses. He picked up his pen and initialed next to my changes.

“Those should be fine,” he said, and slid it back to me. “Sign, please.”

“Yisrael,” Bishop Clarke said, an edge in his voice, “changes to the standard agreements need to be reviewed—”

“By our general counsel,” the rabbi finished, waving a dismissive gesture at him. “I know, I know. But these are fine. We should probably make the same changes to all our agreements. Meanwhile, we’ve all now had a demonstration that Mr. Hench is the kind of person who takes his promises seriously. Would you rather have someone who doesn’t read and signs his life away, or someone who makes sure he knows what he’s signing and agrees with it?”

Bishop Clarke’s smile came back, strained at the corners. “That’s an excellent point, Rabbi. Thank you for helping me understand your reasoning.” He collected the now-signed contract from me and tucked it back under his yellow pad.

“Now,” he said, “we can get down to the reason we asked you here today.”


Hey look at this (permalink)



A Wayback Machine banner.

This day in history (permalink)

#20yrsago New US Attorney General versus a baked potato https://fafblog.blogspot.com/2005_01_09_fafblog_archive.html#110532348636328727

#20yrsago Companies that have fired people for blogging https://web.archive.org/web/20060427154821/http://rights.journalspace.com/?b=1104566400&e=1105171200

#10yrsago MP wants to ban email disclaimers https://www.bbc.com/news/uk-politics-30710481

#10yrsago Apple won’t let EFF release a DRM-free app https://www.eff.org/deeplinks/2014/12/download-eff-mobile-app

#10yrsago Universal wants to take away prisoners’ mixtapes https://www.bbc.com/news/technology-30724173

#10yrsago Russia bans trans people from driving https://www.bbc.com/news/world-europe-30735673

#5yrsago More than 800 Russian academic articles retracted after “bombshell” report reveals plagiarism and other misconduct https://www.science.org/content/article/russian-journals-retract-more-800-papers-after-bombshell-investigation

#5yrsago The Communications Workers of America is seeking to unionize tech and video game workers https://www.latimes.com/business/technology/story/2020-01-07/major-union-launches-campaign-to-organize-video-game-and-tech-workers

#5yrsago Multiple Amazon employees have been fired for spying on Ring owners’ cameras https://www.vice.com/en/article/ring-fired-employees-abusing-video-data/

#5yrsago How to read long, difficult books https://www.bradford-delong.com/2019/12/a-note-on-reading-big-difficult-books.html

#5yrsago A beautiful timeline of a future in which the climate crisis is met and overcome https://thecorrespondent.com/214/in-2030-we-ended-the-climate-emergency-heres-how/28330740746-6b15af77

#5yrsago RIP, Mike Resnick https://www.gofundme.com/f/help-mike-resnick-pay-off-a-neardeath-experience

#1yrago Kelly and Zach Weinersmith's "A City On Mars" https://pluralistic.net/2024/01/09/astrobezzle/#send-robots-instead


Upcoming appearances (permalink)

A photo of me onstage, giving a speech, holding a mic.



A screenshot of me at my desk, doing a livecast.

Recent appearances (permalink)



A grid of my books with Will Stahle covers..

Latest books (permalink)



A cardboard book box with the Macmillan logo.

Upcoming books (permalink)

  • Picks and Shovels: a sequel to "Red Team Blues," about the heroic era of the PC, Tor Books, February 2025

  • Enshittification: Why Everything Suddenly Got Worse and What to Do About It, Farrar, Straus, Giroux, October 2025

  • Unauthorized Bread: a middle-grades graphic novel adapted from my novella about refugees, toasters and DRM, FirstSecond, 2025



Colophon (permalink)

Today's top sources:

Currently writing:

  • Enshittification: a nonfiction book about platform decay for Farrar, Straus, Giroux. Status: second pass edit underway (readaloud)

  • A Little Brother short story about DIY insulin PLANNING

  • Picks and Shovels, a Martin Hench noir thriller about the heroic era of the PC. FORTHCOMING TOR BOOKS FEB 2025

Latest podcast: Daddy-Daughter Podcast 2024 https://craphound.com/overclocked/2024/12/17/daddy-daughter-podcast-2024/


This work – excluding any serialized fiction – is licensed under a Creative Commons Attribution 4.0 license. That means you can use it any way you like, including commercially, provided that you attribute it to me, Cory Doctorow, and include a link to pluralistic.net.

https://creativecommons.org/licenses/by/4.0/

Quotations and images are not included in this license; they are included either under a limitation or exception to copyright, or on the basis of a separate license. Please exercise caution.


How to get Pluralistic:

Blog (no ads, tracking, or data-collection):

Pluralistic.net

Newsletter (no ads, tracking, or data-collection):

https://pluralistic.net/plura-list

Mastodon (no ads, tracking, or data-collection):

https://mamot.fr/@pluralistic

Medium (no ads, paywalled):

https://doctorow.medium.com/

Twitter (mass-scale, unrestricted, third-party surveillance and advertising):

https://twitter.com/doctorow

Tumblr (mass-scale, unrestricted, third-party surveillance and advertising):

https://mostlysignssomeportents.tumblr.com/tagged/pluralistic

"When life gives you SARS, you make sarsaparilla" -Joey "Accordion Guy" DeVilla

2025-01-08T22:08:31+00:00 Fullscreen Open in Tab
Note published on January 8, 2025 at 10:08 PM UTC
2025-01-08T21:17:14+00:00 Fullscreen Open in Tab
Read "The Great Crypto Crash"
2025-01-08T21:04:05+00:00 Fullscreen Open in Tab
Read "The Good, The Bad, And The Stupid In Meta's New Content Moderation Policies"
Read:
Finally, most of the attention people have given to the announcement has focused on the plan to end the fact-checking program, with a lot of people freaking out about it. I even had someone tell me on Bluesky that Meta ending its fact-checking program was an “existential threat” to truth. And that’s nonsense. The reality is that fact-checking has always been a weak and ineffective band-aid to larger issues. We called this out in the wake of the 2016 election. .... So, if a lot of the functional policy changes here are actually more reasonable, what’s so bad about this? Well, first off, the framing of it all. Zuckerberg is trying to get away with the Elon Musk playbook of pretending this is all about free speech.
Illustration of Molly White sitting and typing on a laptop, on a purple background with 'Molly White' in white serif.
Illustration of Molly White sitting and typing on a laptop, on a purple background with 'Molly White' in white serif.
Wed, 08 Jan 2025 14:51:51 +0000 Fullscreen Open in Tab
Pluralistic: The Brave Little Toaster (08 Jan 2025)


Today's links



A deluxe mid-century fridge, its double-doors swung wide to reveal many groceries. Before it stands a demon, suspending a screaming man by the hair from one taloned hand. One of the fridge's panels has been replaced with the hostile red eye of HAL 9000 from Kubrick's '2001: A Space Odyssey.' In the background is a 'code waterfall' effect as seen in the credit sequences of the Wachowskis' 'Matrix' movies.

The Brave Little Toaster (permalink)

The AI bubble is the new crypto bubble: you can tell because the same people are behind it, and they're doing the same thing with AI as they did with crypto – trying desperately to find a use case to cram it into, despite the yawning indifference and outright hostility of the users:

https://pluralistic.net/2023/03/09/autocomplete-worshippers/#the-real-ai-was-the-corporations-that-we-fought-along-the-way

This week on the excellent Trashfuture podcast, the regulars – joined by 404 Media's Jason Koebler – have a hilarious – as in, I was wheezing with laughter! – riff on this year's CES, where companies are demoing home appliances with LLMs built in:

https://www.podbean.com/media/share/pb-hgi6c-179b908

Why would you need a chatbot in your dishwasher? As it turns out, there's a credulous, Poe's-law-grade Forbes article that lays out the (incredibly stupid) case for this (incredibly stupid) idea:

https://www.forbes.com/sites/bernardmarr/2024/03/29/generative-ai-is-coming-to-your-home-appliances/

As the Trashfuturians mapped out this new apex of the AI hype cycle, I found myself thinking of a short story I wrote 15 years ago, satirizing the "Internet of Things" hype we were mired in. It's called "The Brave Little Toaster", and it was published in MIT Tech Review's TRSF anthology in 2011:

http://bestsf.net/trsf-the-best-new-science-fiction-technology-review-2011/

The story was meant to poke fun at the preposterous IoT hype of the day, and I recall thinking that creating a world of talking appliance was the height of Philip K Dickist absurdism. Little did I dream that a decade and a half later, the story would be even more relevant, thanks to AI pump-and-dumpers who sweatily jammed chatbots into kitchen appliances.

So I figured I'd republish The Brave Little Toaster; it's been reprinted here and there since (there's a high school English textbook that included it, along with a bunch of pretty fun exercises for students), and I podcasted it back in the day:

https://ia803103.us.archive.org/35/items/Cory_Doctorow_Podcast_212/Cory_Doctorow_Podcast_212_Brave_Little_Toaster.mp3

A word about the title of this story. It should sound familiar – I nicked it from a brilliant story by Tom Disch that was made into a very weird cartoon:

https://www.youtube.com/watch?v=I8C_JaT8Lvg

My story is one of several I wrote by stealing the titles of other stories and riffing on them; they were very successful, winning several awards, getting widely translated and reprinted, and so on:

https://locusmag.com/2012/05/cory-doctorow-a-prose-by-any-other-name/

All right, on to the story!

#

One day, Mister Toussaint came home to find an extra 300 euros' worth of groceries on his doorstep. So he called up Miz Rousseau, the grocer, and said, "Why have you sent me all this food? My fridge is already full of delicious things. I don't need this stuff and besides, I can't pay for it."

But Miz Rousseau told him that he had ordered the food. His refrigerator had sent in the list, and she had the signed order to prove it.

Furious, Mister Toussaint confronted his refrigerator. It was mysteriously empty, even though it had been full that morning. Or rather, it was almost empty: there was a single pouch of energy drink sitting on a shelf in the back. He'd gotten it from an enthusiastically smiling young woman on the metro platform the day before. She'd been giving them to everyone.

"Why did you throw away all my food?" he demanded. The refrigerator hummed smugly at him.

"It was spoiled," it said.

#

But the food hadn't been spoiled. Mister Toussaint pored over his refrigerator's diagnostics and logfiles, and soon enough, he had the answer. It was the energy beverage, of course.

"Row, row, row your boat," it sang. "Gently down the stream. Merrily, merrily, merrily, merrily, I'm offgassing ethelyne." Mister Toussaint sniffed the pouch suspiciously.

"No you're not," he said. The label said that the drink was called LOONY GOONY and it promised ONE TRILLION TIMES MORE POWERFUL THAN ESPRESSO!!!!!ONE11! Mister Toussaint began to suspect that the pouch was some kind of stupid Internet of Things prank. He hated those.

He chucked the pouch in the rubbish can and put his new groceries away.

#

The next day, Mister Toussaint came home and discovered that the overflowing rubbish was still sitting in its little bag under the sink. The can had not cycled it through the trapdoor to the chute that ran to the big collection-point at ground level, 104 storeys below.

"Why haven't you emptied yourself?" he demanded. The trashcan told him that toxic substances had to be manually sorted. "What toxic substances?"

So he took out everything in the bin, one piece at a time. You've probably guessed what the trouble was.

"Excuse me if I'm chattery, I do not mean to nattery, but I'm a mercury battery!" LOONY GOONY's singing voice really got on Mister Toussaint's nerves.

"No you're not," Mister Toussaint said.

#

Mister Toussaint tried the microwave. Even the cleverest squeezy-pouch couldn't survive a good nuking. But the microwave wouldn't switch on. "I'm no drink and I'm no meal," LOONY GOONY sang. "I'm a ferrous lump of steel!"

The dishwasher wouldn't wash it ("I don't mean to annoy or chafe, but I'm simply not dishwasher safe!"). The toilet wouldn't flush it ("I don't belong in the bog, because down there I'm sure to clog!"). The windows wouldn't retract their safety screen to let it drop, but that wasn't much of a surprise.

"I hate you," Mister Toussaint said to LOONY GOONY, and he stuck it in his coat pocket. He'd throw it out in a trash-can on the way to work.

#

They arrested Mister Toussaint at the 678th Street station. They were waiting for him on the platform, and they cuffed him just as soon as he stepped off the train. The entire station had been evacuated and the police wore full biohazard containment gear. They'd even shrinkwrapped their machine-guns.

"You'd better wear a breather and you'd better wear a hat, I'm a vial of terrible deadly hazmat," LOONY GOONY sang.

When they released Mister Toussaint the next day, they made him take LOONY GOONY home with him. There were lots more people with LOONY GOONYs to process.

#

Mister Toussaint paid the rush-rush fee that the storage depot charged to send over his container. They forklifted it out of the giant warehouse under the desert and zipped it straight to the cargo-bay in Mister Toussaint's building. He put on old, stupid clothes and clipped some lights to his glasses and started sorting.

Most of the things in container were stupid. He'd been throwing away stupid stuff all his life, because the smart stuff was just so much easier. But then his grandpa had died and they'd cleaned out his little room at the pensioner's ward and he'd just shoved it all in the container and sent it out the desert.

From time to time, he'd thought of the eight cubic meters of stupidity he'd inherited and sighed a put-upon sigh. He'd loved Grandpa, but he wished the old man had used some of the ample spare time from the tail end of his life to replace his junk with stuff that could more gracefully reintegrate with the materials stream.

How inconsiderate!

#

The house chattered enthusiastically at the toaster when he plugged it in, but the toaster said nothing back. It couldn't. It was stupid. Its bread-slots were crusted over with carbon residue and it dribbled crumbs from the ill-fitting tray beneath it. It had been designed and built by cavemen who hadn't ever considered the advantages of networked environments.

It was stupid, but it was brave. It would do anything Mister Toussaint asked it to do.

"It's getting hot and sticky and I'm not playing any games, you'd better get me out before I burst into flames!" LOONY GOONY sang loudly, but the toaster ignored it.

"I don't mean to endanger your abode, but if you don't let me out, I'm going to explode!" The smart appliances chattered nervously at one another, but the brave little toaster said nothing as Mister Toussaint depressed its lever again.

"You'd better get out and save your ass, before I start leaking poison gas!" LOONY GOONY's voice was panicky. Mister Toussaint smiled and depressed the lever.

Just as he did, he thought to check in with the flat's diagnostics. Just in time, too! Its quorum-sensors were redlining as it listened in on the appliances' consternation. Mister Toussaint unplugged the fridge and the microwave and the dishwasher.

The cooker and trash-can were hard-wired, but they didn't represent a quorum.

#

The fire department took away the melted toaster and used their axes to knock huge, vindictive holes in Mister Toussaint's walls. "Just looking for embers," they claimed. But he knew that they were pissed off because there was simply no good excuse for sticking a pouch of independently powered computation and sensors and transmitters into an antique toaster and pushing down the lever until oily, toxic smoke filled the whole 104th floor.

Mister Toussaint's neighbors weren't happy about it either.

But Mister Toussaint didn't mind. It had all been worth it, just to hear LOONY GOONY beg and weep for its life as its edges curled up and blackened.

He argued mightily, but the firefighters refused to let him keep the toaster.

#

If you enjoyed that and would like to read more of my fiction, may I suggest that you pre-order my next novel as a print book, ebook or audiobook, via the Kickstarter I launched yesterday?

https://www.kickstarter.com/projects/doctorow/picks-and-shovels-marty-hench-at-the-dawn-of-enshittification?ref=created_projects

(Image: Cryteria, CC BY 3.0, modified)


Hey look at this (permalink)



A Wayback Machine banner.

This day in history (permalink)

#20yrsago Low-tech “Hipster PDA” (cards and a paperclip) hacks https://web.archive.org/web/20050111035632/http://www.43folders.com/2005/01/organizing_your.html

#10yrsago Sharpening the contradictions: why jihadis attack cartoonists https://www.juancole.com/2015/01/sharpening-contradictions-satirists.html

#10yrsago Porn companies carpetbomb Google with sloppy takedowns, remove tons of Github projects https://torrentfreak.com/google-porn-takedowns-carpet-bomb-github-150107/

#10yrsago DHS’s weird, creepy social media search-terms https://www.muckrock.com/news/archives/2015/jan/07/homeland-security-search-logs-include/

#10yrsago Batmanga: Japan’s 1960s parallel universe “New Look” Batman https://memex.craphound.com/2015/01/08/batmanga-japans-1960s-parallel-universe-new-look-batman/

#5yrsago A Public Service: a comprehensive, comprehensible guide to leaking documents to journalists and public service groups without getting caught https://memex.craphound.com/2020/01/08/a-public-service-a-comprehensive-comprehensible-guide-to-leaking-documents-to-journalists-and-public-service-groups-without-getting-caught/

#5yrsago Three years after the W3C approved a DRM standard, it’s no longer possible to make a functional indie browser https://blog.samuelmaddock.com/posts/the-end-of-indie-web-browsers/

#5yrsago Trying to land on some runways causes the Boeing 737’s control screens to go black https://www.theregister.com/2020/01/08/boeing_737_ng_cockpit_screen_blank_bug/

#5yrsago Something Awful’s “Fuck You and Die” forum went from freewheeling jokesters to Nazi shitposters, so it’s dead https://www.vice.com/en/article/something-awfuls-notorious-fuck-you-and-die-forum-shuts-down-because-of-nazis/

#5yrsago Internal docs reveal that Canada’s Exxon subsidiary knew about climate change risks and lied about it for decades https://theintercept.com/2020/01/08/imperial-oil-climate-change-exxon/

#1yrago Molly McGhee's "Jonathan Abernathy You Are Kind" https://pluralistic.net/2024/01/08/capitalist-surrealism/#productivity-hacks


Upcoming appearances (permalink)

A photo of me onstage, giving a speech, holding a mic.



A screenshot of me at my desk, doing a livecast.

Recent appearances (permalink)



A grid of my books with Will Stahle covers..

Latest books (permalink)



A cardboard book box with the Macmillan logo.

Upcoming books (permalink)

  • Picks and Shovels: a sequel to "Red Team Blues," about the heroic era of the PC, Tor Books, February 2025

  • Enshittification: Why Everything Suddenly Got Worse and What to Do About It, Farrar, Straus, Giroux, October 2025

  • Unauthorized Bread: a middle-grades graphic novel adapted from my novella about refugees, toasters and DRM, FirstSecond, 2025



Colophon (permalink)

Today's top sources:

Currently writing:

  • Enshittification: a nonfiction book about platform decay for Farrar, Straus, Giroux. Status: second pass edit underway (readaloud)

  • A Little Brother short story about DIY insulin PLANNING

  • Picks and Shovels, a Martin Hench noir thriller about the heroic era of the PC. FORTHCOMING TOR BOOKS FEB 2025

Latest podcast: Daddy-Daughter Podcast 2024 https://craphound.com/overclocked/2024/12/17/daddy-daughter-podcast-2024/


This work – excluding any serialized fiction – is licensed under a Creative Commons Attribution 4.0 license. That means you can use it any way you like, including commercially, provided that you attribute it to me, Cory Doctorow, and include a link to pluralistic.net.

https://creativecommons.org/licenses/by/4.0/

Quotations and images are not included in this license; they are included either under a limitation or exception to copyright, or on the basis of a separate license. Please exercise caution.


How to get Pluralistic:

Blog (no ads, tracking, or data-collection):

Pluralistic.net

Newsletter (no ads, tracking, or data-collection):

https://pluralistic.net/plura-list

Mastodon (no ads, tracking, or data-collection):

https://mamot.fr/@pluralistic

Medium (no ads, paywalled):

https://doctorow.medium.com/

Twitter (mass-scale, unrestricted, third-party surveillance and advertising):

https://twitter.com/doctorow

Tumblr (mass-scale, unrestricted, third-party surveillance and advertising):

https://mostlysignssomeportents.tumblr.com/tagged/pluralistic

"When life gives you SARS, you make sarsaparilla" -Joey "Accordion Guy" DeVilla

2025-01-07T18:15:41+00:00 Fullscreen Open in Tab
Read "Episode 159 – What Donald Trump's election means for Bitcoin (feat. Joseph Politano)"
2025-01-07T15:00:05+00:00 Fullscreen Open in Tab
Note published on January 7, 2025 at 3:00 PM UTC
Tue, 07 Jan 2025 13:47:58 +0000 Fullscreen Open in Tab
Pluralistic: Kickstarting a new Martin Hench novel about the dawn of enshittification (07 Jan 2025)


The cover of Picks and Shovels, depicting a vintage PC on which a pixelated, sillhouetted male figure is escaping out of the frame.

Today's links



A mockup of a cellphone playing the audiobook of Picks and Shovels. Next to it is a Stephen Fry quote: 'I hugely enjoyed it. The reconstruction of the age is note perfect: the detail, the atmosphere, ethos, flavor and smell of the age is perfectly conveyed.'

Kickstarting a new Martin Hench novel about the dawn of enshittification (permalink)

Picks and Shovels is a new, standalone technothriller starring Marty Hench, my two-fisted, hard-fighting, tech-scam-busting forensic accountant. You can pre-order it on my latest Kickstarter, which features a brilliant audiobook read by Wil Wheaton:

http://martinhench.com

This is the third Hench novel, following on from the nationally bestselling The Bezzle (2024) and Red Team Blues (2023). I wrote Red Team Blues with a funny conceit: what if I wrote the final volume of a beloved, long-running series, without writing the rest of the series? Turns out, the answer is: "Your editor will buy a whole bunch more books in the series!"

My solution to this happy conundrum? Write the Hench books out of chronological order. After all, Marty Hench is a financial hacker who's been in Silicon Valley since the days of the first PCs, so he's been there for all the weird scams tech bros have dreamed up since Jobs and Woz were laboring in their garage over the Apple I. He's the Zelig of high-tech fraud! Look hard at any computing-related scandal and you'll find Marty Hench in the picture, quietly and competently unraveling the scheme, dodging lawsuits and bullets with equal aplomb.

Which brings me to Picks and Shovels. In this volume, we travel back to Marty's first job, in the 1980s – the weird and heroic era of the PC. Marty ended up in the Bay Area after he flunked out of an MIT computer science degree (he was too busy programming computers to do his classwork), and earning his CPA at a community college.

Silicon Valley in the early eighties was wild: Reaganomics stalked the land, the AIDS crisis was in full swing, the Dead Kennedys played every weekend, and man were the PCs ever weird. This was before the industry crystalized into Mac vs PC, back when no one knew what they were supposed to look like, who was supposed to use them, and what they were for.

Marty's first job is working for one of the weirder companies: Fidelity Computing. They sound like a joke: a computer company run by a Mormon bishop, a Catholic priest and an orthodox rabbi. But the joke's on their customers, because Fidelity Computing is a scam: a pyramid sales cult that exploits religious affinities to sell junk PCs that are designed to lock customers in and squeeze them for every dime. A Fidelity printer only works with Fidelity printer paper (they've gimmicked the sprockets on the tractor-feed). A Fidelity floppy drive only accepts Fidelity floppies (every disk is sold with a single, scratched-out sector and the drives check for an error on that sector every time they run).

Marty figures out he's working for the bad guys when they ask him to destroy Computing Freedom, a scrappy rival startup founded by three women who've escaped from Fidelity Computing's cult: a queer orthodox woman who's been kicked out of her family; a radical nun who's thrown in with the Liberation Theology movement in opposing America's Dirty Wars; and a Mormon woman who's quit the church in disgust at its opposition to the Equal Rights Amendment. The women of Computing Freedom have a (ahem) holy mission: to free every Fidelity customer from the prison they were lured into.

Marty may be young and inexperienced, but he can spot a rebel alliance from a light year away and he knows what side he wants to be on. He joins the women in their mission, and we're deep into a computing war that quickly turns into a shooting war. Turns out the Reverend Sirs of Fidelity Computer aren't just scammers – they're mobbed up, and willing to turn to lethal violence to defend their racket.

This is a rollicking crime thriller, a science fiction novel about the dawn of the computing revolution. It's an archaeological expedition to uncover the fossil record of the first emergence of enshittification, a phenomenon that was born with the PC and its evil twin, the Reagan Revolution.

The book comes out on Feb 15 in hardcover and ebook from Macmillan (US/Canada) and Bloomsbury (UK), but neither publisher is doing the audiobook. That's my department.

Why? Well, I love audiobooks, and I especially love the audiobooks for this series, because they're read by the incredible Wil Wheaton, hands down my favorite audiobook narrator. But that's not why I retain my audiobook rights and produce my own audiobooks. I do that because Amazon's Audible service refuses to carry any of my audiobooks.

Here's how that works: Audible is a division of Amazon, and they've illegally obtained a monopoly over the audiobook market, controlling more than 90% of audiobook sales in many genres. That means that if your book isn't for sale on Audible, it might as well not exist.

But Amazon won't let you sell your books on Audible unless you let them wrap those books in "digital rights management," a kind of encryption that locks them to Audible's authorized players. Under Section 1201 of the Digital Millennium Copyright Act, it's a felony punishable with a 5-year sentence and a $500k fine to supply you with a tool to remove an audiobook from Audible and play it on a rival app. That applies even if the person who gives you the tool is the creator of the book!

You read that right: if I make an audiobook and then give you the tools to move it out of Amazon's walled garden, I could go to prison for five years! That's a stiffer sentence than you'd face if you were to just pirate the audiobook. It's a harsher penalty than you'd get for shoplifting the book on CD from a truck-stop. It's more draconian than the penalty for hijacking the truck that delivers the CDs!

Amazon knows that every time you buy an audiobook from Audible, you increase the cost you'll have to pay if you switch to a competitor. They use that fact to give readers a worse deal (last year they tried out ads in audiobooks!). But the people who really suffer under this arrangement are the writers, whom Amazon abuses with abandon, knowing they can't afford to leave the service because their readers are locked into it. That's why Amazon felt they could get away with stealing $100 million from indie audiobook creators (and yup, they got away with it):

https://www.audiblegate.com/about

Which is why none of my books can be sold with DRM. And that means that Audible won't carry any of them.

For more than a decade, I've been making my own audiobooks, in partnership with the wonderful studio Skyboat Media and their brilliant director, Gabrielle de Cuir:

https://skyboatmedia.com/

I pay fantastic narrators a fair wage for their work, then I pay John Taylor Williams, the engineer who masters my podcasts, to edit the books and compose bed music for the intro and outro. Then I sell the books at every store in the world – except Audible and Apple, who both have mandatory DRM. Because fuck DRM.

Paying everyone a fair wage is expensive. It's worth it: the books are great. But even though my books are sold at many stores online, being frozen out of Audible means that the sales barely register.

That's why I do these Kickstarter campaigns, to pre-sell thousands of audiobooks in advance of the release. I've done six of these now, and each one was a huge success, inspiring others to strike out on their own, sometimes with spectacular results:

https://www.usatoday.com/story/entertainment/books/2022/04/01/brandon-sanderson-kickstarter-41-million-new-books/7243531001/

Today, I've launched the Kickstarter for Picks and Shovels. I'm selling the audiobook and ebook in DRM-free form, without any "terms of service" or "license agreement." That means they're just like a print book: you buy them, you own them. You can read them on any equipment you choose to. You can sell them, give them away, or lend them to friends. Rather than making you submit to 20,000 words of insulting legalese, all I ask of you is that you don't violate copyright law. I trust you!

Speaking of print books: I'm also pre-selling the hardcover of Picks and Shovels and the paperbacks of The Bezzle and Red Team Blues, the other two Marty Hench books. I'll even sign and personalize them for you!

http://martinhench.com

I'm also offering five chances to commission your own Marty Hench story – pick your favorite high-tech finance scam from the past 40 years of tech history, and I'll have Marty bust it in a custom short story. Once the story is published, I'll make sure you get credit. Check out these two cool Little Brother stories my previous Kickstarter backers commissioned:

  • Spill

https://reactormag.com/spill-cory-doctorow/

  • Vigilant

https://reactormag.com/vigilant-cory-doctorow/

I'm heading out on tour this winter and spring with the book. I'll be in LA, San Francisco, San Diego, Burbank, Bloomington, Chicago, Richmond VA, Toronto, NYC, Boston, Austin, DC, Baltimore, Seattle, and other dates still added. I've got an incredible roster of conversation partners lined up, too: John Hodgman, Charlie Jane Anders, Dan Savage, Ken Liu, Peter Sagal, Wil Wheaton, and others.

I hope you'll check out this book, and come out to see me on tour and say hi. Before I go, I want to leave you with some words of advance praise for Picks and Shovels:

I hugely enjoyed Picks and Shovels. Cory Doctorow’s reconstruction of the age is note perfect: the detail, the atmosphere, ethos, flavour and smell of the age is perfectly conveyed. I love Marty and Art and all the main characters. The hope and the thrill that marks the opening section. The superb way he tells the story of the rise of Silicon Valley (to use the lazy metonym), inserting the stories of Shockley, IBM vs US Government, the rise of MS – all without turning journalistic or preachy.

The seeds of enshittification are all there… even in the sunlight of that time the shadows are lengthening. AIDS of course, and the coming scum tide of VCs. In Orwellian terms, the pigs are already rising up on two feet and starting to wear trousers. All that hope, all those ideals…

I love too the thesis that San Francisco always has failed and always will fail her suitors.

Despite cultural entropy, enshittification, corruption, greed and all the betrayals there’s a core of hope and honour in the story too.

-Stephen Fry

Cory Doctorow writes as few authors do, with tech world savvy and real world moral clarity. A true storyteller for our times.

-John Scalzi

A crackling, page-turning tumble into an unexpected underworld of queer coders, Mission burritos, and hacker nuns. You will fall in love with the righteous underdogs of Computing Freedom—and feel right at home in the holy place Doctorow has built for them far from Silicon Valley’s grabby, greedy hands."

-Claire Evans, editor of Motherboard Future, author of Broad Band: The Untold Story of the Women Who Made the Internet.

"Wonderful…evokes the hacker spirit of the early personal computer era—and shows how the battle for software freedom is eternal."

-Steven Levy, author of Hackers: Heroes of the Computer Revolution and Facebook: The Inside Story.

What could be better than a Martin Hench thriller set in 1980s San Francisco that mixes punk rock romance with Lotus spreadsheets, dot matrix printers and religious orders? You'll eat this up – I sure did.

-Tim Wu, Special Assistant to the President for Technology and Competition Policy, author of The Master Switch: The Rise and Fall of Information Empires

Captures the look and feel of the PC era. Cory Doctorow draws a portrait of a Silicon Valley and San Francisco before the tech bros showed up — a startup world driven as much by open source ideals as venture capital gold.

-John Markoff, Pulitzer-winning tech columnist for the New York Times and author of What the Doormouse Said: How the Sixties Counterculture Shaped the Personal Computer Industry

You won't put this book down – it's too much fun. I was there when it all began. Doctorow's characters and their story are real.

-Dan'l Lewin, CEO and President of the Computer History Museum


Hey look at this (permalink)



A Wayback Machine banner.

This day in history (permalink)

#20yrsago How the Interstates got their numbers https://www.fhwa.dot.gov/programadmin/Interstate.cfm

#20yrsago Classic Atari D&D game is now a Quake 3 level https://web.archive.org/web/20040412195156/http://www.ataritimes.com/features/q3_adventure.html

#20yrsago Shirky: Pro metadata will lose to folksonomy https://corante.com/many/folksonomies-controlled-vocabularies/

#20yrsago Microsoft anti-spyware violates spyware EULAs https://web.archive.org/web/20050111021046/http://weblog.infoworld.com/foster/2005/01/07.html#a200

#5yrsago After more than a decade, Cecil Castellucci and Jim Rugg’s YA classics The PLAIN Janes are back! https://memex.craphound.com/2020/01/07/after-more-than-a-decade-cecil-castellucci-and-jim-ruggs-ya-classics-the-plain-janes-are-back/

#5yrsago 1975 Disneyland Haunted Mansion Standard Operating Procedures manual https://archive.org/details/hauntedmansionmanual

#5yrsago Despite 50 state AGs’ antitrust investigations, Google stocks hit an all time high https://www.cnbc.com/2020/01/06/google-and-facebook-hit-all-time-highs-despite-antitrust-probes.html

#5yrsago AI, machine learning, and other frothy tech subjects remained overhyped in 2019 https://rodneybrooks.com/predictions-scorecard-2020-january-01/

#5yrsago The New Deal was partly motivated by a desire to kill the fake news epidemic of the Gilded Age https://x.com/matthewstoller/status/810158671170772992

#5yrsago Explaining the con that is private equity https://www.vox.com/the-goods/2020/1/6/21024740/private-equity-taylor-swift-toys-r-us-elizabeth-warren


Upcoming appearances (permalink)

A photo of me onstage, giving a speech, holding a mic.



A screenshot of me at my desk, doing a livecast.

Recent appearances (permalink)



A grid of my books with Will Stahle covers..

Latest books (permalink)



A cardboard book box with the Macmillan logo.

Upcoming books (permalink)

  • Picks and Shovels: a sequel to "Red Team Blues," about the heroic era of the PC, Tor Books, February 2025

  • Enshittification: Why Everything Suddenly Got Worse and What to Do About It, Farrar, Straus, Giroux, October 2025

  • Unauthorized Bread: a middle-grades graphic novel adapted from my novella about refugees, toasters and DRM, FirstSecond, 2025



Colophon (permalink)

Today's top sources:

Currently writing:

  • Enshittification: a nonfiction book about platform decay for Farrar, Straus, Giroux. Status: second pass edit underway (readaloud)

  • A Little Brother short story about DIY insulin PLANNING

  • Picks and Shovels, a Martin Hench noir thriller about the heroic era of the PC. FORTHCOMING TOR BOOKS FEB 2025

Latest podcast: Daddy-Daughter Podcast 2024 https://craphound.com/overclocked/2024/12/17/daddy-daughter-podcast-2024/


This work – excluding any serialized fiction – is licensed under a Creative Commons Attribution 4.0 license. That means you can use it any way you like, including commercially, provided that you attribute it to me, Cory Doctorow, and include a link to pluralistic.net.

https://creativecommons.org/licenses/by/4.0/

Quotations and images are not included in this license; they are included either under a limitation or exception to copyright, or on the basis of a separate license. Please exercise caution.


How to get Pluralistic:

Blog (no ads, tracking, or data-collection):

Pluralistic.net

Newsletter (no ads, tracking, or data-collection):

https://pluralistic.net/plura-list

Mastodon (no ads, tracking, or data-collection):

https://mamot.fr/@pluralistic

Medium (no ads, paywalled):

https://doctorow.medium.com/

Twitter (mass-scale, unrestricted, third-party surveillance and advertising):

https://twitter.com/doctorow

Tumblr (mass-scale, unrestricted, third-party surveillance and advertising):

https://mostlysignssomeportents.tumblr.com/tagged/pluralistic

"When life gives you SARS, you make sarsaparilla" -Joey "Accordion Guy" DeVilla

Mon, 06 Jan 2025 15:03:15 +0000 Fullscreen Open in Tab
Pluralistic: Winning coalitions aren't always governing coalitions (06 Jan 2025)


Today's links



A skeletal figure in a tailcoat and sash with Trump's hair is shoving a bunch of animals into a tube, and out of the other end pours a stream of assorted rubbish. The rubbish has partially buried a tilted, red-tinged capital building. From out of the rubbish emerges an elephant in Republican mascot livery with Trump hair. The background is a foggy nighttime skyline of a big city, twinkling with lights.

Winning coalitions aren't always governing coalitions (permalink)

Winning an election is easier than it looks: all you have to do is convince a bunch of different groups that you will use power to achieve their desires. Bonus points if you can convince groups with mutually exclusive goals that you'll deliver for them – the coalition of "people who disagree about everything" is hard to assemble, but it sure is large!

Politically, a "conservative" is someone who believes that there is a small group of people who were born to rule, and a much larger group of people who were born to be ruled over. As Corey Robin writes in The Reactionary Mind, this is the one trait that unifies all the disparate strains of conservative thought: imperialists, monarchists, capitalists, white supremacists, misogynists, Christian nationalists, Hindu nationalists and supporters of Israeli genocide in Palestine:

https://coreyrobin.com/books/the-reactionary-mind/

These groups all agree that power should be hierarchical, that your position in a hierarchy is something you're born with, and that letting people who were "meant" to be at the bottom of the hierarchy rise to the top puts society so out of balance that it's actually a threat to human survival. That's why conservatives of all stripes get so furious about "DEI" – any kind of affirmative action program serves as a defective sorting hat, putting the incompetent and unsuitable into positions of power over other peoples' lives. It's why "DEI" is the go-to scapegoat for any kind of disaster, including giant ships crashing into bridges:

https://www.axios.com/local/salt-lake-city/2024/03/26/baltimore-bridge-dei-utah-lawmaker-phil-lyman-misinformation

But while conservatives all agree that some of us are born to be in charge and others are born to be bossed around by our innate superiors, they have irreconcilable differences about who is meant to be in charge. British imperialists who pine for the Raj have views that are fundamentally at odds with the views of Hindu nationalists. They're both "conservative" movements, but they're actually bitter enemies.

For a conservative movement to win power, it has to convince the people whom it would relegate to the bottom of the hierarchy to support that goal (AKA "getting turkeys to vote for Christmas"); and it must convince other conservatives that they will be able to establish a hierarchy that accommodates multiple, co-equal ruling elites.

The first tactic is well-established. LBJ summed it up neatly:

If you can convince the lowest white man he's better than the best colored man, he won't notice you're picking his pocket. Hell, give him somebody to look down on, and he'll empty his pockets for you.

The second one requires far more tactical thinking. Some elite groups are able to form coalitions by carving out exclusive zones: think of the friendly feeling among Modi, Orban, Erdogan, bin Salman, Trump, Milei, et al. These people all aspire to dictatorship, all espouse their superior blood – a source of personal and racial superiority – and hypothetically all believe that the world would be better if everyone (including their foreign counterparts) would take their orders.

One way to resolve this tension is to carve up the world geographically, which is why so many despots who seized power by promising to build ethno-states can co-exist with one another and even cheer one another on. Let Orban have Hungary, give Turkey to Erdogan, and let Bibi Netanyahu annex all of Gaza. Sure, in their hearts of hearts, each of these men secretly believe themselves to be racially and personally superior to the others, but so long as they all stay out of one another's turf, there's no reason to make a big deal out of that.

Another way to resolve this tension is to carve up the world temporally: think of the alliance between Christian nationalists and Israeli genocidiers. In the USA, "Christian Zionists" outnumber Jews who identify as Zionists:

https://www.trtworld.com/magazine/qanda-for-every-1-jewish-zionist-there-are-30-christian-zionists-and-netanyahu-exploits-this-15656249

But Christian Zionists aren't philosemites. They hate Jews and believe that we are all going to hell for murdering Christ. Their support for Israel isn't grounded in a belief in the necessity of a Jewish ethno-state – it arises out of the apocalyptic belief that Christ will return once Jews "return to the Holy Land" – albeit only briefly, before being cast into a lake of fire for all eternity.

Like British imperialists and the Hindu nationalists, Christian Zionists and Jewish Zionists are not on the same side. However, unlike British imperialists and Hindu nationalists, Christian Zionists and Jewish Zionists want the same thing…for a while. Both groups support the establishment of a Jewish entho-state in Israel, they just differ sharply as to what happens after that comes to pass. So long as they don't dwell on that moment in the future, they can stand shoulder to shoulder, fighting together for an Israeli state that operates with absolute US support and total international impunity.

Coalitions who defer the question of how they'll use power to after they've gained power are using time (rather than space) as a buffer that keeps their differences from smashing together until they shatter. But time and space aren't the only buffers for the differences between coalition partners – there's also class.

"Class" has been the most important, most useful buffer for conservativism since the Reagan revolution. Reagan came to power by forging an alliance with evangelicals, whose cult leaders had historically demanded that members focus their energies (and cash donations) on the church, while avoiding politics as "worldly."

Reagan promised the Christian right a bunch of culture war stuff – bans on abortion, punishment for uppity women and racial minorities, prayer in school, segregation academies, etc – that his financial backers frankly didn't give a shit about. By all means, let working class evangelicals homeschool their kids and teach them that the Earth is 5,000 years old, it doesn't matter to Wall Street, who will reap a giant tax-cut and also send their kids to private schools with rigorous curriculum. Bankers' wives and daughters will always be able to afford to fly out of state (or across the border) for abortion care, they will never die of AIDS in the charity wing of a community hospital, their daughters won't be trapped by bans on no-fault divorces.

For the past 40 years, American oligarchs and would-be oligarchs have entered into enthusiastic coalitions with virulently racist, sexist and homophobic groups, and maintained peace within their coalition by passing punitive, cruel laws that the rich can buy their way around. For many self-styled libertarians, the most important liberty is "not paying taxes" and this subordinates all other liberties, such that a "libertarian" will vote for a coalition whose platform promises to ban abortion, birth control, "interracial" marriage, and queer sex, so long as it also promises tax cuts. It's a weird kind of pro-freedom ideology that happily trades away (others') freedom for (your own) tax cuts:

https://pluralistic.net/2021/09/29/jubilance/#tolerable-racism

Remember, Trump's first CPAC speech was sponsored by Goproud, a group of "fiscally responsible" gay Republicans who believed in gay rights, sure, but not as much as they believed in getting so rich that even if poor gay people were ground into dust, they could float above it all:

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

Class is the third buffer between the oligarchs of the right and the mass movement that provides the bulk for winning elections. After all, laws are for the little people, so by all means, we can promise – and even deliver – laws that we would never submit to, because we don't have to submit to them. This is Wilhoit's Law in action:

Conservatism consists of exactly one proposition, to wit: There must be in-groups whom the law protects but does not bind, alongside out-groups whom the law binds but does not protect.

https://en.wikipedia.org/wiki/Francis_M._Wilhoit#Wilhoit's_law

In a hierarchical society, class separates groups of people just as rigidly as time and space, and is every bit as useful a buffer as the other two forces.

Until it isn't.

Eventually – once you've banned abortion, once you've taken all the "controversial" books out of the library, once you've made affirmative action illegal – you reach the layer of non-negotiable culture war demands that the rich can't buy their way out of.

Like immigration.

Let's start with this: immigration doesn't have to result in wage suppression. Couple immigration with strong unions and a muscular labor rights regime and workers do just great. The more the merrier! America needs workers of every kind. What's more, the unions and labor laws in America owe their existence to immigrant workers, so there's nothing about immigration that is necessarily incompatible with winning rights for workers.

But the possibility of importing some overseas union organizers isn't what motivates the finance wing of the conservative coalition to demand "guest-worker" programs like the H1B visa:

https://twitter.com/RobertMSterling/status/1873175206073626660

H1B visas are "non-immigrant" visas, meaning that they are designed not to offer any path to permanent residence or citizenship. You can live in the US for a long time on an H1B, but you are bound over to your employer like a serf bound to a feudal estate: if you lose your job, you lose your right to abide in the country. That can mean losing your house, your car, your kids' school and friends. It can cost your spouse their job, because if you're kicked out of the country, they might well leave along with you, rather than remain alone here.

H1B tech workers are the workers that tech-barons have dreamt of for decades. An H1B worker can't job-hop, and so needn't be lured to work with gourmet cafeterias, luxury gymnasiums, or other perks of the whimsical tech "campus." H1B workers can't quit if they don't like their stock-options packages:

https://pluralistic.net/2023/09/10/the-proletarianization-of-tech-workers/

Tech bosses hate tech workers, and they always have. It's not affection that causes Jeff Bezos to allow his coders to come to work with pink mohawks, facial piercings, and black t-shirts that say things their bosses don't understand, while his delivery drivers piss in bottles and his warehouse workers are injured at three times the national average. Jeff Bezos neither cherishes his coders' kidneys, nor is he especially hostile to delivery drivers' need to pee – he just squeezes any and every worker in any and every way he can.

Same for Tim Cook: the accomplishment that prompted Apple's board to elevate Cook to Steve Jobs' CEO office was the successful transfer of iPhone manufacturing to China. Specifically, Cook figured out how to work with his primary supplier, Foxconn, to create a working environment that produced reliable, precision-manufactured mobile devices, and all it took was creating a working environment so brutal that the company had to install suicide nets to catch the factory workers who couldn't stand it any longer:

https://www.theguardian.com/technology/2017/jun/18/foxconn-life-death-forbidden-city-longhua-suicide-apple-iphone-brian-merchant-one-device-extract

Apple's tech workers aren't worked to suicidal desperation, sure – but not because Tim Cook likes coders and hates factory workers. It's because he's afraid coders will quit, and he's not worried about replacing factory workers after they jump to their death.

The point of the H1B program is to create a tech workforce that bosses no longer have to fear. Recall that when Elon Musk took over Twitter and circulated a mandatory "extremely hardcore" pledge that demanded that workers promise to subordinate their health and wellbeing to his profits, it prompted a mass departure, with the notable exception of workers whose immigration status (and/or insurance for serious health issues) depended on their ongoing employment at Twitter:

https://www.theverge.com/2022/11/16/23462026/elon-musk-twitter-email-hardcore-or-severance

When Musk's cronies gloated about shedding 20% of Twitter's workforce on "day zero," the workers they had in mind were the ones who didn't fear their bosses and wouldn't frog when the investor class shouted jump. "Sharpen your blades, boys" means we're slicing off workers who are laboring under the misapprehension that they are entitled to a say in their working conditions:

https://techcrunch.com/2022/09/29/elon-musk-texts-discovery-twitter/

After all, America does not have a tech worker shortage. The US tech sector fired 260,000 skilled workers in 2023, and more than 150,000 were shown the door in 2024. When Musk and his fellow tech bosses complain that they need more "talent," what they mean is they need workers who are so terrified of being deported that they'll accept low wages, sleep under their desks, refuse to talk to union organizers, and, above all, do as they're told:

https://youtube.com/shorts/N0FkyXFhmpo?si=GCh6bFqd31prazhz

Trump won office by promising mutually exclusive outcomes to different parts of his coalition. To the nativists and bigots (and workers who'd bamboozled into thinking that their low salaries were the fault of other workers, not their bosses), he promised a halt to immigration. To the plutocrats, he promised a large and pliable workforce – of low-waged agricultural workers and of precarious H1B tech workers who'd discipline America's "entitled" tech workers:

https://prospect.org/labor/2025-01-02-president-musk-american-workers-h1b-visas/

Now, he has to figure out how to keep everyone happy. Literally: the Speakership of Congress is only nine votes away from collapsing at any time (and until last week, it was just one vote away), and without Congress, Trump's ability to govern will be severely curtailed (see, for example, 2018-2020).

Immigration isn't an issue like abortion: oligarchs can support abortion bans and still procure abortions when they need them. It's much harder to support an immigration ban and still procure precarious, low-waged workers for your business. It will take many years for American-born workers to be so brutalized and broken that they capitulate to the working conditions that American guest workers and undocumented workers accept, and bosses are impatient.

It's hard to put on a convincing performance of banning immigration, as the UK's New Labour discovered. In the years leading up to the 2010 election, Labour – under Blair and then Brown – made a big show of "cracking down on immigration." At one point, Home Secretary Jacqui Smith announced that she was axing dozens of UK visa categories, while carefully not mentioning these were so niche that hardly anyone qualified for them. This created chaos for the people affected and their families – I lost my own "Highly Skilled Migrant" visa at this time and we had to move our wedding plans up by eight months so I could stay in the country with my British partner and our daughter – but it didn't do anything to quench the xenophobic rage that UKIP and the Tories had been stoking, and Labour lost its next election.

American conservatives are rightly proud of their ability to form coalitions. They trumpet their ethic of "no enemies to the right" and contrast this with the "cancel culture" of progressives:

https://www.wired.com/story/the-year-democrats-lost-the-internet/

It's true that purging your ranks of coalition partners who disagree with you at the margins is a severely self-limiting move. It's also true that the broader your coalition is, the easier it is to win power.

The right has built a coalition of people who want opposite things. Infamously, Project 2025 isn't just a collection of terrifying ideas for running (and ruining) America – it's a collection of mutually exclusive terrifying ideas for running and ruining America:

https://pluralistic.net/2024/07/14/fracture-lines/#disassembly-manual

Trump's top health picks – RFK jr, Weldon, Oz, Makary, Bhattacharya, Nesheiwat – want mutually exclusive, irreconcilable things that are as impossible to compromise on as "banning immigration" while simultaneously "expanding the H1B program":

https://pluralistic.net/2024/12/20/clinical-trial-by-ordeal/#spoiled-his-brand-new-rattle

Big, diverse coalitions of people who normally oppose each other are great for winning power, but they're very bad for wielding power. Trump's majorities in Congress and the Senate are razor-thin, and while the Democrats had to suffer under the Manchin-Synematic Universe, the GOP's Klown Kar of Krazies has dozens of swivel-eyed loons who will happily blow up "must-pass" bills just for shits and giggles.

What's more, the GOP has spent decades installing easily blown circuit breakers into the American legislative and administrative systems, from the filibuster to the debt ceiling. By design, these allow small groups of lawmakers to kill bills and hamstring presidential power. Trump's first attempt at removing one of these breakers – the senseless kabuki of the annual debt ceiling showdown – was a total failure:

https://prospect.org/blogs-and-newsletters/tap/2024-12-19-debt-limit-should-absolutely-be-eliminated/

Musk thinks he can ram through policies that sizable portions of the GOP coalition would rather die than support. So far, Trump has proven a pliable puppet for Musk's ambitions. But the Musk-Trump coalition is every bit as fragile as any other in the GOP, and Trump is notoriously sensitive to accusations of weakness. Musk can threaten to primary any GOP lawmaker who gets in his way, but as the Kochs discovered after they unleashed the Tea Party, grievance-fueled, paranoid, heavily armed cults are hard to keep on a leash.

The coming months are sure to be an all-out war of GOP infighting as the coalition must wield power without the useful buffers of space, time and class. They'll be an object lesson in the dangers of a coalition that's so broad that everyone is welcome, even people who'd happily line you and yours in front of a firing squad.

But just because the right's attitude to coalitions is to have a mind so open its brains fall out, that doesn't mean the left should pursue a program of overwhelming ideological purity. Trump is a stupid guy with incoherent ideas, but look at how far he got by erecting such a big tent that anyone fit underneath it (even actual Nazis).

The progressive coalition doesn't need to be that big. We can have enemies to the right. The hugs Kamala Harris bestowed on ghouls like Liz Cheney didn't win the election, and the medal Biden just gave her won't help either:

https://www.nytimes.com/2025/01/02/us/politics/presidential-citizens-medal-liz-cheney.html

Manchin and Synema can "fuck off until they come up to a gate with a sign saying 'You Can’t Fuck Off Past Here,' Climb over the gate, dream the impossible dream, and keep fucking off forever":

https://michaelmarshallsmith.substack.com/about

But the fact that some people don't belong in a progressive coalition, it doesn't follow that there's no room to make the coalition looser and broader. Sure, a big coalition makes it hard to wield power, but without that coalition, we'll never win power.


Hey look at this (permalink)



A Wayback Machine banner.

This day in history (permalink)

#20yrsago T-shirt: HOME TAPING IS KILLING MUSIC AND IT’S FUN https://web.archive.org/web/20040429213938/http://www.downhillbattle.org/postal/index.php

#20yrsago Machine learning is innately conservative and wants you to either act like everyone else, or never change https://lareviewofbooks.org/blog/provocations/neophobic-conservative-ai-overlords-want-everything-stay/

#5yrsago Everything you wanted to know about money-laundering but were afraid to ask https://x.com/CZEdwards/status/1213597148274511872

#5yrsago Republican New York State Assembly leader publishes anti-drunk driving PSA shortly before drunkenly crashing a state-owned car https://web.archive.org/web/20200102042442/https://www.mpnnow.com/news/20200101/video-assemblyman-kolb-charged-with-dwi-after-victor-crash

#5yrsago The estranged anarchist daughter of the Republican gerrymandering mastermind inherited and dumped all his files https://www.vice.com/en/article/the-anarchist-daughter-of-the-gops-gerrymandering-mastermind-just-dumped-all-his-maps-and-files-on-google-drive/

#5yrsago Permitting the growth of monopolies is a form of government censorship https://locusmag.com/2020/01/cory-doctorow-inaction-is-a-form-of-action/

#5yrsago Podcast: Science fiction and the unforeseeable future: In the 2020s, let’s imagine better things https://ia802806.us.archive.org/35/items/Cory_Doctorow_Podcast_322/Cory_Doctorow_Podcast_322_-_Science_fiction_and_the_unforeseeable_future.mp3


Upcoming appearances (permalink)

A photo of me onstage, giving a speech, holding a mic.



A screenshot of me at my desk, doing a livecast.

Recent appearances (permalink)



A grid of my books with Will Stahle covers..

Latest books (permalink)



A cardboard book box with the Macmillan logo.

Upcoming books (permalink)

  • Picks and Shovels: a sequel to "Red Team Blues," about the heroic era of the PC, Tor Books, February 2025

  • Enshittification: Why Everything Suddenly Got Worse and What to Do About It, Farrar, Straus, Giroux, October 2025

  • Unauthorized Bread: a middle-grades graphic novel adapted from my novella about refugees, toasters and DRM, FirstSecond, 2025



Colophon (permalink)

Today's top sources:

Currently writing:

  • Enshittification: a nonfiction book about platform decay for Farrar, Straus, Giroux. Status: second pass edit underway (readaloud)

  • A Little Brother short story about DIY insulin PLANNING

  • Picks and Shovels, a Martin Hench noir thriller about the heroic era of the PC. FORTHCOMING TOR BOOKS FEB 2025

Latest podcast: Daddy-Daughter Podcast 2024 https://craphound.com/overclocked/2024/12/17/daddy-daughter-podcast-2024/


This work – excluding any serialized fiction – is licensed under a Creative Commons Attribution 4.0 license. That means you can use it any way you like, including commercially, provided that you attribute it to me, Cory Doctorow, and include a link to pluralistic.net.

https://creativecommons.org/licenses/by/4.0/

Quotations and images are not included in this license; they are included either under a limitation or exception to copyright, or on the basis of a separate license. Please exercise caution.


How to get Pluralistic:

Blog (no ads, tracking, or data-collection):

Pluralistic.net

Newsletter (no ads, tracking, or data-collection):

https://pluralistic.net/plura-list

Mastodon (no ads, tracking, or data-collection):

https://mamot.fr/@pluralistic

Medium (no ads, paywalled):

https://doctorow.medium.com/

Twitter (mass-scale, unrestricted, third-party surveillance and advertising):

https://twitter.com/doctorow

Tumblr (mass-scale, unrestricted, third-party surveillance and advertising):

https://mostlysignssomeportents.tumblr.com/tagged/pluralistic

"When life gives you SARS, you make sarsaparilla" -Joey "Accordion Guy" DeVilla

2025-01-06T14:50:05+00:00 Fullscreen Open in Tab
Note published on January 6, 2025 at 2:50 PM UTC

happy monday, i hope everyone also enjoyed the SIX STRAIGHT WEEKS of holidays we just had!

you know when you leave a movie theater and you feel like you're returning from another dimension? that's how i feel rn

Illustration of Molly White sitting and typing on a laptop, on a purple background with 'Molly White' in white serif.
2025-01-05T21:38:20+00:00 Fullscreen Open in Tab
Note published on January 5, 2025 at 9:38 PM UTC
2025-01-05T17:20:09+00:00 Fullscreen Open in Tab
Read "The Invisible War"
Listened to:
In this year's two-part finale, Ed Zitron enumerates the damage being done to billions of people by the growth-at-all-costs Rot Economy - and why you need to have solidarity with your fellow user.
Illustration of Molly White sitting and typing on a laptop, on a purple background with 'Molly White' in white serif.
Illustration of Molly White sitting and typing on a laptop, on a purple background with 'Molly White' in white serif.
2025-01-05T16:32:45+00:00 Fullscreen Open in Tab
Note published on January 5, 2025 at 4:32 PM UTC
2025-01-05T16:01:51+00:00 Fullscreen Open in Tab
Note published on January 5, 2025 at 4:01 PM UTC
2025-01-03T19:55:12+00:00 Fullscreen Open in Tab
Note published on January 3, 2025 at 7:55 PM UTC

in case you needed a reason to volunteer at your local public library: today the librarians let me pick a theme for and then curate one of the featured displays.

time to get this town reading more space operas!

my picks, if you want to read along:

  • All Systems Red, Martha Wells
  • Ancillary Justice, Ann Leckie
  • Collapsing Empire, John Scalzi
  • Empire of Silence, Christopher Ruocchio
  • Foundation, Isaac Asimov
  • Leviathan Wakes, James A. Corey
  • Olympos, Dan Simmons
  • Saga (graphic novel), Brian K. Vaughan
  • Shards of Earth, Adrian Tchaikovsky
  • The Stars are Legion, Kameron Hurley
  • The Three Body Problem, Liu Cixin

was working with a somewhat limited selection, or else I’d have tucked in some others:

  • The Algebraist, Iain M. Banks (this is my current read!)
  • Children of Time, Adrian Tchaikovsky
  • Consider Phlebas, Iain M. Banks
  • The Dispossessed, Ursula K. Le Guin
  • The Long Way to a Small, Angry Planet, Becky Chambers
  • Ninefox Gambit, Yoon Ha Lee
  • Nova, Samuel R. Delany
  • Pandora’s Star, Peter F. Hamilton
  • Revelation Space, Alistair Reynolds
  • Shards of Honor, Lois McMaster Bujold
  • Starship Troopers, Robert A. Heinlein
  • We Are Legion (We Are Bob), Dennis E. Taylor

(I haven’t read all these, but the ones I haven’t are all on my to-read!)

Illustration of Molly White sitting and typing on a laptop, on a purple background with 'Molly White' in white serif.
2025-01-05T16:10:34+00:00 Fullscreen Open in Tab
Published on Citation Needed: "Elon Musk and the right’s war on Wikipedia"
2025-01-05T16:11:56+00:00 Fullscreen Open in Tab
Published on Citation Needed: "Not just one bad apple: FTX's practices were business as usual in crypto"
2024-12-27T21:13:31+00:00 Fullscreen Open in Tab
Note published on December 27, 2024 at 9:13 PM UTC
2024-12-24T19:41:12+00:00 Fullscreen Open in Tab
Note published on December 24, 2024 at 7:41 PM UTC
2024-12-24T17:31:17+00:00 Fullscreen Open in Tab
Note published on December 24, 2024 at 5:31 PM UTC
Sat, 21 Dec 2024 22:38:47 +0000 Fullscreen Open in Tab
Pluralistic: Proud to be a blockhead (21 Dec 2024)


Today's links



A writer, bundled in furs, sitting on a block of ice and writing with a quill pen. His head has been replaced with that of a skeleton. His inkpot is suspended over a camp stove. He has written, 'No man but a blockhead ever wrote except for money.' Surrounding him in a semicircle are nine angry, wealthy men in old fashioned suits, shouting and gesticulating. The background is a faded US$100 bill.

Proud to be a blockhead (permalink)

This is my last Pluralistic post of the year, and rather than round up my most successful posts of the year, I figured I'd write a little about why it's impossible for me to do that, and why that is by design, and what that says about the arts, monopolies, and creative labor markets.

I started Pluralistic nearly five years ago, and from the outset, I was adamant that I wouldn't measure my success through quantitative measures. The canonical version of Pluralistic – the one that lives at pluralistic.net – has no metrics, no analytics, no logs, and no tracking. I don't know who visits the site. I don't know how many people visit the site. I don't know which posts are most popular, and which ones are the least popular. I can't know any of that.

The other versions of Pluralistic are less ascetic, but only because there's no way for me to turn off some metrics on those channels. The Mailman service that delivers the (tracker-free) email version of Pluralistic necessarily has a system for telling me how many subscribers I have, but I have never looked at that number, and have no intention of doing so. I have turned off notifications when someone signs up for the list, or resigns from it.

The commercial, surveillance-heavy channels for Pluralistic – Tumblr, Twitter – have a lot of metrics, but again, I don't consult them. Medium and Mastodon have some metrics, and again, I just pretend they don't exist.

What do I pay attention to? The qualitative impacts of my writing. Comments. Replies. Emails. Other bloggers who discuss it, or discussions on Metafilter, Slashdot, Reddit and Hacker News. That stuff matters to me a lot because I write for two reasons, which are, in order: to work out my own thinking, and; to influence other peoples' thinking.

Writing is a cognitive prosthesis for me. Working things out on the page helps me work things out in my life. And, of course, working things out on the page helps me work more things out on the page. Writing begets writing:

https://pluralistic.net/2021/05/09/the-memex-method/

Honestly, that is sufficient. Not in the sense that writing, without being read, would make me happy or fulfilled. Being read and being part of a community and a conversation matters a lot to me. But the very act of writing is so important to me that even if no one read me, I would still write.

This is a thing that writers aren't supposed to admit. As I wrote on this blog's fourth anniversary, the most laughably false statement about writing ever uttered is Samuel Johnson's notorious "No man but a blockhead ever wrote but for money":

https://pluralistic.net/2024/02/20/fore/#synthesis

Making art is not an "economically rational" activity. Neither is attempting to persuade other people to your point of view. These activities are not merely intrinsically satisfying, they are also necessary, at least for many of us. The long, stupid fight about copyright that started in the Napster era has rarely acknowledged this, nor has it grappled with the implications of it. On the one hand, you have copyright maximalists who say totally absurd things like, "If you don't pay for art, no one will make art, and art will disappear." This is one of those radioactively false statements whose falsity is so glaring that it can be seen from orbit.

But on the other hand, you know who knows this fact very well? The corporations that pay creative workers. Movie studios, record labels, publishers, games studios: they all know that they are in possession of a workforce that has to make art, and will continue to do so, paycheck or not, until someone pokes their eyes out or breaks their fingers. People make art because it matters to them, and this trait makes workers terribly exploitable. As Fobazi Ettarh writes in her seminal paper on "vocational awe," workers who care about their jobs are at a huge disadvantage in labor markets. Teachers, librarians, nurses, and yes, artists, are all motivated by a sense of mission that often trumps their own self-interest and well-being and their bosses know it:

https://www.inthelibrarywiththeleadpipe.org/2018/vocational-awe/

One of the most important ideas in David Graeber's magisterial book Bullshit Jobs is that the ground state of labor is to do a job that you are proud of and that matters to you, but late-stage capitalist alienation has gotten so grotesque that some people will actually sneer at the idea that, say, teachers should be well compensated: "Why should you get a living wage – isn't the satisfaction of helping children payment enough?"

https://memex.craphound.com/2018/06/20/david-graebers-bullshit-jobs-why-does-the-economy-sustain-jobs-that-no-one-values/

These are the most salient facts of the copyright fight: creativity is a non-economic activity, and this makes creative workers extremely vulnerable to exploitation. People make art because they have to. As Marx was finishing Kapital, he was often stuck working from home, having pawned his trousers so he could keep writing. The fact that artists don't respond rationally to economic incentives doesn't mean they should starve to death. Art – like nursing, teaching and librarianship – is necessary for human thriving.

No, the implication of the economic irrationality of vocational awe is this: the only tool that can secure economic justice for workers who truly can't help but do their jobs is solidarity. Creative workers need to be in solidarity with one another, and with our audiences – and, often, with the other workers at the corporations who bring our work to market. We are all class allies locked in struggle with the owners of both the entertainment companies and the technology companies that sit between us and our audiences (this is the thesis of Rebecca Giblin's and my 2022 book Chokepoint Capitalism):

https://chokepointcapitalism.com/

The idea of artistic solidarity is an old and important one. Victor Hugo, creator of the first copyright treaty – the Berne Convention – wrote movingly about how the point of securing rights for creators wasn't to allow their biological children to exploit their work after their death, but rather, to ensure that the creative successors of artists could build on their forebears' accomplishments. Hugo – like any other artist who has a shred of honesty and has thought about the subject for more than ten seconds – knew that he was part of a creative community and tradition, one composed of readers and writers and critics and publishing workers, and that this was a community and a tradition worth fighting for and protecting.

One of the most important and memorable interviews Rebecca and I did for our book was with Liz Pelly, one of the sharpest critics of Spotify (our chapter about how Spotify steals from musicians is the only part of the audiobook available on Spotify itself – a "Spotify Exclusive"!):

https://open.spotify.com/show/7oLW9ANweI01CVbZUyH4Xg

Pelly has just published a major, important new book about Spotify's ripoffs, called Mood Machine:

https://www.simonandschuster.com/books/Mood-Machine/Liz-Pelly/9781668083505

A long article in Harper's unpacks one of the core mechanics at the heart of Spotify's systematic theft from creative workers: the use of "ghost artists," whose generic music is cheaper than real music, which is why Spotify crams it into their playlists:

https://harpers.org/archive/2025/01/the-ghosts-in-the-machine-liz-pelly-spotify-musicians/

The subject of Ghost Artists has long been shrouded in mystery and ardent – but highly selective – denials from Spotify itself. In her article – which features leaked internal chats from Spotify – Pelly gets to the heart of the matter. Ghost artists are musicians who are recruited by shadowy companies that offer flat fees for composing and performing inoffensive muzak that can fade into the background. This is wholesaled to Spotify, which crams it into wildly popular playlists of music that people put on while they're doing something else ("Deep Focus," "100% Lounge," "Bossa Nova Dinner," "Cocktail Jazz," "Deep Sleep," "Morning Stretch") and might therefore settle for an inferior product.

Spotify calls this "Perfect Fit Music" and it's the pink slime of music, an extruded, musiclike content that plugs a music-shaped hole in your life, without performing the communicative and aesthetic job that real music exists for.

After many dead-end leads with people involved in the musical pink slime industry, Pelly finally locates a musician who's willing to speak anonymously about his work (he asks for anonymity because he relies on the pittances he receives for making pink slime to survive). This jazz musician knows very little about where the music he's commissioned to produce ends up, which is by design. The musical pink slime industry, like all sleaze industries, is shrouded in the secrecy sought by bosses who know that they're running a racket they should be ashamed of.

The anonymous musician composes a stack of compositions on his couch, then goes into a studio for a series of one-take recordings. There's usually a rep from the PFC pink slime industry there, and the rep's feedback is always "play simpler." As the anonymous musician explains:

That’s definitely the thing: nothing that could be even remotely challenging or offensive, really. The goal, for sure, is to be as milquetoast as possible.

This source calls the arrangement "shameful." Another musician Pelly spoke to said "it felt unethical, like some kind of money-laundering scheme." The PFC companies say that these composers and performers are just making music, the way anyone might, and releasing it under pseudonyms in a way that "has been popular across mediums for decades." But Pelly's interview subjects told her that they don't consider their work to be art:

It feels like someone is giving you a prompt or a question, and you’re just answering it, whether it’s actually your conviction or not. Nobody I know would ever go into the studio and record music this way.

Artists who are recruited to make new pink slime are given reference links to existing pink slime and ordered to replicate it as closely as possible. The tracks produced this way that do the best are then fed to the next group of musicians to replicate, and so on. It's the musical equivalent of feeding slaughterhouse sweepings to the next generation of livestock, a version of the gag from Catch 22 where a patient in a body-cast has a catheter bag and an IV drip, and once a day a nurse comes and swaps them around.

Pelly reminds us that Spotify was supposed to be an answer to the painful question of the Napster era: how do we pay musicians for their labor? Spotify was sold as a way to bypass the "gatekeepers": the big three labels who own 70% of all recorded music, whose financial maltreatment of artists was seen as moral justification for file sharing ("Why buy the CD if the musician won't see any of the money from it?").

But the way that Spotify secured rights to all the popular music in the world was by handing over big equity stakes in its business to the Big Three labels, and giving them wildly preferential terms that made it impossible for independent musicians and labels to earn more than homeopathic fractions of a penny for each stream, even as Spotify became the one essential conduit for reaching an audience:

https://pluralistic.net/2021/03/16/wage-theft/#excessive-buyer-power

It turns out that getting fans to pay for music has no necessary connection to getting musicians paid. Vocational awe means that the fact that someone has induced a musician to make music doesn't mean that the musician is getting a fair share of what you pay for music. The same goes for every kind of art, and every field where vocational awe plays a role, from nursing to librarianship.

Chokepoint Capitalism tries very hard to grapple with this conundrum; the second half of the book is a series of detailed, shovel-ready policy prescriptions for labor, contract, and copyright reforms that will immediately and profoundly shift the share of income generated by creative labor from bosses to workers.

Which brings me back to this little publishing enterprise of mine, and the fact that I do it for free, and not only that, give it away under a Creative Commons Attribution license that allows you to share and republish it, for money, if you choose:

https://creativecommons.org/licenses/by/4.0/

I am lucky enough that I make a good living from my writing, but I'm also honest enough with myself to know just how much luck was involved with that fact, and insecure enough to live in a state of constant near-terror about what happens when my luck runs out. I came up in science fiction, and I vividly remember the writers I admired whose careers popped like soap-bubbles when Reagan deregulated the retail sector, precipitating a collapse in the grocery stores and pharmacies where "midlist" mass-market paperbacks were sold by the millions across the country:

https://pluralistic.net/2021/07/04/self-publishing/

These writers – the ones who are still alive – are living proof of the fact that you have to break our fingers to get us to stop writing. Some of them haven't had a mainstream publisher in decades, but they're still writing, and self-publishing, or publishing with small presses, and often they're doing the best work of their careers, and almost no one is seeing it, and they're still doing it.

Because we aren't engaged in economically rational activity. We're doing something essential – essential to us, first and foremost, and essential to the audiences and peers our work reaches and changes and challenges.

Pluralistic is, in part, a way for me to face the fear I wake up with every day, that some day, my luck will run out, as it has for nearly all the writers I've ever admired, and to reassure myself that the writing will go on doing what I need it to do for my psyche and my heart even if – when – my career regresses to the mean.

It's a way for me to reaffirm the solidaristic nature of artistic activity, the connection with other writers and other readers (because I am, of course, an avid, constant reader). Commercial fortunes change. Monopolies lay waste to whole sectors and swallow up the livelihoods of people who believe in what they do like a whale straining tons of plankton through its baleen. But solidarity endures. Solidarietatis longa, vita brevis.

Happy New Year folks. See you in 2025.


Hey look at this (permalink)



A Wayback Machine banner.

This day in history (permalink)

#15yrsago Soviet kids’-book robots https://web.archive.org/web/20100107193522/https://ajourneyroundmyskull.blogspot.com/2009/12/mummy-was-robot-daddy-was-small-non.html

#15yrsago EFF’s ebook-buyer’s guide to privacy https://www.eff.org/deeplinks/2009/12/e-book-privacy

#15yrsago Botnet runners start their own ISPs https://web.archive.org/web/20100103161911/http://threatpost.com/en_us/blogs/attackers-buying-own-data-centers-botnets-spam-122109

#15yrsago BBC’s plan to kick free/open source out of UK TV devices https://www.theguardian.com/technology/2009/dec/22/bbc-drm-cory-doctorow

#15yrsago How to Teach Physics to Your Dog: explaining quantum physics through discussions with a German shepherd https://memex.craphound.com/2009/12/22/how-to-teach-physics-to-your-dog-explaining-quantum-physics-through-discussions-with-a-german-shepherd/

#10yrsago Podcast: Happy Xmas! (guest starring Poesy) https://ia801602.us.archive.org/32/items/Cory_Doctorow_Podcast_280/Cory_Doctorow_Podcast_280_Happy_Christmas_with_Poesy.mp3

#10yrsago Homophobic pastor arrested for squeezing man’s genitals in park https://www.attitude.co.uk/news/world/anti-gay-pastor-gaylard-williams-arrested-after-squeezing-mans-genitals-283001/

#10yrsago Clever student uses red/blue masking to double exam cribsheet https://www.reddit.com/r/pics/comments/2pxxaj/told_my_students_they_could_use_a_3_x_5_notecard/

#10yrsago Dollar Store Dungeons! http://www.bladeandcrown.com/blog/2013/12/30/dollar-store-dungeons-the-project/

#10yrsago Delware school district wants kids to get signed permission before checking out YA library books https://cbldf.org/2014/12/delaware-school-district-considers-permission-slips-for-young-adult-books/

#5yrsago The 2010s were the decade of Citizens United https://slate.com/news-and-politics/2019/12/citizens-united-devastating-impact-american-politics.html

#5yrsago Kentucky’s former GOP governor pardoned a bunch of rapists and murderers on his way out of office, including a child rapist https://www.washingtonpost.com/nation/2019/12/20/matt-bevin-micah-schoettle-child-rapist-hymen-intact-pardon/

#5yrsago Mel Brooks on the 40th Anniversary of his "greatest film," Young Frankenstein https://www.latimes.com/entertainment/movies/la-et-mn-mel-brooks-20140909-story.html

#1yrago A year in illustration, 2023 edition https://pluralistic.net/2023/12/21/collages-r-us/#ki-bosch


Upcoming appearances (permalink)

A photo of me onstage, giving a speech, holding a mic.



A screenshot of me at my desk, doing a livecast.

Recent appearances (permalink)



A grid of my books with Will Stahle covers..

Latest books (permalink)



A cardboard book box with the Macmillan logo.

Upcoming books (permalink)

  • Picks and Shovels: a sequel to "Red Team Blues," about the heroic era of the PC, Tor Books, February 2025

  • Enshittification: Why Everything Suddenly Got Worse and What to Do About It, Farrar, Straus, Giroux, October 2025

  • Unauthorized Bread: a middle-grades graphic novel adapted from my novella about refugees, toasters and DRM, FirstSecond, 2025



Colophon (permalink)

Today's top sources:

Currently writing:

  • Enshittification: a nonfiction book about platform decay for Farrar, Straus, Giroux. Status: second pass edit underway (readaloud)

  • A Little Brother short story about DIY insulin PLANNING

  • Picks and Shovels, a Martin Hench noir thriller about the heroic era of the PC. FORTHCOMING TOR BOOKS FEB 2025

Latest podcast: Daddy-Daughter Podcast 2024 https://craphound.com/overclocked/2024/12/17/daddy-daughter-podcast-2024/


This work – excluding any serialized fiction – is licensed under a Creative Commons Attribution 4.0 license. That means you can use it any way you like, including commercially, provided that you attribute it to me, Cory Doctorow, and include a link to pluralistic.net.

https://creativecommons.org/licenses/by/4.0/

Quotations and images are not included in this license; they are included either under a limitation or exception to copyright, or on the basis of a separate license. Please exercise caution.


How to get Pluralistic:

Blog (no ads, tracking, or data-collection):

Pluralistic.net

Newsletter (no ads, tracking, or data-collection):

https://pluralistic.net/plura-list

Mastodon (no ads, tracking, or data-collection):

https://mamot.fr/@pluralistic

Medium (no ads, paywalled):

https://doctorow.medium.com/

Twitter (mass-scale, unrestricted, third-party surveillance and advertising):

https://twitter.com/doctorow

Tumblr (mass-scale, unrestricted, third-party surveillance and advertising):

https://mostlysignssomeportents.tumblr.com/tagged/pluralistic

"When life gives you SARS, you make sarsaparilla" -Joey "Accordion Guy" DeVilla

Fri, 20 Dec 2024 15:40:51 +0000 Fullscreen Open in Tab
Pluralistic: Trumpism's healthcare fracture-lines (20 Dec 2024)


Today's links



A WWII-era infirmary with two ranks of beds. Behind a bed on each side stands an outraged Tweedledee/Tweedledum figure from Tenniel's Alice Through the Looking Glass engravings, pulling their hair; they face one another. One is tinted green; the other, blue. Between them in the aisle stands an elephant in GOP livery, wearing a Trump wig. A spatter of blood climbs the wall on the right.

Trumpism's healthcare fracture-lines (permalink)

There was never any question as to whether Trump would implement Project 2025, the 900-page brick of terrifying and unhinged policy prescriptions edited by the Heritage Foundation. He would not implement it, because he could not implement it. No one could. It's impossible.

This isn't a statement about constitutional limits on executive authority or the realpolitik of getting bizarre and stupid policies past judges or through a hair-thin Congressional majority. This is a statement about the incoherence of Project 2025 itself. You probably haven't read it. Few have. Realistically, few people are going to read a 900-page group work of neofeudalist fanfic shit out by the most esoteric Fedsoc weirdos the world has ever seen.

But one person who did read Project 2025 was the leftist historian Rick Perlstein, who was the first person to really dig into what a fucking mess that thing is:

https://pluralistic.net/2024/07/14/fracture-lines/#disassembly-manual

Perlstein's excellent analysis doesn't claim that Project 2025's authors aren't sincere in their intentions to wreak great harm upon the nation and its people; rather, his point is that Project 2025 is filled with contradictory, mutually exclusive proposals written by people who fundamentally disagree with one another, and who each have enough power within the Trump coalition that all of their proposals have to be included in a document like this:

https://prospect.org/politics/2024-07-10-project-2025-republican-presidencies-tradition/

Project 2025 isn't just a guide to the masturbatory fantasies of the worst people in American politics – far more importantly, it is a detailed map of the fracture lines in the GOP coalition, the places where it is liable to split and shatter. This is an important point if you want to do more about Trumpism than run around feeling miserable and scared. If you want to fight, Project 2025 is a guide to the weak spots where an attack will do the most damage.

Perlstein's insight continues to be borne out as the Trump regime makes ready to take power. In a new story for KFF News, Stephanie Armour and Julie Rovner describe the irreconcilable differences among Trump's picks for the country's top public health authorities:

https://kffhealthnews.org/news/article/trump-rfk-kennedy-health-hhs-fda-cdc-vaccines-covid-weldon/

The brain-worm-infected-elephant in the room is, of course, RFK Jr, who has been announced as Trump's head of Health and Human Services. RFK Jr is a notorious antivaxer, chairman of Children’s Health Defense, a notorious anti-vaccine group. Kennedy's view is shared by Trump's chosen CDC boss, Dave Weldon, a physician who has repeated the dangerous lie that vaccinations cause autism. Mehmet "Dr Oz" Oz, the TV "physician" Trump wants to put in charge of Medicare/Medicaid, calls vaccines "oversold" and advocates for treating covid with hydroxychloroquine, another thoroughly debunked hoax:

https://www.usatoday.com/story/news/health/2024/12/17/hydroxychloroquine-study-covid-19-retracted-trump/77051671007/

However, other top Trump public health picks emphatically support vaccines. Marty Makary is Trump's choice for FDA commissioner; he's a Johns Hopkins trained surgeon who says vaccines "save lives" (but he peddles the lethal, unscientific hoax that childhood vaccines should be "spread out"). Jay Bhattacharya, the economist/MD whom Trump wants to put in charge of the NIH, supports vaccines (he is also one of the country's leading proponents of the eugenicist idea of accepting the mass death of elderly, sick and disabled people rather than imposing quarantines during epidemics). Then there's Janette Nesheiwat, whom Trump has asked to serve as the nation's surgeon general; she calls vaccines "a gift from God."

Like "Bidenism," Trumpism is a fragile coalition of people who thoroughly and irreconcilably disagree with one another. During the Biden administration, this resulted in self-inflicted injuries like appointing the brilliant trustbuster Lina Khan to run the FTC, but also appointing the pro-monopoly corporate lawyer Jacqueline Scott Corley to a lifetime seat as a federal judge, from which perch she ruled against Khan's no-brainer suit to block the Microsoft-Activision merger:

https://www.thebignewsletter.com/p/judge-rules-for-microsoft-mergers

The Trump coalition is even broader than the Biden coalition. That's how he won the 2024 election. But that also means that Trumpism is more fractious and off-balance, and hence will be easier to disrupt, because it is riven by people in senior positions who hate one another and are actively working for each others' political demise.

The Trump coalition is a coalition of cranks. I'm using "crank" here in a technical, non-pejorative sense. I am a crank, after all. A crank is someone who is overwhelmingly passionate about a single issue, whose uncrossable bright lines are not broadly shared. Cranks can be right or they can be wrong, but we're hard to be in coalition with, because we are uncompromisingly passionate about things that other people largely don't even notice, let alone care about. You can be a crank whose single issue is eliminating water fluoridation, even though this is very, very stupid and dangerous:

https://yourlocalepidemiologist.substack.com/p/the-fluoride-debate

Or you can be a crank about digital rights, a subject that, for decades, was viewed as by turns either unserious or as a sneaky way of shilling for Big Tech (thankfully, that's changing):

https://pluralistic.net/2024/06/18/greetings-fellow-pirates/#arrrrrrrrrr

Cranks make hard coalition partners. Trump's cranks are cranked up about different things – vaccines, culture war trans panics, eugenics – and are total normies about other things. The eugenicist MD/economist who wants to "let 'er rip" rather than engage in nonpharmaceutical pandemic interventions is gonna be horrified by total abortion bans and antivax. These cranks are on a collision course with one another.

This is on prominent display in these public health appointments, and we're very likely about to get a test of the cohesiveness and capability of the second Trump administration, thanks to bird flu. Now that bird flu has infected humans in multiple US states, there is every chance that we will have to confront a public health emergency in the coming weeks. If that happens, the Trump public health divisions over masking, quarantine and (especially) vaccines (Kennedy called the covid vaccine the "deadliest" ever made, without any evidence) will become the most important issue in the country, under constant and pitiless scrutiny, and criticism.

Trump's public health shambles is by no means unique. The lesson of Project 2025 is that the entire Trump project is one factional squabble away from collapse at all times.


Hey look at this (permalink)



A Wayback Machine banner.

This day in history (permalink)

#15yrsago Pope passes special Vatican copyright giving him exclusive right to use his name, title, image https://www.catholicnewsagency.com/news/18122/holy-see-declares-unique-copyright-on-papal-figure

#15yrsago Norwegian public broadcaster torrents 7-hour, hi-def trainride https://nrkbeta.no/2009/12/18/bergensbanen-eng/

#15yrsago Xmaspunk raygun https://www.flickr.com/photos/andrew_colunga/4201119099/

#15yrsago America can’t make things because managers all learn finance instead of production https://newrepublic.com/article/72035/wagoner-henderson

#10yrsago EFF’s copyfighter’s crossword https://www.eff.org/deeplinks/2014/12/crossword-puzzle-year-copyright-news

#10yrsago TX SWAT team beats, deafens nude man in his own home, lies about arrest; judge declines to punish cops or DA https://web.archive.org/web/20141224170549/http://www.myfoxhouston.com/story/27645689/ft-bend-police-prosecutors-accused-of-abuse-in-swat-incident

#10yrsago Outfit a game-designer’s toolkit for < $20 https://web.archive.org/web/20141222165215/http://iq212.com/iQ212Blog/2014/12/16/the-20-dollar-game-designers-tool-kit/

#10yrsago Telcos’ anti-Net Neutrality argument may let the MPAA destroy DNS https://www.techdirt.com/2014/12/18/mpaas-secret-war-net-neutrality-is-key-part-its-plan-to-block-sites/

#10yrsago Musical time-machine to Walt Disney World in the late 1970s https://passport2dreams.blogspot.com/2014/12/another-musical-souvenir-of-walt-disney.html

#10yrsago LISTEN: Wil Wheaton reads “Information Doesn’t Want to Be Free” https://ia600908.us.archive.org/24/items/idwtbf/Cory_Doctorow_-_Information_Doesnt_Want_to_Be_Free_Chapter_1_read_by_Wil_Wheaton.mp3

#10yrsago Kenya’s Parliament erupts into chaos as government rams through brutal “anti-terrorism” law https://www.standardmedia.co.ke/article/2000145159/chaos-disrupt-parliament-special-sitting-on-security-bill

#10yrsago Gingerbread Enterprise https://imgur.com/a/gingerbread-uss-enterprise-pvtYQ

#10yrsago NY DA gives unlicensed driver who killed senior in crosswalk a $400 fine https://nyc.streetsblog.org/2014/12/18/vance-deal-400-fine-for-unlicensed-driver-who-killed-senior-in-crosswalk

#10yrsago FCC seems to have lost hundreds of thousands of net neutrality comments https://www.reddit.com/r/technology/comments/2psxh9/the_fcc_ignored_hundreds_of_thousands_of_net/

#5yrsago Mass convictions of local warlords for 2009 massacre revive faith in Philippines’ justice system https://www.bbc.com/news/world-asia-50770644.amp

#5yrsago A vast network of shadowy news sites promote conservative talking points mixed with floods of algorithmically generated “news” https://www.cjr.org/tow_center_reports/hundreds-of-pink-slime-local-news-outlets-are-distributing-algorithmic-stories-conservative-talking-points.php

#5yrsago Volunteer “stick library” is a hit with neighborhood dogs https://metro.co.uk/2019/12/13/dad-creates-stick-library-dogs-11902209/?ito=article.tablet.share.top.messenger

#5yrsago Students at elite Shanghai university protest the removal of “freedom of thought” from the school charter https://asiatimes.com/2019/12/students-protest-at-shanghais-fudan-university/

#5yrsago NIST confirms that facial recognition is a racist, sexist dumpster-fire https://www.nist.gov/news-events/news/2019/12/nist-study-evaluates-effects-race-age-sex-face-recognition-software

#5yrsago Betsy DeVos quietly spends millions to promote the unpopular policies she hopes to enact as a federal official https://www.salon.com/2019/12/19/exclusive-betsy-devos-family-foundation-funnels-money-to-right-wing-groups-that-boost-her-agenda/

#5yrsago Bernie Sanders got the GAO to study the life chances of millennials, and the report concludes that debt is “crushing their dreams” https://www.teenvogue.com/story/bernie-sanders-report-millennial-living-standards

#5yrsago Doctors who take pharma industry freebies prescribe more of their benefactors’ drugs https://www.propublica.org/article/doctors-prescribe-more-of-a-drug-if-they-receive-money-from-a-pharma-company-tied-to-it#173787

#5yrsago New York Times analyzes a leaked set of location data from a private broker, sounds the alarm https://www.nytimes.com/interactive/2019/12/19/opinion/location-tracking-cell-phone.html

#5yrsago Americans should definitely be worried about the EU’s new copyright rules https://medium.com/berkman-klein-center/why-americans-should-worry-about-the-new-eu-copyright-rules-97800be3f8fc

#5yrsago Illinois schools don’t just lock special ed kids in solitary, they also restrain them https://www.propublica.org/article/illinois-school-restraints#173374>

#5yrsago Medicare for All would cut most Americans’ taxes, creating the biggest American take-home pay raise in a generation https://www.theguardian.com/commentisfree/2019/oct/25/medicare-for-all-taxes-saez-zucman

#5yrsago Codifying “Boomerspeak” and debating the ethics of poking fun at it https://www.wired.com/story/boomerspeak-enregisterment/

#5yrsago Alberta’s tax-funded climate denial “war room” ripped off its logo from a US tech company https://edmonton.ctvnews.ca/alberta-s-oil-and-gas-war-room-changing-logo-following-complaints-it-copied-u-s-data-company-1.4737423

#5yrsago My annual Daddy-Daughter Xmas Podcast: interview with an 11-year-old https://ia802801.us.archive.org/18/items/Cory_Doctorow_Podcast_320/Cory_Doctorow_Podcast_320_-_Christmas_2019_with_Poesy.mp3

#1yrago 2024's public domain is a banger https://pluralistic.net/2023/12/20/em-oh-you-ess-ee/#sexytimes

#1yrago What kind of bubble is AI? https://pluralistic.net/2023/12/19/bubblenomics/#pop


Upcoming appearances (permalink)

A photo of me onstage, giving a speech, holding a mic.



A screenshot of me at my desk, doing a livecast.

Recent appearances (permalink)



A grid of my books with Will Stahle covers..

Latest books (permalink)



A cardboard book box with the Macmillan logo.

Upcoming books (permalink)

  • Picks and Shovels: a sequel to "Red Team Blues," about the heroic era of the PC, Tor Books, February 2025

  • Enshittification: Why Everything Suddenly Got Worse and What to Do About It, Farrar, Straus, Giroux, October 2025

  • Unauthorized Bread: a middle-grades graphic novel adapted from my novella about refugees, toasters and DRM, FirstSecond, 2025



Colophon (permalink)

Today's top sources:

Currently writing:

  • Enshittification: a nonfiction book about platform decay for Farrar, Straus, Giroux. Status: second pass edit underway (readaloud)

  • A Little Brother short story about DIY insulin PLANNING

  • Picks and Shovels, a Martin Hench noir thriller about the heroic era of the PC. FORTHCOMING TOR BOOKS FEB 2025

Latest podcast: Daddy-Daughter Podcast 2024 https://craphound.com/overclocked/2024/12/17/daddy-daughter-podcast-2024/


This work – excluding any serialized fiction – is licensed under a Creative Commons Attribution 4.0 license. That means you can use it any way you like, including commercially, provided that you attribute it to me, Cory Doctorow, and include a link to pluralistic.net.

https://creativecommons.org/licenses/by/4.0/

Quotations and images are not included in this license; they are included either under a limitation or exception to copyright, or on the basis of a separate license. Please exercise caution.


How to get Pluralistic:

Blog (no ads, tracking, or data-collection):

Pluralistic.net

Newsletter (no ads, tracking, or data-collection):

https://pluralistic.net/plura-list

Mastodon (no ads, tracking, or data-collection):

https://mamot.fr/@pluralistic

Medium (no ads, paywalled):

https://doctorow.medium.com/

Twitter (mass-scale, unrestricted, third-party surveillance and advertising):

https://twitter.com/doctorow

Tumblr (mass-scale, unrestricted, third-party surveillance and advertising):

https://mostlysignssomeportents.tumblr.com/tagged/pluralistic

"When life gives you SARS, you make sarsaparilla" -Joey "Accordion Guy" DeVilla

Wed, 18 Dec 2024 18:39:00 +0000 Fullscreen Open in Tab
Pluralistic: Nurses whose shitty boss is a shitty app (17 Dec 2024)


Today's links



A nurse, pouring medicine out of a bottle; she is terrified because she is being held a gunpoint by a male figure whose head has been replaced with the staring eye of HAL 9000 from Kubrick's '2001: A Space Odyssey.' The background is a sepia-toned early 20th C wartime infirmary, crowded with wounded men. In the top left corner there is a subtle 'code waterfall' effect as seen in the credit sequences of the Wachowskis' 'Matrix' movies.

Nurses whose shitty boss is a shitty app (permalink)

Operating a business is risky: you can't ever be sure how many customers you'll have, or what they'll show up looking for. If you guess wrong, you'll either have too few workers to serve the crowd, or you'll pay workers to stand around and wait for customers. This is true even when your "business" is a "hospital."

Capitalists hate capitalism. Capitalism is defined by risk – like the risk of competitors poaching your customers and workers. Capitalists all secretly dream of a "command economy" in which other people have to arrange their affairs to suit the capitalists' preferences, taking the risk off their shoulders. Capitalists love anti-competitive exclusivity deals with suppliers, and they really love noncompete "agreements" that ban their workers from taking better jobs:

https://pluralistic.net/2023/04/21/bondage-fees/#doorman-building

One of the sleaziest, most common ways for capitalists to shed risk is by shifting it onto their workers' shoulders, for example, by sending workers home on slow days and refusing to pay them for the rest of their shifts. This is easy for capitalists to do because workers have a collective action problem: for workers to force their bosses not to do this, they all have to agree to go on strike, and other workers have to honor their picket-lines. That's a lot of chivvying and bargaining and group-forming, and it's very hard. Meanwhile, the only person the boss needs to convince to screw you this way is themself.

Libertarians will insist that this is impossible, of course, because workers will just quit and go work for someone else when this happens, and so bosses will be disciplined by the competition to find workers willing to put up with their bullshit. Of course, these same libertarians will tell you that it should be legal for your boss to require you to sign a noncompete "agreement" so you can't quit and get a job elsewhere in your field. They'll also tell you that we don't need antitrust enforcement to prevent your boss from buying up all the businesses you might work for if you do manage to quit.

In practice, the only way workers have successfully resisted being burdened with their bosses' risks is by a) forming a union, and then b) using the union to lobby for strong labor laws. Labor laws aren't a substitute for a union, but they are an important backstop, and of course, if you're not unionized, labor law is all you've got.

Enter the tech-bro, app in hand. The tech-bro's most absurd (and successful) ruse is "it's not a crime, I did it with an app." As in "it's not money-laundering, I did it with an app." Or "it's not a privacy violation, I did it with an app." Or "it's not securities fraud, I did it with an app." Or "it's not price-gouging, I did it with an app," or, importantly, "it's not a labor-law violation, I did it with an app."

The point of the "gig economy" is to use the "did it with an app" trick to avoid labor laws, so that bosses can shift risks onto workers, because capitalists hate capitalism. These apps were first used to immiserate taxi-drivers, and this was so successful that it spawned a whole universe of "Uber for __________" apps that took away labor rights from other kinds of workers, from dog-groomers to carpenters.

One group of workers whose rights are being devoured by gig-work apps is nurses, which is bad news, because without nurses, I would be dead by now.

A new report from the Roosevelt Institute goes deep on the way that nurses' lives are being destroyed by gig work apps that let bosses in America's wildly dysfunctional for-profit health care industry shift risk from bosses to the hardest-working group of health care professionals:

https://rooseveltinstitute.org/publications/uber-for-nursing/

The report's authors interviewed nurses who were employed through three apps: Shiftkey, Shiftmed and Carerev, and reveal a host of risk-shifting, worker-abusing practices that has nurses working for so little that they can't afford medical insurance themselves.

Take Shiftkey: nurses are required to log into Shiftkey and indicate which shifts they are available for, and if they are assigned any of those shifts later but can't take them, their app-based score declines and they risk not being offered shifts in the future. But Shiftkey doesn't guarantee that you'll get work on any of those shifts – in other words, nurses have to pledge not to take any work during the times when Shiftkey might need them, but they only get paid for those hours where Shiftkey calls them out. Nurses assume all the risk that there won't be enough demand for their services.

Each Shiftkey nurse is offered a different pay-scale for each shift. Apps use commercially available financial data – purchased on the cheap from the chaotic, unregulated data broker sector – to predict how desperate each nurse is. The less money you have in your bank accounts and the more you owe on your credit cards, the lower the wage the app will offer you. This is a classic example of what the legal scholar Veena Dubal calls "algorithmic wage discrimination" – a form of wage theft that's supposedly legal because it's done with an app:

https://pluralistic.net/2023/04/12/algorithmic-wage-discrimination/#fishers-of-men

Shiftkey workers also have to bid against one another for shifts, with the job going to the worker who accepts the lowest wage. Shiftkey pays nominal wages that sound reasonable – one nurse's topline rate is $23/hour. But by payday, Shiftkey has used junk fees to scrape that rate down to the bone. Workers have to pay a daily $3.67 "safety fee" to pay for background checks, drug screening, etc. Nevermind that these tasks are only performed once per nurse, not every day – and nevermind that this is another way to force workers to assume the boss's risks. Nurses also pay daily fees for accident insurance ($2.14) and malpractice insurance ($0.21) – more employer risk being shifted onto workers. Workers also pay $2 per shift if they want to get paid on the same day – a payday lending-style usury levied against workers whose wages are priced based on their desperation. Then there's a $6/shift fee nurses pay as a finders' fee to the app, a fee that's up to $7/shift next year. All told, that $23/hour rate cashes out to $13/hour.

On top of that, gig nurses have to pay for their own uniforms, licenses and equipment, including different colored scrubs and even shoes for each hospital. And because these nurses are "their own bosses" they have to deduct their own payroll taxes from that final figure. As "self-employed" workers, they aren't entitled to overtime or worker's comp, they get no retirement plan, health insurance, sick days or vacation.

The apps sell themselves to bosses as a way to get vetted, qualified nurses, but the entire vetting process is automated. Nurses upload a laundry list of documents related to their qualifications and undergo a background check, but are never interviewed by a human. They are assessed through automated means – for example, they have to run a location-tracking app en route to callouts and their reliability scores decline if they lose mobile data service while stuck in traffic.

Shiftmed docks nurses who cancel shifts after agreeing to take them, but bosses who cancel on nurses, even at the last minute, get away at most a small penalty (having to pay for the first two hours of a canceled shift), or, more often, nothing at all. For example, bosses who book nurses through the Carerev app can cancel without penalty on a mere two hours' notice. One nurse quoted in the study describes getting up at 5AM for a 7AM shift, only to discover that the shift was canceled while she slept, leaving her without any work or pay for the day, after having made arrangements for her kid to get childcare. The nurse assumes all the risk again: blocking out a day's work, paying for childcare, altering her sleep schedule. If she cancels on Carerev, her score goes down and she will get fewer shifts in the future. But if the boss cancels, he faces no consequences.

Carerev also lets bosses send nurses home early without paying them for the whole day – and they don't pay overtime if a nurse stays after her shift ends in order to ensure that their patients are cared for. The librarian scholar Fobazi Ettarh coined the term "vocational awe" to describe how workers in caring professions will endure abusive conditions and put in unpaid overtime because of their commitment to the patrons, patients, and pupils who depend on them:

https://www.inthelibrarywiththeleadpipe.org/2018/vocational-awe/

Many of the nurses in the study report having shifts canceled on them as they pull into the hospital parking lot. Needless to say, when your shift is canceled just as it was supposed to start, it's unlikely you'll be able to book a shift at another facility.

The American healthcare industry is dominated by monopolies. First came the pharma monopolies, when pharma companies merged and merged and merged, allowing them to screw hospitals with sky-high prices. Then the hospitals gobbled each other up, merging until most regions were dominated by one or two hospital chains, who could use buyer power to get a better deal on pharma prices – but also use seller power to screw the insurers with outrageous prices for care. So the insurers merged, too, until they could fight hospital price-gouging.

Everywhere you turn in the healthcare industry, you find another monopolist: pharmacists and pharmacy benefit managers, group purchasing organizations, medical beds, saline and supplies. Monopoly begets monopoly.

(Unitedhealthcare is extraordinary in that its divisions are among the most powerful players in all of these sectors, making it a monopolist among monopolists – for example, UHC is the nation's largest employer of physicians:)

https://www.thebignewsletter.com/p/its-time-to-break-up-big-medicine

But there are two key stakeholders in American health-care who can't monopolize: patients and health-care workers. We are the disorganized, loose, flapping ends at the beginning and end of the healthcare supply-chain. We are easy pickings for the monopolists in the middle, which is why patients pay more for worse care every year, and why healthcare workers get paid less for worse working conditions every year.

This is the one area where the Biden administration indisputably took action, bringing cases, making rules, and freaking out investment bankers and billionaires by repeatedly announcing that crimes were still crimes, even if you used an app to commit them.

The kind of treatment these apps mete out to nurses is illegal, app or no. In an important speech just last month, FTC commissioner Alvaro Bedoya explained how the FTC Act empowered the agency to shut down this kind of bossware because it is an "unfair and deceptive" form of competition:

https://pluralistic.net/2024/11/26/hawtch-hawtch/#you-treasure-what-you-measure

This is the kind of thing the FTC could be doing. Will Trump's FTC actually do it? The Trump campaign called the FTC "politicized" – but Trump's pick for the next FTC chair has vowed to politicize it even more:

https://theintercept.com/2024/12/18/trump-ftc-andrew-ferguson-ticket-fees/

Like Biden's FTC, Trump's FTC will have a target-rich environment if it wants to bring enforcement actions on behalf of workers. But Biden's trustbusters chose their targets by giving priority to the crooked companies that were doing the most harm to Americans, while Trump's trustbusters are more likely to give priority to the crooked companies that Trump personally dislikes:

https://pluralistic.net/2024/11/12/the-enemy-of-your-enemy/#is-your-enemy

So if one of these nursing apps pisses off Trump or one of his cronies, then yeah, maybe those nurses will get justice.

(Image: Cryteria, CC BY 3.0, modified)


Hey look at this (permalink)



A Wayback Machine banner.

This day in history (permalink)

#10yrsago A modest proposal for Wall Street’s future https://web.archive.org/web/20141215195720/http://www.bloombergview.com/articles/2014-12-15/michael-lewis-eight-things-i-wish-for-wall-street

#5yrsago From Enron to Saudi Arabia, from Rikers Island to ICE’s gulag, how McKinsey serves as “Capitalism’s Consigliere” https://theintercept.com/2019/12/18/capitalisms-consigliere-mckinseys-work-for-insurance-companies-ice-drug-manufacturers-and-despots/

#5yrsago A profile of Cliff “Cuckoo’s Egg” Stoll, a pioneering “hacker hunter” https://www.wired.com/story/meet-the-mad-scientist-who-wrote-the-book-on-how-to-hunt-hackers/

#5yrsago With 5G, 2019 reached peak bullshit https://www.lightreading.com/5g/2019-the-year-telecom-went-doolally-about-5g

#5yrsago Kentucky’s governor insisted that investment bankers could provide broadband. He was wrong https://www.propublica.org/article/there-are-kentuckians-who-still-dont-have-broadband-because-the-former-governor-chose-an-investment-bank-over-experts#173512

#1yrago Debbie Urbanski's 'After World' https://pluralistic.net/2023/12/18/storyworker-ad39-393a-7fbc/#digital-human-archive-project


Upcoming appearances (permalink)

A photo of me onstage, giving a speech, holding a mic.



A screenshot of me at my desk, doing a livecast.

Recent appearances (permalink)



A grid of my books with Will Stahle covers..

Latest books (permalink)



A cardboard book box with the Macmillan logo.

Upcoming books (permalink)

  • Picks and Shovels: a sequel to "Red Team Blues," about the heroic era of the PC, Tor Books, February 2025

  • Enshittification: Why Everything Suddenly Got Worse and What to Do About It, Farrar, Straus, Giroux, October 2025

  • Unauthorized Bread: a middle-grades graphic novel adapted from my novella about refugees, toasters and DRM, FirstSecond, 2025



Colophon (permalink)

Today's top sources:

Currently writing:

  • Enshittification: a nonfiction book about platform decay for Farrar, Straus, Giroux. Status: second pass edit underway (readaloud)

  • A Little Brother short story about DIY insulin PLANNING

  • Picks and Shovels, a Martin Hench noir thriller about the heroic era of the PC. FORTHCOMING TOR BOOKS FEB 2025

Latest podcast: Daddy-Daughter Podcast 2024 https://craphound.com/overclocked/2024/12/17/daddy-daughter-podcast-2024/


This work – excluding any serialized fiction – is licensed under a Creative Commons Attribution 4.0 license. That means you can use it any way you like, including commercially, provided that you attribute it to me, Cory Doctorow, and include a link to pluralistic.net.

https://creativecommons.org/licenses/by/4.0/

Quotations and images are not included in this license; they are included either under a limitation or exception to copyright, or on the basis of a separate license. Please exercise caution.


How to get Pluralistic:

Blog (no ads, tracking, or data-collection):

Pluralistic.net

Newsletter (no ads, tracking, or data-collection):

https://pluralistic.net/plura-list

Mastodon (no ads, tracking, or data-collection):

https://mamot.fr/@pluralistic

Medium (no ads, paywalled):

https://doctorow.medium.com/

Twitter (mass-scale, unrestricted, third-party surveillance and advertising):

https://twitter.com/doctorow

Tumblr (mass-scale, unrestricted, third-party surveillance and advertising):

https://mostlysignssomeportents.tumblr.com/tagged/pluralistic

"When life gives you SARS, you make sarsaparilla" -Joey "Accordion Guy" DeVilla

2024-12-12T09:28:22+00:00 Fullscreen Open in Tab
"Rules" that terminal programs follow

Recently I’ve been thinking about how everything that happens in the terminal is some combination of:

  1. Your operating system’s job
  2. Your shell’s job
  3. Your terminal emulator’s job
  4. The job of whatever program you happen to be running (like top or vim or cat)

The first three (your operating system, shell, and terminal emulator) are all kind of known quantities – if you’re using bash in GNOME Terminal on Linux, you can more or less reason about how how all of those things interact, and some of their behaviour is standardized by POSIX.

But the fourth one (“whatever program you happen to be running”) feels like it could do ANYTHING. How are you supposed to know how a program is going to behave?

This post is kind of long so here’s a quick table of contents:

programs behave surprisingly consistently

As far as I know, there are no real standards for how programs in the terminal should behave – the closest things I know of are:

  • POSIX, which mostly dictates how your terminal emulator / OS / shell should work together. I think it does specify a few things about how core utilities like cp should work but AFAIK it doesn’t have anything to say about how for example htop should behave.
  • these command line interface guidelines

But even though there are no standards, in my experience programs in the terminal behave in a pretty consistent way. So I wanted to write down a list of “rules” that in my experience programs mostly follow.

these are meant to be descriptive, not prescriptive

My goal here isn’t to convince authors of terminal programs that they should follow any of these rules. There are lots of exceptions to these and often there’s a good reason for those exceptions.

But it’s very useful for me to know what behaviour to expect from a random new terminal program that I’m using. Instead of “uh, programs could do literally anything”, it’s “ok, here are the basic rules I expect, and then I can keep a short mental list of exceptions”.

So I’m just writing down what I’ve observed about how programs behave in my 20 years of using the terminal, why I think they behave that way, and some examples of cases where that rule is “broken”.

it’s not always obvious which “rules” are the program’s responsibility to implement

There are a bunch of common conventions that I think are pretty clearly the program’s responsibility to implement, like:

  • config files should go in ~/.BLAHrc or ~/.config/BLAH/FILE or /etc/BLAH/ or something
  • --help should print help text
  • programs should print “regular” output to stdout and errors to stderr

But in this post I’m going to focus on things that it’s not 100% obvious are the program’s responsibility. For example it feels to me like a “law of nature” that pressing Ctrl-D should quit a REPL, but programs often need to explicitly implement support for it – even though cat doesn’t need to implement Ctrl-D support, ipython does. (more about that in “rule 3” below)

Understanding which things are the program’s responsibility makes it much less surprising when different programs’ implementations are slightly different.

rule 1: noninteractive programs should quit when you press Ctrl-C

The main reason for this rule is that noninteractive programs will quit by default on Ctrl-C if they don’t set up a SIGINT signal handler, so this is kind of a “you should act like the default” rule.

Something that trips a lot of people up is that this doesn’t apply to interactive programs like python3 or bc or less. This is because in an interactive program, Ctrl-C has a different job – if the program is running an operation (like for example a search in less or some Python code in python3), then Ctrl-C will interrupt that operation but not stop the program.

As an example of how this works in an interactive program: here’s the code in prompt-toolkit (the library that iPython uses for handling input) that aborts a search when you press Ctrl-C.

rule 2: TUIs should quit when you press q

TUI programs (like less or htop) will usually quit when you press q.

This rule doesn’t apply to any program where pressing q to quit wouldn’t make sense, like tmux or text editors.

rule 3: REPLs should quit when you press Ctrl-D on an empty line

REPLs (like python3 or ed) will usually quit when you press Ctrl-D on an empty line. This rule is similar to the Ctrl-C rule – the reason for this is that by default if you’re running a program (like cat) in “cooked mode”, then the operating system will return an EOF when you press Ctrl-D on an empty line.

Most of the REPLs I use (sqlite3, python3, fish, bash, etc) don’t actually use cooked mode, but they all implement this keyboard shortcut anyway to mimic the default behaviour.

For example, here’s the code in prompt-toolkit that quits when you press Ctrl-D, and here’s the same code in readline.

I actually thought that this one was a “Law of Terminal Physics” until very recently because I’ve basically never seen it broken, but you can see that it’s just something that each individual input library has to implement in the links above.

Someone pointed out that the Erlang REPL does not quit when you press Ctrl-D, so I guess not every REPL follows this “rule”.

rule 4: don’t use more than 16 colours

Terminal programs rarely use colours other than the base 16 ANSI colours. This is because if you specify colours with a hex code, it’s very likely to clash with some users’ background colour. For example if I print out some text as #EEEEEE, it would be almost invisible on a white background, though it would look fine on a dark background.

But if you stick to the default 16 base colours, you have a much better chance that the user has configured those colours in their terminal emulator so that they work reasonably well with their background color. Another reason to stick to the default base 16 colours is that it makes less assumptions about what colours the terminal emulator supports.

The only programs I usually see breaking this “rule” are text editors, for example Helix by default will use a purple background which is not a default ANSI colour. It seems fine for Helix to break this rule since Helix isn’t a “core” program and I assume any Helix user who doesn’t like that colorscheme will just change the theme.

rule 5: vaguely support readline keybindings

Almost every program I use supports readline keybindings if it would make sense to do so. For example, here are a bunch of different programs and a link to where they define Ctrl-E to go to the end of the line:

None of those programs actually uses readline directly, they just sort of mimic emacs/readline keybindings. They don’t always mimic them exactly: for example atuin seems to use Ctrl-A as a prefix, so Ctrl-A doesn’t go to the beginning of the line.

Also all of these programs seem to implement their own internal cut and paste buffers so you can delete a line with Ctrl-U and then paste it with Ctrl-Y.

The exceptions to this are:

  • some programs (like git, cat, and nc) don’t have any line editing support at all (except for backspace, Ctrl-W, and Ctrl-U)
  • as usual text editors are an exception, every text editor has its own approach to editing text

I wrote more about this “what keybindings does a program support?” question in entering text in the terminal is complicated.

rule 5.1: Ctrl-W should delete the last word

I’ve never seen a program (other than a text editor) where Ctrl-W doesn’t delete the last word. This is similar to the Ctrl-C rule – by default if a program is in “cooked mode”, the OS will delete the last word if you press Ctrl-W, and delete the whole line if you press Ctrl-U. So usually programs will imitate that behaviour.

I can’t think of any exceptions to this other than text editors but if there are I’d love to hear about them!

rule 6: disable colours when writing to a pipe

Most programs will disable colours when writing to a pipe. For example:

  • rg blah will highlight all occurrences of blah in the output, but if the output is to a pipe or a file, it’ll turn off the highlighting.
  • ls --color=auto will use colour when writing to a terminal, but not when writing to a pipe

Both of those programs will also format their output differently when writing to the terminal: ls will organize files into columns, and ripgrep will group matches with headings.

If you want to force the program to use colour (for example because you want to look at the colour), you can use unbuffer to force the program’s output to be a tty like this:

unbuffer rg blah |  less -R

I’m sure that there are some programs that “break” this rule but I can’t think of any examples right now. Some programs have an --color flag that you can use to force colour to be on, in the example above you could also do rg --color=always | less -R.

rule 7: - means stdin/stdout

Usually if you pass - to a program instead of a filename, it’ll read from stdin or write to stdout (whichever is appropriate). For example, if you want to format the Python code that’s on your clipboard with black and then copy it, you could run:

pbpaste | black - | pbcopy

(pbpaste is a Mac program, you can do something similar on Linux with xclip)

My impression is that most programs implement this if it would make sense and I can’t think of any exceptions right now, but I’m sure there are many exceptions.

these “rules” take a long time to learn

These rules took me a long time for me to learn because I had to:

  1. learn that the rule applied anywhere at all ("Ctrl-C will exit programs")
  2. notice some exceptions (“okay, Ctrl-C will exit find but not less”)
  3. subconsciously figure out what the pattern is ("Ctrl-C will generally quit noninteractive programs, but in interactive programs it might interrupt the current operation instead of quitting the program")
  4. eventually maybe formulate it into an explicit rule that I know

A lot of my understanding of the terminal is honestly still in the “subconscious pattern recognition” stage. The only reason I’ve been taking the time to make things explicit at all is because I’ve been trying to explain how it works to others. Hopefully writing down these “rules” explicitly will make learning some of this stuff a little bit faster for others.

2024-11-29T08:23:31+00:00 Fullscreen Open in Tab
Why pipes sometimes get "stuck": buffering

Here’s a niche terminal problem that has bothered me for years but that I never really understood until a few weeks ago. Let’s say you’re running this command to watch for some specific output in a log file:

tail -f /some/log/file | grep thing1 | grep thing2

If log lines are being added to the file relatively slowly, the result I’d see is… nothing! It doesn’t matter if there were matches in the log file or not, there just wouldn’t be any output.

I internalized this as “uh, I guess pipes just get stuck sometimes and don’t show me the output, that’s weird”, and I’d handle it by just running grep thing1 /some/log/file | grep thing2 instead, which would work.

So as I’ve been doing a terminal deep dive over the last few months I was really excited to finally learn exactly why this happens.

why this happens: buffering

The reason why “pipes get stuck” sometimes is that it’s VERY common for programs to buffer their output before writing it to a pipe or file. So the pipe is working fine, the problem is that the program never even wrote the data to the pipe!

This is for performance reasons: writing all output immediately as soon as you can uses more system calls, so it’s more efficient to save up data until you have 8KB or so of data to write (or until the program exits) and THEN write it to the pipe.

In this example:

tail -f /some/log/file | grep thing1 | grep thing2

the problem is that grep thing1 is saving up all of its matches until it has 8KB of data to write, which might literally never happen.

programs don’t buffer when writing to a terminal

Part of why I found this so disorienting is that tail -f file | grep thing will work totally fine, but then when you add the second grep, it stops working!! The reason for this is that the way grep handles buffering depends on whether it’s writing to a terminal or not.

Here’s how grep (and many other programs) decides to buffer its output:

  • Check if stdout is a terminal or not using the isatty function
    • If it’s a terminal, use line buffering (print every line immediately as soon as you have it)
    • Otherwise, use “block buffering” – only print data if you have at least 8KB or so of data to print

So if grep is writing directly to your terminal then you’ll see the line as soon as it’s printed, but if it’s writing to a pipe, you won’t.

Of course the buffer size isn’t always 8KB for every program, it depends on the implementation. For grep the buffering is handled by libc, and libc’s buffer size is defined in the BUFSIZ variable. Here’s where that’s defined in glibc.

(as an aside: “programs do not use 8KB output buffers when writing to a terminal” isn’t, like, a law of terminal physics, a program COULD use an 8KB buffer when writing output to a terminal if it wanted, it would just be extremely weird if it did that, I can’t think of any program that behaves that way)

commands that buffer & commands that don’t

One annoying thing about this buffering behaviour is that you kind of need to remember which commands buffer their output when writing to a pipe.

Some commands that don’t buffer their output:

  • tail
  • cat
  • tee

I think almost everything else will buffer output, especially if it’s a command where you’re likely to be using it for batch processing. Here’s a list of some common commands that buffer their output when writing to a pipe, along with the flag that disables block buffering.

  • grep (--line-buffered)
  • sed (-u)
  • awk (there’s a fflush() function)
  • tcpdump (-l)
  • jq (-u)
  • tr (-u)
  • cut (can’t disable buffering)

Those are all the ones I can think of, lots of unix commands (like sort) may or may not buffer their output but it doesn’t matter because sort can’t do anything until it finishes receiving input anyway.

Also I did my best to test both the Mac OS and GNU versions of these but there are a lot of variations and I might have made some mistakes.

programming languages where the default “print” statement buffers

Also, here are a few programming language where the default print statement will buffer output when writing to a pipe, and some ways to disable buffering if you want:

  • C (disable with setvbuf)
  • Python (disable with python -u, or PYTHONUNBUFFERED=1, or sys.stdout.reconfigure(line_buffering=False), or print(x, flush=True))
  • Ruby (disable with STDOUT.sync = true)
  • Perl (disable with $| = 1)

I assume that these languages are designed this way so that the default print function will be fast when you’re doing batch processing.

Also whether output is buffered or not might depend on how you print, for example in C++ cout << "hello\n" buffers when writing to a pipe but cout << "hello" << endl will flush its output.

when you press Ctrl-C on a pipe, the contents of the buffer are lost

Let’s say you’re running this command as a hacky way to watch for DNS requests to example.com, and you forgot to pass -l to tcpdump:

sudo tcpdump -ni any port 53 | grep example.com

When you press Ctrl-C, what happens? In a magical perfect world, what I would want to happen is for tcpdump to flush its buffer, grep would search for example.com, and I would see all the output I missed.

But in the real world, what happens is that all the programs get killed and the output in tcpdump’s buffer is lost.

I think this problem is probably unavoidable – I spent a little time with strace to see how this works and grep receives the SIGINT before tcpdump anyway so even if tcpdump tried to flush its buffer grep would already be dead.

After a little more investigation, there is a workaround: if you find tcpdump’s PID and kill -TERM $PID, then tcpdump will flush the buffer so you can see the output. That’s kind of a pain but I tested it and it seems to work.

redirecting to a file also buffers

It’s not just pipes, this will also buffer:

sudo tcpdump -ni any port 53 > output.txt

Redirecting to a file doesn’t have the same “Ctrl-C will totally destroy the contents of the buffer” problem though – in my experience it usually behaves more like you’d want, where the contents of the buffer get written to the file before the program exits. I’m not 100% sure whether this is something you can always rely on or not.

a bunch of potential ways to avoid buffering

Okay, let’s talk solutions. Let’s say you’ve run this command or s

tail -f /some/log/file | grep thing1 | grep thing2

I asked people on Mastodon how they would solve this in practice and there were 5 basic approaches. Here they are:

solution 1: run a program that finishes quickly

Historically my solution to this has been to just avoid the “command writing to pipe slowly” situation completely and instead run a program that will finish quickly like this:

cat /some/log/file | grep thing1 | grep thing2 | tail

This doesn’t do the same thing as the original command but it does mean that you get to avoid thinking about these weird buffering issues.

(you could also do grep thing1 /some/log/file but I often prefer to use an “unnecessary” cat)

solution 2: remember the “line buffer” flag to grep

You could remember that grep has a flag to avoid buffering and pass it like this:

tail -f /some/log/file | grep --line-buffered thing1 | grep thing2

solution 3: use awk

Some people said that if they’re specifically dealing with a multiple greps situation, they’ll rewrite it to use a single awk instead, like this:

tail -f /some/log/file |  awk '/thing1/ && /thing2/'

Or you would write a more complicated grep, like this:

tail -f /some/log/file |  grep -E 'thing1.*thing2'

(awk also buffers, so for this to work you’ll want awk to be the last command in the pipeline)

solution 4: use stdbuf

stdbuf uses LD_PRELOAD to turn off libc’s buffering, and you can use it to turn off output buffering like this:

tail -f /some/log/file | stdbuf -o0 grep thing1 | grep thing2

Like any LD_PRELOAD solution it’s a bit unreliable – it doesn’t work on static binaries, I think won’t work if the program isn’t using libc’s buffering, and doesn’t always work on Mac OS. Harry Marr has a really nice How stdbuf works post.

solution 5: use unbuffer

unbuffer program will force the program’s output to be a TTY, which means that it’ll behave the way it normally would on a TTY (less buffering, colour output, etc). You could use it in this example like this:

tail -f /some/log/file | unbuffer grep thing1 | grep thing2

Unlike stdbuf it will always work, though it might have unwanted side effects, for example grep thing1’s will also colour matches.

If you want to install unbuffer, it’s in the expect package.

that’s all the solutions I know about!

It’s a bit hard for me to say which one is “best”, I think personally I’m mostly likely to use unbuffer because I know it’s always going to work.

If I learn about more solutions I’ll try to add them to this post.

I’m not really sure how often this comes up

I think it’s not very common for me to have a program that slowly trickles data into a pipe like this, normally if I’m using a pipe a bunch of data gets written very quickly, processed by everything in the pipeline, and then everything exits. The only examples I can come up with right now are:

  • tcpdump
  • tail -f
  • watching log files in a different way like with kubectl logs
  • the output of a slow computation

what if there were an environment variable to disable buffering?

I think it would be cool if there were a standard environment variable to turn off buffering, like PYTHONUNBUFFERED in Python. I got this idea from a couple of blog posts by Mark Dominus in 2018. Maybe NO_BUFFER like NO_COLOR?

The design seems tricky to get right; Mark points out that NETBSD has environment variables called STDBUF, STDBUF1, etc which gives you a ton of control over buffering but I imagine most developers don’t want to implement many different environment variables to handle a relatively minor edge case.

I’m also curious about whether there are any programs that just automatically flush their output buffers after some period of time (like 1 second). It feels like it would be nice in theory but I can’t think of any program that does that so I imagine there are some downsides.

stuff I left out

Some things I didn’t talk about in this post since these posts have been getting pretty long recently and seriously does anyone REALLY want to read 3000 words about buffering?

  • the difference between line buffering and having totally unbuffered output
  • how buffering to stderr is different from buffering to stdout
  • this post is only about buffering that happens inside the program, your operating system’s TTY driver also does a little bit of buffering sometimes
  • other reasons you might need to flush your output other than “you’re writing to a pipe”
2024-11-18T09:35:42+00:00 Fullscreen Open in Tab
Importing a frontend Javascript library without a build system

I like writing Javascript without a build system and for the millionth time yesterday I ran into a problem where I needed to figure out how to import a Javascript library in my code without using a build system, and it took FOREVER to figure out how to import it because the library’s setup instructions assume that you’re using a build system.

Luckily at this point I’ve mostly learned how to navigate this situation and either successfully use the library or decide it’s too difficult and switch to a different library, so here’s the guide I wish I had to importing Javascript libraries years ago.

I’m only going to talk about using Javacript libraries on the frontend, and only about how to use them in a no-build-system setup.

In this post I’m going to talk about:

  1. the three main types of Javascript files a library might provide (ES Modules, the “classic” global variable kind, and CommonJS)
  2. how to figure out which types of files a Javascript library includes in its build
  3. ways to import each type of file in your code

the three kinds of Javascript files

There are 3 basic types of Javascript files a library can provide:

  1. the “classic” type of file that defines a global variable. This is the kind of file that you can just <script src> and it’ll Just Work. Great if you can get it but not always available
  2. an ES module (which may or may not depend on other files, we’ll get to that)
  3. a “CommonJS” module. This is for Node, you can’t use it in a browser at all without using a build system.

I’m not sure if there’s a better name for the “classic” type but I’m just going to call it “classic”. Also there’s a type called “AMD” but I’m not sure how relevant it is in 2024.

Now that we know the 3 types of files, let’s talk about how to figure out which of these the library actually provides!

where to find the files: the NPM build

Every Javascript library has a build which it uploads to NPM. You might be thinking (like I did originally) – Julia! The whole POINT is that we’re not using Node to build our library! Why are we talking about NPM?

But if you’re using a link from a CDN like https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.4.1/chart.umd.min.js, you’re still using the NPM build! All the files on the CDNs originally come from NPM.

Because of this, I sometimes like to npm install the library even if I’m not planning to use Node to build my library at all – I’ll just create a new temp folder, npm install there, and then delete it when I’m done. I like being able to poke around in the files in the NPM build on my filesystem, because then I can be 100% sure that I’m seeing everything that the library is making available in its build and that the CDN isn’t hiding something from me.

So let’s npm install a few libraries and try to figure out what types of Javascript files they provide in their builds!

example library 1: chart.js

First let’s look inside Chart.js, a plotting library.

$ cd /tmp/whatever
$ npm install chart.js
$ cd node_modules/chart.js/dist
$ ls *.*js
chart.cjs  chart.js  chart.umd.js  helpers.cjs  helpers.js

This library seems to have 3 basic options:

option 1: chart.cjs. The .cjs suffix tells me that this is a CommonJS file, for using in Node. This means it’s impossible to use it directly in the browser without some kind of build step.

option 2:chart.js. The .js suffix by itself doesn’t tell us what kind of file it is, but if I open it up, I see import '@kurkle/color'; which is an immediate sign that this is an ES module – the import ... syntax is ES module syntax.

option 3: chart.umd.js. “UMD” stands for “Universal Module Definition”, which I think means that you can use this file either with a basic <script src>, CommonJS, or some third thing called AMD that I don’t understand.

how to use a UMD file

When I was using Chart.js I picked Option 3. I just needed to add this to my code:

<script src="./chart.umd.js"> </script>

and then I could use the library with the global Chart environment variable. Couldn’t be easier. I just copied chart.umd.js into my Git repository so that I didn’t have to worry about using NPM or the CDNs going down or anything.

the build files aren’t always in the dist directory

A lot of libraries will put their build in the dist directory, but not always! The build files’ location is specified in the library’s package.json.

For example here’s an excerpt from Chart.js’s package.json.

  "jsdelivr": "./dist/chart.umd.js",
  "unpkg": "./dist/chart.umd.js",
  "main": "./dist/chart.cjs",
  "module": "./dist/chart.js",

I think this is saying that if you want to use an ES Module (module) you should use dist/chart.js, but the jsDelivr and unpkg CDNs should use ./dist/chart.umd.js. I guess main is for Node.

chart.js’s package.json also says "type": "module", which according to this documentation tells Node to treat files as ES modules by default. I think it doesn’t tell us specifically which files are ES modules and which ones aren’t but it does tell us that something in there is an ES module.

example library 2: @atcute/oauth-browser-client

@atcute/oauth-browser-client is a library for logging into Bluesky with OAuth in the browser.

Let’s see what kinds of Javascript files it provides in its build!

$ npm install @atcute/oauth-browser-client
$ cd node_modules/@atcute/oauth-browser-client/dist
$ ls *js
constants.js  dpop.js  environment.js  errors.js  index.js  resolvers.js

It seems like the only plausible root file in here is index.js, which looks something like this:

export { configureOAuth } from './environment.js';
export * from './errors.js';
export * from './resolvers.js';

This export syntax means it’s an ES module. That means we can use it in the browser without a build step! Let’s see how to do that.

how to use an ES module with importmaps

Using an ES module isn’t an easy as just adding a <script src="whatever.js">. Instead, if the ES module has dependencies (like @atcute/oauth-browser-client does) the steps are:

  1. Set up an import map in your HTML
  2. Put import statements like import { configureOAuth } from '@atcute/oauth-browser-client'; in your JS code
  3. Include your JS code in your HTML liek this: <script type="module" src="YOURSCRIPT.js"></script>

The reason we need an import map instead of just doing something like import { BrowserOAuthClient } from "./oauth-client-browser.js" is that internally the module has more import statements like import {something} from @atcute/client, and we need to tell the browser where to get the code for @atcute/client and all of its other dependencies.

Here’s what the importmap I used looks like for @atcute/oauth-browser-client:

<script type="importmap">
{
  "imports": {
    "nanoid": "./node_modules/nanoid/bin/dist/index.js",
    "nanoid/non-secure": "./node_modules/nanoid/non-secure/index.js",
    "nanoid/url-alphabet": "./node_modules/nanoid/url-alphabet/dist/index.js",
    "@atcute/oauth-browser-client": "./node_modules/@atcute/oauth-browser-client/dist/index.js",
    "@atcute/client": "./node_modules/@atcute/client/dist/index.js",
    "@atcute/client/utils/did": "./node_modules/@atcute/client/dist/utils/did.js"
  }
}
</script>

Getting these import maps to work is pretty fiddly, I feel like there must be a tool to generate them automatically but I haven’t found one yet. It’s definitely possible to write a script that automatically generates the importmaps using esbuild’s metafile but I haven’t done that and maybe there’s a better way.

I decided to set up importmaps yesterday to get github.com/jvns/bsky-oauth-example to work, so there’s some example code in that repo.

Also someone pointed me to Simon Willison’s download-esm, which will download an ES module and rewrite the imports to point to the JS files directly so that you don’t need importmaps. I haven’t tried it yet but it seems like a great idea.

problems with importmaps: too many files

I did run into some problems with using importmaps in the browser though – it needed to download dozens of Javascript files to load my site, and my webserver in development couldn’t keep up for some reason. I kept seeing files fail to load randomly and then had to reload the page and hope that they would succeed this time.

It wasn’t an issue anymore when I deployed my site to production, so I guess it was a problem with my local dev environment.

Also one slightly annoying thing about ES modules in general is that you need to be running a webserver to use them, I’m sure this is for a good reason but it’s easier when you can just open your index.html file without starting a webserver.

Because of the “too many files” thing I think actually using ES modules with importmaps in this way isn’t actually that appealing to me, but it’s good to know it’s possible.

how to use an ES module without importmaps

If the ES module doesn’t have dependencies then it’s even easier – you don’t need the importmaps! You can just:

  • put <script type="module" src="YOURCODE.js"></script> in your HTML. The type="module" is important.
  • put import {whatever} from "https://example.com/whatever.js" in YOURCODE.js

alternative: use esbuild

If you don’t want to use importmaps, you can also use a build system like esbuild. I talked about how to do that in Some notes on using esbuild, but this blog post is about ways to avoid build systems completely so I’m not going to talk about that option here. I do still like esbuild though and I think it’s a good option in this case.

what’s the browser support for importmaps?

CanIUse says that importmaps are in “Baseline 2023: newly available across major browsers” so my sense is that in 2024 that’s still maybe a little bit too new? I think I would use importmaps for some fun experimental code that I only wanted like myself and 12 people to use, but if I wanted my code to be more widely usable I’d use esbuild instead.

example library 3: @atproto/oauth-client-browser

Let’s look at one final example library! This is a different Bluesky auth library than @atcute/oauth-browser-client.

$ npm install @atproto/oauth-client-browser
$ cd node_modules/@atproto/oauth-client-browser/dist
$ ls *js
browser-oauth-client.js  browser-oauth-database.js  browser-runtime-implementation.js  errors.js  index.js  indexed-db-store.js  util.js

Again, it seems like only real candidate file here is index.js. But this is a different situation from the previous example library! Let’s take a look at index.js:

There’s a bunch of stuff like this in index.js:

__exportStar(require("@atproto/oauth-client"), exports);
__exportStar(require("./browser-oauth-client.js"), exports);
__exportStar(require("./errors.js"), exports);
var util_js_1 = require("./util.js");

This require() syntax is CommonJS syntax, which means that we can’t use this file in the browser at all, we need to use some kind of build step, and ESBuild won’t work either.

Also in this library’s package.json it says "type": "commonjs" which is another way to tell it’s CommonJS.

how to use a CommonJS module with esm.sh

Originally I thought it was impossible to use CommonJS modules without learning a build system, but then someone Bluesky told me about esm.sh! It’s a CDN that will translate anything into an ES Module. skypack.dev does something similar, I’m not sure what the difference is but one person mentioned that if one doesn’t work sometimes they’ll try the other one.

For @atproto/oauth-client-browser using it seems pretty simple, I just need to put this in my HTML:

<script type="module" src="script.js"> </script>

and then put this in script.js.

import { BrowserOAuthClient } from "https://esm.sh/@atproto/oauth-client-browser@0.3.0"

It seems to Just Work, which is cool! Of course this is still sort of using a build system – it’s just that esm.sh is running the build instead of me. My main concerns with this approach are:

  • I don’t really trust CDNs to keep working forever – usually I like to copy dependencies into my repository so that they don’t go away for some reason in the future.
  • I’ve heard of some issues with CDNs having security compromises which scares me. Also I don’t
  • I don’t really understand what esm.sh is doing and

esbuild can also convert CommonJS modules into ES modules

I also learned that you can also use esbuild to convert a CommonJS module into an ES module, though there are some limitations – the import { BrowserOAuthClient } from syntax doesn’t work. Here’s a github issue about that.

I think the esbuild approach is probably more appealing to me than the esm.sh approach because it’s a tool that I already have on my computer so I trust it more. I haven’t experimented with this much yet though.

summary of the three types of files

Here’s a summary of the three types of JS files you might encounter, options for how to use them, and how to identify them.

Unhelpfully a .js or .min.js file extension could be any of these 3 options, so if the file is something.js you need to do more detective work to figure out what you’re dealing with.

  1. “classic” JS files
    • How to use it:: <script src="whatever.js"></script>
    • Ways to identify it:
      • The website has a big friendly banner in its setup instructions saying “Use this with a CDN!” or something
      • A .umd.js extension
      • Just try to put it in a <script src=... tag and see if it works
  2. ES Modules
    • Ways to use it:
      • If there are no dependencies, just import {whatever} from "./my-module.js" directly in your code
      • If there are dependencies, create an importmap and import {whatever} from "my-module"
      • Use esbuild or any ES Module bundler
    • Ways to identify it:
      • Look for an import or export statement. (not module.exports = ..., that’s CommonJS)
      • An .mjs extension
      • maybe "type": "module" in package.json (though it’s not clear to me which file exactly this refers to)
  3. CommonJS Modules
    • Ways to use it:
      • Use https://esm.sh to convert it into an ES module, like https://esm.sh/@atproto/oauth-client-browser@0.3.0
      • Use a build somehow (??)
    • Ways to identify it:
      • Look for require() or module.exports = ... in the code
      • A .cjs extension
      • maybe "type": "commonjs" in package.json (though it’s not clear to me which file exactly this refers to)

it’s really nice to have ES modules standardized

The main difference between CommonJS modules and ES modules from my perspective is that ES modules are actually a standard. This makes me feel a lot more confident using them, because browsers commit to backwards compatibility for web standards forever – if I write some code using ES modules today, I can feel sure that it’ll still work the same way in 15 years.

It also makes me feel better about using tooling like esbuild because even if the esbuild project dies, because it’s implementing a standard it feels likely that there will be another similar tool in the future that I can replace it with.

the JS community has built a lot of very cool tools

A lot of the time when I talk about this stuff I get responses like “I hate javascript!!! it’s the worst!!!”. But my experience is that there are a lot of great tools for Javascript (I just learned about https://esm.sh yesterday which seems great! I love esbuild!), and that if I take the time to learn how things works I can take advantage of some of those tools and make my life a lot easier.

So the goal of this post is definitely not to complain about Javascript, it’s to understand the landscape so I can use the tooling in a way that feels good to me.

questions I still have

Here are some questions I still have, I’ll add the answers into the post if I learn the answer.

  • Is there a tool that automatically generates importmaps for an ES Module that I have set up locally? (apparently yes: jspm)
  • How can I convert a CommonJS module into an ES module on my computer, the way https://esm.sh does? (apparently esbuild can sort of do this, though named exports don’t work)
  • When people normally build CommonJS modules into regular JS code, what’s code is doing that? Obviously there are tools like webpack, rollup, esbuild, etc, but do those tools all implement their own JS parsers/static analysis? How many JS parsers are there out there?
  • Is there any way to bundle an ES module into a single file (like atcute-client.js), but so that in the browser I can still import multiple different paths from that file (like both @atcute/client/lexicons and @atcute/client)?

all the tools

Here’s a list of every tool we talked about in this post:

Writing this post has made me think that even though I usually don’t want to have a build that I run every time I update the project, I might be willing to have a build step (using download-esm or something) that I run only once when setting up the project and never run again except maybe if I’m updating my dependency versions.

that’s all!

Thanks to Marco Rogers who taught me a lot of the things in this post. I’ve probably made some mistakes in this post and I’d love to know what they are – let me know on Bluesky or Mastodon!

2024-11-09T09:24:29+00:00 Fullscreen Open in Tab
New microblog with TILs

I added a new section to this site a couple weeks ago called TIL (“today I learned”).

the goal: save interesting tools & facts I posted on social media

One kind of thing I like to post on Mastodon/Bluesky is “hey, here’s a cool thing”, like the great SQLite repl litecli, or the fact that cross compiling in Go Just Works and it’s amazing, or cryptographic right answers, or this great diff tool. Usually I don’t want to write a whole blog post about those things because I really don’t have much more to say than “hey this is useful!”

It started to bother me that I didn’t have anywhere to put those things: for example recently I wanted to use diffdiff and I just could not remember what it was called.

the solution: make a new section of this blog

So I quickly made a new folder called /til/, added some custom styling (I wanted to style the posts to look a little bit like a tweet), made a little Rake task to help me create new posts quickly (rake new_til), and set up a separate RSS Feed for it.

I think this new section of the blog might be more for myself than anything, now when I forget the link to Cryptographic Right Answers I can hopefully look it up on the TIL page. (you might think “julia, why not use bookmarks??” but I have been failing to use bookmarks for my whole life and I don’t see that changing ever, putting things in public is for whatever reason much easier for me)

So far it’s been working, often I can actually just make a quick post in 2 minutes which was the goal.

inspired by Simon Willison’s TIL blog

My page is inspired by Simon Willison’s great TIL blog, though my TIL posts are a lot shorter.

I don’t necessarily want everything to be archived

This came about because I spent a lot of time on Twitter, so I’ve been thinking about what I want to do about all of my tweets.

I keep reading the advice to “POSSE” (“post on your own site, syndicate elsewhere”), and while I find the idea appealing in principle, for me part of the appeal of social media is that it’s a little bit ephemeral. I can post polls or questions or observations or jokes and then they can just kind of fade away as they become less relevant.

I find it a lot easier to identify specific categories of things that I actually want to have on a Real Website That I Own:

and then let everything else be kind of ephemeral.

I really believe in the advice to make email lists though – the first two (blog posts & comics) both have email lists and RSS feeds that people can subscribe to if they want. I might add a quick summary of any TIL posts from that week to the “blog posts from this week” mailing list.

2024-11-04T09:18:03+00:00 Fullscreen Open in Tab
My IETF 121 Agenda

Here's where you can find me at IETF 121 in Dublin!

Monday

Tuesday

  • 9:30 - 11:30 • oauth
  • 13:00 - 14:30 • spice
  • 16:30 - 17:30 • scim

Thursday

Get in Touch

My Current Drafts

2024-10-31T08:00:10+00:00 Fullscreen Open in Tab
ASCII control characters in my terminal

Hello! I’ve been thinking about the terminal a lot and yesterday I got curious about all these “control codes”, like Ctrl-A, Ctrl-C, Ctrl-W, etc. What’s the deal with all of them?

a table of ASCII control characters

Here’s a table of all 33 ASCII control characters, and what they do on my machine (on Mac OS), more or less. There are about a million caveats, but I’ll talk about what it means and all the problems with this diagram that I know about.

You can also view it as an HTML page (I just made it an image so it would show up in RSS).

different kinds of codes are mixed together

The first surprising thing about this diagram to me is that there are 33 control codes, split into (very roughly speaking) these categories:

  1. Codes that are handled by the operating system’s terminal driver, for example when the OS sees a 3 (Ctrl-C), it’ll send a SIGINT signal to the current program
  2. Everything else is passed through to the application as-is and the application can do whatever it wants with them. Some subcategories of those:
    • Codes that correspond to a literal keypress of a key on your keyboard (Enter, Tab, Backspace). For example when you press Enter, your terminal gets sent 13.
    • Codes used by readline: “the application can do whatever it wants” often means “it’ll do more or less what the readline library does, whether the application actually uses readline or not”, so I’ve labelled a bunch of the codes that readline uses
    • Other codes, for example I think Ctrl-X has no standard meaning in the terminal in general but emacs uses it very heavily

There’s no real structure to which codes are in which categories, they’re all just kind of randomly scattered because this evolved organically.

(If you’re curious about readline, I wrote more about readline in entering text in the terminal is complicated, and there are a lot of cheat sheets out there)

there are only 33 control codes

Something else that I find a little surprising is that are only 33 control codes – A to Z, plus 7 more (@, [, \, ], ^, _, ?). This means that if you want to have for example Ctrl-1 as a keyboard shortcut in a terminal application, that’s not really meaningful – on my machine at least Ctrl-1 is exactly the same thing as just pressing 1, Ctrl-3 is the same as Ctrl-[, etc.

Also Ctrl+Shift+C isn’t a control code – what it does depends on your terminal emulator. On Linux Ctrl-Shift-X is often used by the terminal emulator to copy or open a new tab or paste for example, it’s not sent to the TTY at all.

Also I use Ctrl+Left Arrow all the time, but that isn’t a control code, instead it sends an ANSI escape sequence (ctrl-[[1;5D) which is a different thing which we absolutely do not have space for in this post.

This “there are only 33 codes” thing is totally different from how keyboard shortcuts work in a GUI where you can have Ctrl+KEY for any key you want.

the official ASCII names aren’t very meaningful to me

Each of these 33 control codes has a name in ASCII (for example 3 is ETX). When all of these control codes were originally defined, they weren’t being used for computers or terminals at all, they were used for the telegraph machine. Telegraph machines aren’t the same as UNIX terminals so a lot of the codes were repurposed to mean something else.

Personally I don’t find these ASCII names very useful, because 50% of the time the name in ASCII has no actual relationship to what that code does on UNIX systems today. So it feels easier to just ignore the ASCII names completely instead of trying to figure which ones still match their original meaning.

It’s hard to use Ctrl-M as a keyboard shortcut

Another thing that’s a bit weird is that Ctrl-M is literally the same as Enter, and Ctrl-I is the same as Tab, which makes it hard to use those two as keyboard shortcuts.

From some quick research, it seems like some folks do still use Ctrl-I and Ctrl-M as keyboard shortcuts (here’s an example), but to do that you need to configure your terminal emulator to treat them differently than the default.

For me the main takeaway is that if I ever write a terminal application I should avoid Ctrl-I and Ctrl-M as keyboard shortcuts in it.

how to identify what control codes get sent

While writing this I needed to do a bunch of experimenting to digure out what various key combinations did, so I wrote this Python script echo-key.py that will print them out.

There’s probably a more official way but I appreciated having a script I could customize.

caveat: on canonical vs noncanonical mode

Two of these codes (Ctrl-W and Ctrl-U) are labelled in the table as “handled by the OS”, but actually they’re not always handled by the OS, it depends on whether the terminal is in “canonical” mode or in “noncanonical mode”.

In canonical mode, programs only get input when you press Enter (and the OS is in charge of deleting characters when you press Backspace or Ctrl-W). But in noncanonical mode the program gets input immediately when you press a key, and the Ctrl-W and Ctrl-U codes are passed through to the program to handle any way it wants.

Generally in noncanonical mode the program will handle Ctrl-W and Ctrl-U similarly to how the OS does, but there are some small differences.

Some examples of programs that use canonical mode:

  • probably pretty much any noninteractive program, like grep or cat
  • git, I think

Examples of programs that use noncanonical mode:

  • python3, irb and other REPLs
  • your shell
  • any full screen TUI like less or vim

caveat: all of the “OS terminal driver” codes are configurable with stty

I said that Ctrl-C sends SIGINT but technically this is not necessarily true, if you really want to you can remap all of the codes labelled “OS terminal driver”, plus Backspace, using a tool called stty, and you can view the mappings with stty -a.

Here are the mappings on my machine right now:

$ stty -a
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
	eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
	min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
	stop = ^S; susp = ^Z; time = 0; werase = ^W;

I have personally never remapped any of these and I cannot imagine a reason I would (I think it would be a recipe for confusion and disaster for me), but I asked on Mastodon and people said the most common reasons they used stty were:

  • fix a broken terminal with stty sane
  • set stty erase ^H to change how Backspace works
  • set stty ixoff
  • some people even map SIGINT to a different key, like their DELETE key

caveat: on signals

Two signals caveats:

  1. If the ISIG terminal mode is turned off, then the OS won’t send signals. For example vim turns off ISIG
  2. Apparently on BSDs, there’s an extra control code (Ctrl-T) which sends SIGINFO

You can see which terminal modes a program is setting using strace like this, terminal modes are set with the ioctl system call:

$ strace -tt -o out  vim
$ grep ioctl out | grep SET

here are the modes vim sets when it starts (ISIG and ICANON are missing!):

17:43:36.670636 ioctl(0, TCSETS, {c_iflag=IXANY|IMAXBEL|IUTF8,
c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST, c_cflag=B38400|CS8|CREAD,
c_lflag=ECHOK|ECHOCTL|ECHOKE|PENDIN, ...}) = 0

and it resets the modes when it exits:

17:43:38.027284 ioctl(0, TCSETS, {c_iflag=ICRNL|IXANY|IMAXBEL|IUTF8,
c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD,
c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE|PENDIN, ...}) = 0

I think the specific combination of modes vim is using here might be called “raw mode”, man cfmakeraw talks about that.

there are a lot of conflicts

Related to “there are only 33 codes”, there are a lot of conflicts where different parts of the system want to use the same code for different things, for example by default Ctrl-S will freeze your screen, but if you turn that off then readline will use Ctrl-S to do a forward search.

Another example is that on my machine sometimes Ctrl-T will send SIGINFO and sometimes it’ll transpose 2 characters and sometimes it’ll do something completely different depending on:

  • whether the program has ISIG set
  • whether the program uses readline / imitates readline’s behaviour

caveat: on “backspace” and “other backspace”

In this diagram I’ve labelled code 127 as “backspace” and 8 as “other backspace”. Uh, what?

I think this was the single biggest topic of discussion in the replies on Mastodon – apparently there’s a LOT of history to this and I’d never heard of any of it before.

First, here’s how it works on my machine:

  1. I press the Backspace key
  2. The TTY gets sent the byte 127, which is called DEL in ASCII
  3. the OS terminal driver and readline both have 127 mapped to “backspace” (so it works both in canonical mode and noncanonical mode)
  4. The previous character gets deleted

If I press Ctrl+H, it has the same effect as Backspace if I’m using readline, but in a program without readline support (like cat for instance), it just prints out ^H.

Apparently Step 2 above is different for some folks – their Backspace key sends the byte 8 instead of 127, and so if they want Backspace to work then they need to configure the OS (using stty) to set erase = ^H.

There’s an incredible section of the Debian Policy Manual on keyboard configuration that describes how Delete and Backspace should work according to Debian policy, which seems very similar to how it works on my Mac today. My understanding (via this mastodon post) is that this policy was written in the 90s because there was a lot of confusion about what Backspace should do in the 90s and there needed to be a standard to get everything to work.

There’s a bunch more historical terminal stuff here but that’s all I’ll say for now.

there’s probably a lot more diversity in how this works

I’ve probably missed a bunch more ways that “how it works on my machine” might be different from how it works on other people’s machines, and I’ve probably made some mistakes about how it works on my machine too. But that’s all I’ve got for today.

Some more stuff I know that I’ve left out: according to stty -a Ctrl-O is “discard”, Ctrl-R is “reprint”, and Ctrl-Y is “dsusp”. I have no idea how to make those actually do anything (pressing them does not do anything obvious, and some people have told me what they used to do historically but it’s not clear to me if they have a use in 2024), and a lot of the time in practice they seem to just be passed through to the application anyway so I just labelled Ctrl-R and Ctrl-Y as readline.

not all of this is that useful to know

Also I want to say that I think the contents of this post are kind of interesting but I don’t think they’re necessarily that useful. I’ve used the terminal pretty successfully every day for the last 20 years without knowing literally any of this – I just knew what Ctrl-C, Ctrl-D, Ctrl-Z, Ctrl-R, Ctrl-L did in practice (plus maybe Ctrl-A, Ctrl-E and Ctrl-W) and did not worry about the details for the most part, and that was almost always totally fine except when I was trying to use xterm.js.

But I had fun learning about it so maybe it’ll be interesting to you too.

2024-10-27T07:47:04+00:00 Fullscreen Open in Tab
Using less memory to look up IP addresses in Mess With DNS

I’ve been having problems for the last 3 years or so where Mess With DNS periodically runs out of memory and gets OOM killed.

This hasn’t been a big priority for me: usually it just goes down for a few minutes while it restarts, and it only happens once a day at most, so I’ve just been ignoring. But last week it started actually causing a problem so I decided to look into it.

This was kind of winding road where I learned a lot so here’s a table of contents:

there’s about 100MB of memory available

I run Mess With DNS on a VM without about 465MB of RAM, which according to ps aux (the RSS column) is split up something like:

  • 100MB for PowerDNS
  • 200MB for Mess With DNS
  • 40MB for hallpass

That leaves about 110MB of memory free.

A while back I set GOMEMLIMIT to 250MB to try to make sure the garbage collector ran if Mess With DNS used more than 250MB of memory, and I think this helped but it didn’t solve everything.

the problem: OOM killing the backup script

A few weeks ago I started backing up Mess With DNS’s database for the first time using restic.

This has been working okay, but since Mess With DNS operates without much extra memory I think restic sometimes needed more memory than was available on the system, and so the backup script sometimes got OOM killed.

This was a problem because

  1. backups might be corrupted sometimes
  2. more importantly, restic takes out a lock when it runs, and so I’d have to manually do an unlock if I wanted the backups to continue working. Doing manual work like this is the #1 thing I try to avoid with all my web services (who has time for that!) so I really wanted to do something about it.

There’s probably more than one solution to this, but I decided to try to make Mess With DNS use less memory so that there was more available memory on the system, mostly because it seemed like a fun problem to try to solve.

what’s using memory: IP addresses

I’d run a memory profile of Mess With DNS a bunch of times in the past, so I knew exactly what was using most of Mess With DNS’s memory: IP addresses.

When it starts, Mess With DNS loads this database where you can look up the ASN of every IP address into memory, so that when it receives a DNS query it can take the source IP address like 74.125.16.248 and tell you that IP address belongs to GOOGLE.

This database by itself used about 117MB of memory, and a simple du told me that was too much – the original text files were only 37MB!

$ du -sh *.tsv
26M	ip2asn-v4.tsv
11M	ip2asn-v6.tsv

The way it worked originally is that I had an array of these:

type IPRange struct {
	StartIP net.IP
	EndIP   net.IP
	Num     int
	Name    string
	Country string
}

and I searched through it with a binary search to figure out if any of the ranges contained the IP I was looking for. Basically the simplest possible thing and it’s super fast, my machine can do about 9 million lookups per second.

attempt 1: use SQLite

I’ve been using SQLite recently, so my first thought was – maybe I can store all of this data on disk in an SQLite database, give the tables an index, and that’ll use less memory.

So I:

  • wrote a quick Python script using sqlite-utils to import the TSV files into an SQLite database
  • adjusted my code to select from the database instead

This did solve the initial memory goal (after a GC it now hardly used any memory at all because the table was on disk!), though I’m not sure how much GC churn this solution would cause if we needed to do a lot of queries at once. I did a quick memory profile and it seemed to allocate about 1KB of memory per lookup.

Let’s talk about the issues I ran into with using SQLite though.

problem: how to store IPv6 addresses

SQLite doesn’t have support for big integers and IPv6 addresses are 128 bits, so I decided to store them as text. I think BLOB might have been better, I originally thought BLOBs couldn’t be compared but the sqlite docs say they can.

I ended up with this schema:

CREATE TABLE ipv4_ranges (
   start_ip INTEGER NOT NULL,
   end_ip INTEGER NOT NULL,
   asn INTEGER NOT NULL,
   country TEXT NOT NULL,
   name TEXT NOT NULL
);
CREATE TABLE ipv6_ranges (
   start_ip TEXT NOT NULL,
   end_ip TEXT NOT NULL,
   asn INTEGER,
   country TEXT,
   name TEXT
);
CREATE INDEX idx_ipv4_ranges_start_ip ON ipv4_ranges (start_ip);
CREATE INDEX idx_ipv6_ranges_start_ip ON ipv6_ranges (start_ip);
CREATE INDEX idx_ipv4_ranges_end_ip ON ipv4_ranges (end_ip);
CREATE INDEX idx_ipv6_ranges_end_ip ON ipv6_ranges (end_ip);

Also I learned that Python has an ipaddress module, so I could use ipaddress.ip_address(s).exploded to make sure that the IPv6 addresses were expanded so that a string comparison would compare them properly.

problem: it’s 500x slower

I ran a quick microbenchmark, something like this. It printed out that it could look up 17,000 IPv6 addresses per second, and similarly for IPv4 addresses.

This was pretty discouraging – being able to look up 17k addresses per section is kind of fine (Mess With DNS does not get a lot of traffic), but I compared it to the original binary search code and the original code could do 9 million per second.

	ips := []net.IP{}
	count := 20000
	for i := 0; i < count; i++ {
		// create a random IPv6 address
		bytes := randomBytes()
		ip := net.IP(bytes[:])
		ips = append(ips, ip)
	}
	now := time.Now()
	success := 0
	for _, ip := range ips {
		_, err := ranges.FindASN(ip)
		if err == nil {
			success++
		}
	}
	fmt.Println(success)
	elapsed := time.Since(now)
	fmt.Println("number per second", float64(count)/elapsed.Seconds())

time for EXPLAIN QUERY PLAN

I’d never really done an EXPLAIN in sqlite, so I thought it would be a fun opportunity to see what the query plan was doing.

sqlite> explain query plan select * from ipv6_ranges where '2607:f8b0:4006:0824:0000:0000:0000:200e' BETWEEN start_ip and end_ip;
QUERY PLAN
`--SEARCH ipv6_ranges USING INDEX idx_ipv6_ranges_end_ip (end_ip>?)

It looks like it’s just using the end_ip index and not the start_ip index, so maybe it makes sense that it’s slower than the binary search.

I tried to figure out if there was a way to make SQLite use both indexes, but I couldn’t find one and maybe it knows best anyway.

At this point I gave up on the SQLite solution, I didn’t love that it was slower and also it’s a lot more complex than just doing a binary search. I felt like I’d rather keep something much more similar to the binary search.

A few things I tried with SQLite that did not cause it to use both indexes:

  • using a compound index instead of two separate indexes
  • running ANALYZE
  • using INTERSECT to intersect the results of start_ip < ? and ? < end_ip. This did make it use both indexes, but it also seemed to make the query literally 1000x slower, probably because it needed to create the results of both subqueries in memory and intersect them.

attempt 2: use a trie

My next idea was to use a trie, because I had some vague idea that maybe a trie would use less memory, and I found this library called ipaddress-go that lets you look up IP addresses using a trie.

I tried using it here’s the code, but I think I was doing something wildly wrong because, compared to my naive array + binary search:

  • it used WAY more memory (800MB to store just the IPv4 addresses)
  • it was a lot slower to do the lookups (it could do only 100K/second instead of 9 million/second)

I’m not really sure what went wrong here but I gave up on this approach and decided to just try to make my array use less memory and stick to a simple binary search.

some notes on memory profiling

One thing I learned about memory profiling is that you can use runtime package to see how much memory is currently allocated in the program. That’s how I got all the memory numbers in this post. Here’s the code:

func memusage() {
	runtime.GC()
	var m runtime.MemStats
	runtime.ReadMemStats(&m)
	fmt.Printf("Alloc = %v MiB\n", m.Alloc/1024/1024)
	// write mem.prof
	f, err := os.Create("mem.prof")
	if err != nil {
		log.Fatal(err)
	}
	pprof.WriteHeapProfile(f)
	f.Close()
}

Also I learned that if you use pprof to analyze a heap profile there are two ways to analyze it: you can pass either --alloc-space or --inuse-space to go tool pprof. I don’t know how I didn’t realize this before but alloc-space will tell you about everything that was allocated, and inuse-space will just include memory that’s currently in use.

Anyway I ran go tool pprof -pdf --inuse_space mem.prof > mem.pdf a lot. Also every time I use pprof I find myself referring to my own intro to pprof, it’s probably the blog post I wrote that I use the most often. I should add --alloc-space and --inuse-space to it.

attempt 3: make my array use less memory

I was storing my ip2asn entries like this:

type IPRange struct {
	StartIP net.IP
	EndIP   net.IP
	Num     int
	Name    string
	Country string
}

I had 3 ideas for ways to improve this:

  1. There was a lot of repetition of Name and the Country, because a lot of IP ranges belong to the same ASN
  2. net.IP is an []byte under the hood, which felt like it involved an unnecessary pointer, was there a way to inline it into the struct?
  3. Maybe I didn’t need both the start IP and the end IP, often the ranges were consecutive so maybe I could rearrange things so that I only had the start IP

idea 3.1: deduplicate the Name and Country

I figured I could store the ASN info in an array, and then just store the index into the array in my IPRange struct. Here are the structs so you can see what I mean:

type IPRange struct {
	StartIP netip.Addr
	EndIP   netip.Addr
	ASN     uint32
	Idx     uint32
}

type ASNInfo struct {
	Country string
	Name    string
}

type ASNPool struct {
	asns   []ASNInfo
	lookup map[ASNInfo]uint32
}

This worked! It brought memory usage from 117MB to 65MB – a 50MB savings. I felt good about this.

Here’s all of the code for that part.

how big are ASNs?

As an aside – I’m storing the ASN in a uint32, is that right? I looked in the ip2asn file and the biggest one seems to be 401307, though there are a few lines that say 4294901931 which is much bigger, but also are just inside the range of a uint32. So I can definitely use a uint32.

59.101.179.0	59.101.179.255	4294901931	Unknown	AS4294901931

idea 3.2: use netip.Addr instead of net.IP

It turns out that I’m not the only one who felt that net.IP was using an unnecessary amount of memory – in 2021 the folks at Tailscale released a new IP address library for Go which solves this and many other issues. They wrote a great blog post about it.

I discovered (to my delight) that not only does this new IP address library exist and do exactly what I want, it’s also now in the Go standard library as netip.Addr. Switching to netip.Addr was very easy and saved another 20MB of memory, bringing us to 46MB.

I didn’t try my third idea (remove the end IP from the struct) because I’d already been programming for long enough on a Saturday morning and I was happy with my progress.

It’s always such a great feeling when I think “hey, I don’t like this, there must be a better way” and then immediately discover that someone has already made the exact thing I want, thought about it a lot more than me, and implemented it much better than I would have.

all of this was messier in real life

Even though I tried to explain this in a simple linear way “I tried X, then I tried Y, then I tried Z”, that’s kind of a lie – I always try to take my actual debugging process (total chaos) and make it seem more linear and understandable because the reality is just too annoying to write down. It’s more like:

  • try sqlite
  • try a trie
  • second guess everything that I concluded about sqlite, go back and look at the results again
  • wait what about indexes
  • very very belatedly realize that I can use runtime to check how much memory everything is using, start doing that
  • look at the trie again, maybe I misunderstood everything
  • give up and go back to binary search
  • look at all of the numbers for tries/sqlite again to make sure I didn’t misunderstand

A note on using 512MB of memory

Someone asked why I don’t just give the VM more memory. I could very easily afford to pay for a VM with 1GB of memory, but I feel like 512MB really should be enough (and really that 256MB should be enough!) so I’d rather stay inside that constraint. It’s kind of a fun puzzle.

a few ideas from the replies

Folks had a lot of good ideas I hadn’t thought of. Recording them as inspiration if I feel like having another Fun Performance Day at some point.

  • Try Go’s unique package for the ASNPool. Someone tried this and it uses more memory, probably because Go’s pointers are 64 bits
  • Try compiling with GOARCH=386 to use 32-bit pointers to sace space (maybe in combination with using unique!)
  • It should be possible to store all of the IPv6 addresses in just 64 bits, because only the first 64 bits of the address are public
  • Interpolation search might be faster than binary search since IP addresses are numeric
  • Try the MaxMind db format with mmdbwriter or mmdbctl
  • Tailscale’s art routing table package

the result: saved 70MB of memory!

I deployed the new version and now Mess With DNS is using less memory! Hooray!

A few other notes:

  • lookups are a little slower – in my microbenchmark they went from 9 million lookups/second to 6 million, maybe because I added a little indirection. Using less memory and a little more CPU seemed like a good tradeoff though.
  • it’s still using more memory than the raw text files do (46MB vs 37MB), I guess pointers take up space and that’s okay.

I’m honestly not sure if this will solve all my memory problems, probably not! But I had fun, I learned a few things about SQLite, I still don’t know what to think about tries, and it made me love binary search even more than I already did.

2024-10-07T09:19:57+00:00 Fullscreen Open in Tab
Some notes on upgrading Hugo

Warning: this is a post about very boring yakshaving, probably only of interest to people who are trying to upgrade Hugo from a very old version to a new version. But what are blogs for if not documenting one’s very boring yakshaves from time to time?

So yesterday I decided to try to upgrade Hugo. There’s no real reason to do this – I’ve been using Hugo version 0.40 to generate this blog since 2018, it works fine, and I don’t have any problems with it. But I thought – maybe it won’t be as hard as I think, and I kind of like a tedious computer task sometimes!

I thought I’d document what I learned along the way in case it’s useful to anyone else doing this very specific migration. I upgraded from Hugo v0.40 (from 2018) to v0.135 (from 2024).

Here are most of the changes I had to make:

change 1: template "theme/partials/thing.html is now partial thing.html

I had to replace a bunch of instances of {{ template "theme/partials/header.html" . }} with {{ partial "header.html" . }}.

This happened in v0.42:

We have now virtualized the filesystems for project and theme files. This makes everything simpler, faster and more powerful. But it also means that template lookups on the form {{ template “theme/partials/pagination.html” . }} will not work anymore. That syntax has never been documented, so it’s not expected to be in wide use.

change 2: .Data.Pages is now site.RegularPages

This seems to be discussed in the release notes for 0.57.2

I just needed to replace .Data.Pages with site.RegularPages in the template on the homepage as well as in my RSS feed template.

change 3: .Next and .Prev got flipped

I had this comment in the part of my theme where I link to the next/previous blog post:

“next” and “previous” in hugo apparently mean the opposite of what I’d think they’d mean intuitively. I’d expect “next” to mean “in the future” and “previous” to mean “in the past” but it’s the opposite

It looks they changed this in ad705aac064 so that “next” actually is in the future and “prev” actually is in the past. I definitely find the new behaviour more intuitive.

downloading the Hugo changelogs with a script

Figuring out why/when all of these changes happened was a little difficult. I ended up hacking together a bash script to download all of the changelogs from github as text files, which I could then grep to try to figure out what happened. It turns out it’s pretty easy to get all of the changelogs from the GitHub API.

So far everything was not so bad – there was also a change around taxonomies that’s I can’t quite explain, but it was all pretty manageable, but then we got to the really tough one: the markdown renderer.

change 4: the markdown renderer (blackfriday -> goldmark)

The blackfriday markdown renderer (which was previously the default) was removed in v0.100.0. This seems pretty reasonable:

It has been deprecated for a long time, its v1 version is not maintained anymore, and there are many known issues. Goldmark should be a mature replacement by now.

Fixing all my Markdown changes was a huge pain – I ended up having to update 80 different Markdown files (out of 700) so that they would render properly, and I’m not totally sure

why bother switching renderers?

The obvious question here is – why bother even trying to upgrade Hugo at all if I have to switch Markdown renderers? My old site was running totally fine and I think it wasn’t necessarily a good use of time, but the one reason I think it might be useful in the future is that the new renderer (goldmark) uses the CommonMark markdown standard, which I’m hoping will be somewhat more futureproof. So maybe I won’t have to go through this again? We’ll see.

Also it turned out that the new Goldmark renderer does fix some problems I had (but didn’t know that I had) with smart quotes and how lists/blockquotes interact.

finding all the Markdown problems: the process

The hard part of this Markdown change was even figuring out what changed. Almost all of the problems (including #2 and #3 above) just silently broke the site, they didn’t cause any errors or anything. So I had to diff the HTML to hunt them down.

Here’s what I ended up doing:

  1. Generate the site with the old version, put it in public_old
  2. Generate the new version, put it in public
  3. Diff every single HTML file in public/ and public_old with this diff.sh script and put the results in a diffs/ folder
  4. Run variations on find diffs -type f | xargs cat | grep -C 5 '(31m|32m)' | less -r over and over again to look at every single change until I found something that seemed wrong
  5. Update the Markdown to fix the problem
  6. Repeat until everything seemed okay

(the grep 31m|32m thing is searching for red/green text in the diff)

This was very time consuming but it was a little bit fun for some reason so I kept doing it until it seemed like nothing too horrible was left.

the new markdown rules

Here’s a list of every type of Markdown change I had to make. It’s very possible these are all extremely specific to me but it took me a long time to figure them all out so maybe this will be helpful to one other person who finds this in the future.

4.1: mixing HTML and markdown

This doesn’t work anymore (it doesn’t expand the link):

<small>
[a link](https://example.com)
</small>

I need to do this instead:

<small>

[a link](https://example.com)

</small>

This works too:

<small> [a link](https://example.com) </small>

4.2: << is changed into «

I didn’t want this so I needed to configure:

markup:
  goldmark:
    extensions:
      typographer:
        leftAngleQuote: '&lt;&lt;'
        rightAngleQuote: '&gt;&gt;'

4.3: nested lists sometimes need 4 space indents

This doesn’t render as a nested list anymore if I only indent by 2 spaces, I need to put 4 spaces.

1. a
  * b
  * c
2. b

The problem is that the amount of indent needed depends on the size of the list markers. Here’s a reference in CommonMark for this.

4.4: blockquotes inside lists work better

Previously the > quote here didn’t render as a blockquote, and with the new renderer it does.

* something
> quote
* something else

I found a bunch of Markdown that had been kind of broken (which I hadn’t noticed) that works better with the new renderer, and this is an example of that.

Lists inside blockquotes also seem to work better.

4.5: headings inside lists

Previously this didn’t render as a heading, but now it does. So I needed to replace the # with &num;.

* # passengers: 20

4.6: + or 1) at the beginning of the line makes it a list

I had something which looked like this:

`1 / (1
+ exp(-1)) = 0.73`

With Blackfriday it rendered like this:

<p><code>1 / (1
+ exp(-1)) = 0.73</code></p>

and with Goldmark it rendered like this:

<p>`1 / (1</p>
<ul>
<li>exp(-1)) = 0.73`</li>
</ul>

Same thing if there was an accidental 1) at the beginning of a line, like in this Markdown snippet

I set up a small Hadoop cluster (1 master, 2 workers, replication set to 
1) on 

To fix this I just had to rewrap the line so that the + wasn’t the first character.

The Markdown is formatted this way because I wrap my Markdown to 80 characters a lot and the wrapping isn’t very context sensitive.

4.7: no more smart quotes in code blocks

There were a bunch of places where the old renderer (Blackfriday) was doing unwanted things in code blocks like replacing ... with or replacing quotes with smart quotes. I hadn’t realized this was happening and I was very happy to have it fixed.

4.8: better quote management

The way this gets rendered got better:

"Oh, *interesting*!"
  • old: “Oh, interesting!“
  • new: “Oh, interesting!”

Before there were two left smart quotes, now the quotes match.

4.9: images are no longer wrapped in a p tag

Previously if I had an image like this:

<img src="https://jvns.ca/images/rustboot1.png">

it would get wrapped in a <p> tag, now it doesn’t anymore. I dealt with this just by adding a margin-bottom: 0.75em to images in the CSS, hopefully that’ll make them display well enough.

4.10: <br> is now wrapped in a p tag

Previously this wouldn’t get wrapped in a p tag, but now it seems to:

<br><br>

I just gave up on fixing this though and resigned myself to maybe having some extra space in some cases. Maybe I’ll try to fix it later if I feel like another yakshave.

4.11: some more goldmark settings

I also needed to

  • turn off code highlighting (because it wasn’t working properly and I didn’t have it before anyway)
  • use the old “blackfriday” method to generate heading IDs so they didn’t change
  • allow raw HTML in my markdown

Here’s what I needed to add to my config.yaml to do all that:

markup:
  highlight:
    codeFences: false
  goldmark:
    renderer:
      unsafe: true
    parser:
      autoHeadingIDType: blackfriday

Maybe I’ll try to get syntax highlighting working one day, who knows. I might prefer having it off though.

a little script to compare blackfriday and goldmark

I also wrote a little program to compare the Blackfriday and Goldmark output for various markdown snippets, here it is in a gist.

It’s not really configured the exact same way Blackfriday and Goldmark were in my Hugo versions, but it was still helpful to have to help me understand what was going on.

a quick note on maintaining themes

My approach to themes in Hugo has been:

  1. pay someone to make a nice design for the site (for example wizardzines.com was designed by Melody Starling)
  2. use a totally custom theme
  3. commit that theme to the same Github repo as the site

So I just need to edit the theme files to fix any problems. Also I wrote a lot of the theme myself so I’m pretty familiar with how it works.

Relying on someone else to keep a theme updated feels kind of scary to me, I think if I were using a third-party theme I’d just copy the code into my site’s github repo and then maintain it myself.

which static site generators have better backwards compatibility?

I asked on Mastodon if anyone had used a static site generator with good backwards compatibility.

The main answers seemed to be Jekyll and 11ty. Several people said they’d been using Jekyll for 10 years without any issues, and 11ty says it has stability as a core goal.

I think a big factor in how appealing Jekyll/11ty are is how easy it is for you to maintain a working Ruby / Node environment on your computer: part of the reason I stopped using Jekyll was that I got tired of having to maintain a working Ruby installation. But I imagine this wouldn’t be a problem for a Ruby or Node developer.

Several people said that they don’t build their Jekyll site locally at all – they just use GitHub Pages to build it.

that’s it!

Overall I’ve been happy with Hugo – I started using it because it had fast build times and it was a static binary, and both of those things are still extremely useful to me. I might have spent 10 hours on this upgrade, but I’ve probably spent 1000+ hours writing blog posts without thinking about Hugo at all so that seems like an extremely reasonable ratio.

I find it hard to be too mad about the backwards incompatible changes, most of them were quite a long time ago, Hugo does a great job of making their old releases available so you can use the old release if you want, and the most difficult one is removing support for the blackfriday Markdown renderer in favour of using something CommonMark-compliant which seems pretty reasonable to me even if it is a huge pain.

But it did take a long time and I don’t think I’d particularly recommend moving 700 blog posts to a new Markdown renderer unless you’re really in the mood for a lot of computer suffering for some reason.

The new renderer did fix a bunch of problems so I think overall it might be a good thing, even if I’ll have to remember to make 2 changes to how I write Markdown (4.1 and 4.3).

Also I’m still using Hugo 0.54 for https://wizardzines.com so maybe these notes will be useful to Future Me if I ever feel like upgrading Hugo for that site.

Hopefully I didn’t break too many things on the blog by doing this, let me know if you see anything broken!

2024-10-01T10:01:44+00:00 Fullscreen Open in Tab
Terminal colours are tricky

Yesterday I was thinking about how long it took me to get a colorscheme in my terminal that I was mostly happy with (SO MANY YEARS), and it made me wonder what about terminal colours made it so hard.

So I asked people on Mastodon what problems they’ve run into with colours in the terminal, and I got a ton of interesting responses! Let’s talk about some of the problems and a few possible ways to fix them.

problem 1: blue on black

One of the top complaints was “blue on black is hard to read”. Here’s an example of that: if I open Terminal.app, set the background to black, and run ls, the directories are displayed in a blue that isn’t that easy to read:

To understand why we’re seeing this blue, let’s talk about ANSI colours!

the 16 ANSI colours

Your terminal has 16 numbered colours – black, red, green, yellow, blue, magenta, cyan, white, and “bright” version of each of those.

Programs can use them by printing out an “ANSI escape code” – for example if you want to see each of the 16 colours in your terminal, you can run this Python program:

def color(num, text):
    return f"\033[38;5;{num}m{text}\033[0m"

for i in range(16):
    print(color(i, f"number {i:02}"))

what are the ANSI colours?

This made me wonder – if blue is colour number 5, who decides what hex color that should correspond to?

The answer seems to be “there’s no standard, terminal emulators just choose colours and it’s not very consistent”. Here’s a screenshot of a table from Wikipedia, where you can see that there’s a lot of variation:

problem 1.5: bright yellow on white

Bright yellow on white is even worse than blue on black, here’s what I get in a terminal with the default settings:

That’s almost impossible to read (and some other colours like light green cause similar issues), so let’s talk about solutions!

two ways to reconfigure your colours

If you’re annoyed by these colour contrast issues (or maybe you just think the default ANSI colours are ugly), you might think – well, I’ll just choose a different “blue” and pick something I like better!

There are two ways you can do this:

Way 1: Configure your terminal emulator: I think most modern terminal emulators have a way to reconfigure the colours, and some of them even come with some preinstalled themes that you might like better than the defaults.

Way 2: Run a shell script: There are ANSI escape codes that you can print out to tell your terminal emulator to reconfigure its colours. Here’s a shell script that does that, from the base16-shell project. You can see that it has a few different conventions for changing the colours – I guess different terminal emulators have different escape codes for changing their colour palette, and so the script is trying to pick the right style of escape code based on the TERM environment variable.

what are the pros and cons of the 2 ways of configuring your colours?

I prefer to use the “shell script” method, because:

  • if I switch terminal emulators for some reason, I don’t need to a different configuration system, my colours still Just Work
  • I use base16-shell with base16-vim to make my vim colours match my terminal colours, which is convenient

some advantages of configuring colours in your terminal emulator:

  • if you use a popular terminal emulator, there are probably a lot more nice terminal themes out there that you can choose from
  • not all terminal emulators support the “shell script method”, and even if they do, the results can be a little inconsistent

This is what my shell has looked like for probably the last 5 years (using the solarized light base16 theme), and I’m pretty happy with it. Here’s htop:

Okay, so let’s say you’ve found a terminal colorscheme that you like. What else can go wrong?

problem 2: programs using 256 colours

Here’s what some output of fd, a find alternative, looks like in my colorscheme:

The contrast is pretty bad here, and I definitely don’t have that lime green in my normal colorscheme. What’s going on?

We can see what color codes fd is using using the unbuffer program to capture its output including the color codes:

$ unbuffer fd . > out
$ vim out
^[[38;5;48mbad-again.sh^[[0m
^[[38;5;48mbad.sh^[[0m
^[[38;5;48mbetter.sh^[[0m
out

^[[38;5;48 means “set the foreground color to color 48”. Terminals don’t only have 16 colours – many terminals these days actually have 3 ways of specifying colours:

  1. the 16 ANSI colours we already talked about
  2. an extended set of 256 colours
  3. a further extended set of 24-bit hex colours, like #ffea03

So fd is using one of the colours from the extended 256-color set. bat (a cat alternative) does something similar – here’s what it looks like by default in my terminal.

This looks fine though and it really seems like it’s trying to work well with a variety of terminal themes.

some newer tools seem to have theme support

I think it’s interesting that some of these newer terminal tools (fd, cat, delta, and probably more) have support for arbitrary custom themes. I guess the downside of this approach is that the default theme might clash with your terminal’s background, but the upside is that it gives you a lot more control over theming the tool’s output than just choosing 16 ANSI colours.

I don’t really use bat, but if I did I’d probably use bat --theme ansi to just use the ANSI colours that I have set in my normal terminal colorscheme.

problem 3: the grays in Solarized

A bunch of people on Mastodon mentioned a specific issue with grays in the Solarized theme: when I list a directory, the base16 Solarized Light theme looks like this:

but iTerm’s default Solarized Light theme looks like this:

This is because in the iTerm theme (which is the original Solarized design), colors 9-14 (the “bright blue”, “bright red”, etc) are mapped to a series of grays, and when I run ls, it’s trying to use those “bright” colours to color my directories and executables.

My best guess for why the original Solarized theme is designed this way is to make the grays available to the vim Solarized colorscheme.

I’m pretty sure I prefer the modified base16 version I use where the “bright” colours are actually colours instead of all being shades of gray though. (I didn’t actually realize the version I was using wasn’t the “original” Solarized theme until I wrote this post)

In any case I really love Solarized and I’m very happy it exists so that I can use a modified version of it.

problem 4: a vim theme that doesn’t match the terminal background

If I my vim theme has a different background colour than my terminal theme, I get this ugly border, like this:

This one is a pretty minor issue though and I think making your terminal background match your vim background is pretty straightforward.

problem 5: programs setting a background color

A few people mentioned problems with terminal applications setting an unwanted background colour, so let’s look at an example of that.

Here ngrok has set the background to color #16 (“black”), but the base16-shell script I use sets color 16 to be bright orange, so I get this, which is pretty bad:

I think the intention is for ngrok to look something like this:

I think base16-shell sets color #16 to orange (instead of black) so that it can provide extra colours for use by base16-vim. This feels reasonable to me – I use base16-vim in the terminal, so I guess I’m using that feature and it’s probably more important to me than ngrok (which I rarely use) behaving a bit weirdly.

This particular issue is a maybe obscure clash between ngrok and my colorschem, but I think this kind of clash is pretty common when a program sets an ANSI background color that the user has remapped for some reason.

a nice solution to contrast issues: “minimum contrast”

A bunch of terminals (iTerm2, tabby, kitty’s text_fg_override_threshold, and folks tell me also Ghostty and Windows Terminal) have a “minimum contrast” feature that will automatically adjust colours to make sure they have enough contrast.

Here’s an example from iTerm. This ngrok accident from before has pretty bad contrast, I find it pretty difficult to read:

With “minimum contrast” set to 40 in iTerm, it looks like this instead:

I didn’t have minimum contrast turned on before but I just turned it on today because it makes such a big difference when something goes wrong with colours in the terminal.

problem 6: TERM being set to the wrong thing

A few people mentioned that they’ll SSH into a system that doesn’t support the TERM environment variable that they have set locally, and then the colours won’t work.

I think the way TERM works is that systems have a terminfo database, so if the value of the TERM environment variable isn’t in the system’s terminfo database, then it won’t know how to output colours for that terminal. I don’t know too much about terminfo, but someone linked me to this terminfo rant that talks about a few other issues with terminfo.

I don’t have a system on hand to reproduce this one so I can’t say for sure how to fix it, but this stackoverflow question suggests running something like TERM=xterm ssh instead of ssh.

problem 7: picking “good” colours is hard

A couple of problems people mentioned with designing / finding terminal colorschemes:

  • some folks are colorblind and have trouble finding an appropriate colorscheme
  • accidentally making the background color too close to the cursor or selection color, so they’re hard to find
  • generally finding colours that work with every program is a struggle (for example you can see me having a problem with this with ngrok above!)

problem 8: making nethack/mc look right

Another problem people mentioned is using a program like nethack or midnight commander which you might expect to have a specific colourscheme based on the default ANSI terminal colours.

For example, midnight commander has a really specific classic look:

But in my Solarized theme, midnight commander looks like this:

The Solarized version feels like it could be disorienting if you’re very used to the “classic” look.

One solution Simon Tatham mentioned to this is using some palette customization ANSI codes (like the ones base16 uses that I talked about earlier) to change the color palette right before starting the program, for example remapping yellow to a brighter yellow before starting Nethack so that the yellow characters look better.

problem 9: commands disabling colours when writing to a pipe

If I run fd | less, I see something like this, with the colours disabled.

In general I find this useful – if I pipe a command to grep, I don’t want it to print out all those color escape codes, I just want the plain text. But what if you want to see the colours?

To see the colours, you can run unbuffer fd | less -r! I just learned about unbuffer recently and I think it’s really cool, unbuffer opens a tty for the command to write to so that it thinks it’s writing to a TTY. It also fixes issues with programs buffering their output when writing to a pipe, which is why it’s called unbuffer.

Here’s what the output of unbuffer fd | less -r looks like for me:

Also some commands (including fd) support a --color=always flag which will force them to always print out the colours.

problem 10: unwanted colour in ls and other commands

Some people mentioned that they don’t want ls to use colour at all, perhaps because ls uses blue, it’s hard to read on black, and maybe they don’t feel like customizing their terminal’s colourscheme to make the blue more readable or just don’t find the use of colour helpful.

Some possible solutions to this one:

  • you can run ls --color=never, which is probably easiest
  • you can also set LS_COLORS to customize the colours used by ls. I think some other programs other than ls support the LS_COLORS environment variable too.
  • also some programs support setting NO_COLOR=true (there’s a list here)

Here’s an example of running LS_COLORS="fi=0:di=0:ln=0:pi=0:so=0:bd=0:cd=0:or=0:ex=0" ls:

problem 11: the colours in vim

I used to have a lot of problems with configuring my colours in vim – I’d set up my terminal colours in a way that I thought was okay, and then I’d start vim and it would just be a disaster.

I think what was going on here is that today, there are two ways to set up a vim colorscheme in the terminal:

  1. using your ANSI terminal colours – you tell vim which ANSI colour number to use for the background, for functions, etc.
  2. using 24-bit hex colours – instead of ANSI terminal colours, the vim colorscheme can use hex codes like #faea99 directly

20 years ago when I started using vim, terminals with 24-bit hex color support were a lot less common (or maybe they didn’t exist at all), and vim certainly didn’t have support for using 24-bit colour in the terminal. From some quick searching through git, it looks like vim added support for 24-bit colour in 2016 – just 8 years ago!

So to get colours to work properly in vim before 2016, you needed to synchronize your terminal colorscheme and your vim colorscheme. Here’s what that looked like, the colorscheme needed to map the vim color classes like cterm05 to ANSI colour numbers.

But in 2024, the story is really different! Vim (and Neovim, which I use now) support 24-bit colours, and as of Neovim 0.10 (released in May 2024), the termguicolors setting (which tells Vim to use 24-bit hex colours for colorschemes) is turned on by default in any terminal with 24-bit color support.

So this “you need to synchronize your terminal colorscheme and your vim colorscheme” problem is not an issue anymore for me in 2024, since I don’t plan to use terminals without 24-bit color support in the future.

The biggest consequence for me of this whole thing is that I don’t need base16 to set colors 16-21 to weird stuff anymore to integrate with vim – I can just use a terminal theme and a vim theme, and as long as the two themes use similar colours (so it’s not jarring for me to switch between them) there’s no problem. I think I can just remove those parts from my base16 shell script and totally avoid the problem with ngrok and the weird orange background I talked about above.

some more problems I left out

I think there are a lot of issues around the intersection of multiple programs, like using some combination tmux/ssh/vim that I couldn’t figure out how to reproduce well enough to talk about them. Also I’m sure I missed a lot of other things too.

base16 has really worked for me

I’ve personally had a lot of success with using base16-shell with base16-vim – I just need to add a couple of lines to my fish config to set it up (+ a few .vimrc lines) and then I can move on and accept any remaining problems that that doesn’t solve.

I don’t think base16 is for everyone though, some limitations I’m aware of with base16 that might make it not work for you:

  • it comes with a limited set of builtin themes and you might not like any of them
  • the Solarized base16 theme (and maybe all of the themes?) sets the “bright” ANSI colours to be exactly the same as the normal colours, which might cause a problem if you’re relying on the “bright” colours to be different from the regular ones
  • it sets colours 16-21 in order to give the vim colorschemes from base16-vim access to more colours, which might not be relevant if you always use a terminal with 24-bit color support, and can cause problems like the ngrok issue above
  • also the way it sets colours 16-21 could be a problem in terminals that don’t have 256-color support, like the linux framebuffer terminal

Apparently there’s a community fork of base16 called tinted-theming, which I haven’t looked into much yet.

some other colorscheme tools

Just one so far but I’ll link more if people tell me about them:

okay, that was a lot

We talked about a lot in this post and while I think learning about all these details is kind of fun if I’m in the mood to do a deep dive, I find it SO FRUSTRATING to deal with it when I just want my colours to work! Being surprised by unreadable text and having to find a workaround is just not my idea of a good day.

Personally I’m a zero-configuration kind of person and it’s not that appealing to me to have to put together a lot of custom configuration just to make my colours in the terminal look acceptable. I’d much rather just have some reasonable defaults that I don’t have to change.

minimum contrast seems like an amazing feature

My one big takeaway from writing this was to turn on “minimum contrast” in my terminal, I think it’s going to fix most of the occasional accidental unreadable text issues I run into and I’m pretty excited about it.

2024-09-27T11:16:00+00:00 Fullscreen Open in Tab
Some Go web dev notes

I spent a lot of time in the past couple of weeks working on a website in Go that may or may not ever see the light of day, but I learned a couple of things along the way I wanted to write down. Here they are:

go 1.22 now has better routing

I’ve never felt motivated to learn any of the Go routing libraries (gorilla/mux, chi, etc), so I’ve been doing all my routing by hand, like this.

	// DELETE /records:
	case r.Method == "DELETE" && n == 1 && p[0] == "records":
		if !requireLogin(username, r.URL.Path, r, w) {
			return
		}
		deleteAllRecords(ctx, username, rs, w, r)
	// POST /records/<ID>
	case r.Method == "POST" && n == 2 && p[0] == "records" && len(p[1]) > 0:
		if !requireLogin(username, r.URL.Path, r, w) {
			return
		}
		updateRecord(ctx, username, p[1], rs, w, r)

But apparently as of Go 1.22, Go now has better support for routing in the standard library, so that code can be rewritten something like this:

	mux.HandleFunc("DELETE /records/", app.deleteAllRecords)
	mux.HandleFunc("POST /records/{record_id}", app.updateRecord)

Though it would also need a login middleware, so maybe something more like this, with a requireLogin middleware.

	mux.Handle("DELETE /records/", requireLogin(http.HandlerFunc(app.deleteAllRecords)))

a gotcha with the built-in router: redirects with trailing slashes

One annoying gotcha I ran into was: if I make a route for /records/, then a request for /records will be redirected to /records/.

I ran into an issue with this where sending a POST request to /records redirected to a GET request for /records/, which broke the POST request because it removed the request body. Thankfully Xe Iaso wrote a blog post about the exact same issue which made it easier to debug.

I think the solution to this is just to use API endpoints like POST /records instead of POST /records/, which seems like a more normal design anyway.

sqlc automatically generates code for my db queries

I got a little bit tired of writing so much boilerplate for my SQL queries, but I didn’t really feel like learning an ORM, because I know what SQL queries I want to write, and I didn’t feel like learning the ORM’s conventions for translating things into SQL queries.

But then I found sqlc, which will compile a query like this:


-- name: GetVariant :one
SELECT *
FROM variants
WHERE id = ?;

into Go code like this:

const getVariant = `-- name: GetVariant :one
SELECT id, created_at, updated_at, disabled, product_name, variant_name
FROM variants
WHERE id = ?
`

func (q *Queries) GetVariant(ctx context.Context, id int64) (Variant, error) {
	row := q.db.QueryRowContext(ctx, getVariant, id)
	var i Variant
	err := row.Scan(
		&i.ID,
		&i.CreatedAt,
		&i.UpdatedAt,
		&i.Disabled,
		&i.ProductName,
		&i.VariantName,
	)
	return i, err
}

What I like about this is that if I’m ever unsure about what Go code to write for a given SQL query, I can just write the query I want, read the generated function and it’ll tell me exactly what to do to call it. It feels much easier to me than trying to dig through the ORM’s documentation to figure out how to construct the SQL query I want.

Reading Brandur’s sqlc notes from 2024 also gave me some confidence that this is a workable path for my tiny programs. That post gives a really helpful example of how to conditionally update fields in a table using CASE statements (for example if you have a table with 20 columns and you only want to update 3 of them).

sqlite tips

Someone on Mastodon linked me to this post called Optimizing sqlite for servers. My projects are small and I’m not so concerned about performance, but my main takeaways were:

  • have a dedicated object for writing to the database, and run db.SetMaxOpenConns(1) on it. I learned the hard way that if I don’t do this then I’ll get SQLITE_BUSY errors from two threads trying to write to the db at the same time.
  • if I want to make reads faster, I could have 2 separate db objects, one for writing and one for reading

There are a more tips in that post that seem useful (like “COUNT queries are slow” and “Use STRICT tables”), but I haven’t done those yet.

Also sometimes if I have two tables where I know I’ll never need to do a JOIN beteween them, I’ll just put them in separate databases so that I can connect to them independently.

Go 1.19 introduced a way to set a GC memory limit

I run all of my Go projects in VMs with relatively little memory, like 256MB or 512MB. I ran into an issue where my application kept getting OOM killed and it was confusing – did I have a memory leak? What?

After some Googling, I realized that maybe I didn’t have a memory leak, maybe I just needed to reconfigure the garbage collector! It turns out that by default (according to A Guide to the Go Garbage Collector), Go’s garbage collector will let the application allocate memory up to 2x the current heap size.

Mess With DNS’s base heap size is around 170MB and the amount of memory free on the VM is around 160MB right now, so if its memory doubled, it’ll get OOM killed.

In Go 1.19, they added a way to tell Go “hey, if the application starts using this much memory, run a GC”. So I set the GC memory limit to 250MB and it seems to have resulted in the application getting OOM killed less often:

export GOMEMLIMIT=250MiB

some reasons I like making websites in Go

I’ve been making tiny websites (like the nginx playground) in Go on and off for the last 4 years or so and it’s really been working for me. I think I like it because:

  • there’s just 1 static binary, all I need to do to deploy it is copy the binary. If there are static files I can just embed them in the binary with embed.
  • there’s a built-in webserver that’s okay to use in production, so I don’t need to configure WSGI or whatever to get it to work. I can just put it behind Caddy or run it on fly.io or whatever.
  • Go’s toolchain is very easy to install, I can just do apt-get install golang-go or whatever and then a go build will build my project
  • it feels like there’s very little to remember to start sending HTTP responses – basically all there is are functions like Serve(w http.ResponseWriter, r *http.Request) which read the request and send a response. If I need to remember some detail of how exactly that’s accomplished, I just have to read the function!
  • also net/http is in the standard library, so you can start making websites without installing any libraries at all. I really appreciate this one.
  • Go is a pretty systems-y language, so if I need to run an ioctl or something that’s easy to do

In general everything about it feels like it makes projects easy to work on for 5 days, abandon for 2 years, and then get back into writing code without a lot of problems.

For contrast, I’ve tried to learn Rails a couple of times and I really want to love Rails – I’ve made a couple of toy websites in Rails and it’s always felt like a really magical experience. But ultimately when I come back to those projects I can’t remember how anything works and I just end up giving up. It feels easier to me to come back to my Go projects that are full of a lot of repetitive boilerplate, because at least I can read the code and figure out how it works.

things I haven’t figured out yet

some things I haven’t done much of yet in Go:

  • rendering HTML templates: usually my Go servers are just APIs and I make the frontend a single-page app with Vue. I’ve used html/template a lot in Hugo (which I’ve used for this blog for the last 8 years) but I’m still not sure how I feel about it.
  • I’ve never made a real login system, usually my servers don’t have users at all.
  • I’ve never tried to implement CSRF

In general I’m not sure how to implement security-sensitive features so I don’t start projects which need login/CSRF/etc. I imagine this is where a framework would help.

it’s cool to see the new features Go has been adding

Both of the Go features I mentioned in this post (GOMEMLIMIT and the routing) are new in the last couple of years and I didn’t notice when they came out. It makes me think I should pay closer attention to the release notes for new Go versions.

2024-09-12T15:09:12+00:00 Fullscreen Open in Tab
Reasons I still love the fish shell

I wrote about how much I love fish in this blog post from 2017 and, 7 years of using it every day later, I’ve found even more reasons to love it. So I thought I’d write a new post with both the old reasons I loved it and some reasons.

This came up today because I was trying to figure out why my terminal doesn’t break anymore when I cat a binary to my terminal, the answer was “fish fixes the terminal!”, and I just thought that was really nice.

1. no configuration

In 10 years of using fish I have never found a single thing I wanted to configure. It just works the way I want. My fish config file just has:

  • environment variables
  • aliases (alias ls eza, alias vim nvim, etc)
  • the occasional direnv hook fish | source to integrate a tool like direnv
  • a script I run to set up my terminal colours

I’ve been told that configuring things in fish is really easy if you ever do want to configure something though.

2. autosuggestions from my shell history

My absolute favourite thing about fish is that I type, it’ll automatically suggest (in light grey) a matching command that I ran recently. I can press the right arrow key to accept the completion, or keep typing to ignore it.

Here’s what that looks like. In this example I just typed the “v” key and it guessed that I want to run the previous vim command again.

2.5 “smart” shell autosuggestions

One of my favourite subtle autocomplete features is how fish handles autocompleting commands that contain paths in them. For example, if I run:

$ ls blah.txt

that command will only be autocompleted in directories that contain blah.txt – it won’t show up in a different directory. (here’s a short comment about how it works)

As an example, if in this directory I type bash scripts/, it’ll only suggest history commands including files that actually exist in my blog’s scripts folder, and not the dozens of other irrelevant scripts/ commands I’ve run in other folders.

I didn’t understand exactly how this worked until last week, it just felt like fish was magically able to suggest the right commands. It still feels a little like magic and I love it.

3. pasting multiline commands

If I copy and paste multiple lines, bash will run them all, like this:

[bork@grapefruit linux-playground (main)]$ echo hi
hi
[bork@grapefruit linux-playground (main)]$ touch blah
[bork@grapefruit linux-playground (main)]$ echo hi
hi

This is a bit alarming – what if I didn’t actually want to run all those commands?

Fish will paste them all at a single prompt, so that I can press Enter if I actually want to run them. Much less scary.

bork@grapefruit ~/work/> echo hi

                         touch blah
                         echo hi

4. nice tab completion

If I run ls and press tab, it’ll display all the filenames in a nice grid. I can use either Tab, Shift+Tab, or the arrow keys to navigate the grid.

Also, I can tab complete from the middle of a filename – if the filename starts with a weird character (or if it’s just not very unique), I can type some characters from the middle and press tab.

Here’s what the tab completion looks like:

bork@grapefruit ~/work/> ls 
api/  blah.py     fly.toml   README.md
blah  Dockerfile  frontend/  test_websocket.sh

I honestly don’t complete things other than filenames very much so I can’t speak to that, but I’ve found the experience of tab completing filenames to be very good.

5. nice default prompt (including git integration)

Fish’s default prompt includes everything I want:

  • username
  • hostname
  • current folder
  • git integration
  • status of last command exit (if the last command failed)

Here’s a screenshot with a few different variations on the default prompt, including if the last command was interrupted (the SIGINT) or failed.

6. nice history defaults

In bash, the maximum history size is 500 by default, presumably because computers used to be slow and not have a lot of disk space. Also, by default, commands don’t get added to your history until you end your session. So if your computer crashes, you lose some history.

In fish:

  1. the default history size is 256,000 commands. I don’t see any reason I’d ever need more.
  2. if you open a new tab, everything you’ve ever run (including commands in open sessions) is immediately available to you
  3. in an existing session, the history search will only include commands from the current session, plus everything that was in history at the time that you started the shell

I’m not sure how clearly I’m explaining how fish’s history system works here, but it feels really good to me in practice. My impression is that the way it’s implemented is the commands are continually added to the history file, but fish only loads the history file once, on startup.

I’ll mention here that if you want to have a fancier history system in another shell it might be worth checking out atuin or fzf.

7. press up arrow to search history

I also like fish’s interface for searching history: for example if I want to edit my fish config file, I can just type:

$ config.fish

and then press the up arrow to go back the last command that included config.fish. That’ll complete to:

$ vim ~/.config/fish/config.fish

and I’m done. This isn’t so different from using Ctrl+R in bash to search your history but I think I like it a little better over all, maybe because Ctrl+R has some behaviours that I find confusing (for example you can end up accidentally editing your history which I don’t like).

8. the terminal doesn’t break

I used to run into issues with bash where I’d accidentally cat a binary to the terminal, and it would break the terminal.

Every time fish displays a prompt, it’ll try to fix up your terminal so that you don’t end up in weird situations like this. I think this is some of the code in fish to prevent broken terminals.

Some things that it does are:

  • turn on echo so that you can see the characters you type
  • make sure that newlines work properly so that you don’t get that weird staircase effect
  • reset your terminal background colour, etc

I don’t think I’ve run into any of these “my terminal is broken” issues in a very long time, and I actually didn’t even realize that this was because of fish – I thought that things somehow magically just got better, or maybe I wasn’t making as many mistakes. But I think it was mostly fish saving me from myself, and I really appreciate that.

9. Ctrl+S is disabled

Also related to terminals breaking: fish disables Ctrl+S (which freezes your terminal and then you need to remember to press Ctrl+Q to unfreeze it). It’s a feature that I’ve never wanted and I’m happy to not have it.

Apparently you can disable Ctrl+S in other shells with stty -ixon.

10. fish_add_path

I have mixed feelings about this one, but in Fish you can use fish_add_path /opt/whatever/bin to add a path to your PATH, globally, permanently, across all open shell sessions. This can get a bit confusing if you forget where those PATH entries are configured but overall I think I appreciate it.

11. nice syntax highlighting

By default commands that don’t exist are highlighted in red, like this.

12. easier loops

I find the loop syntax in fish a lot easier to type than the bash syntax. It looks like this:

for i in *.yaml
  echo $i
end

Also it’ll add indentation in your loops which is nice.

13. easier multiline editing

Related to loops: you can edit multiline commands much more easily than in bash (just use the arrow keys to navigate the multiline command!). Also when you use the up arrow to get a multiline command from your history, it’ll show you the whole command the exact same way you typed it instead of squishing it all onto one line like bash does:

$ bash
$ for i in *.png
> do
> echo $i
> done
$ # press up arrow
$ for i in *.png; do echo $i; done ink

14. Ctrl+left arrow

This might just be me, but I really appreciate that fish has the Ctrl+left arrow / Ctrl+right arrow keyboard shortcut for moving between words when writing a command.

I’m honestly a bit confused about where this keyboard shortcut is coming from (the only documented keyboard shortcut for this I can find in fish is Alt+left arrow / Alt + right arrow which seems to do the same thing), but I’m pretty sure this is a fish shortcut.

A couple of notes about getting this shortcut to work / where it comes from:

  • one person said they needed to switch their terminal emulator from the “Linux console” keybindings to “Default (XFree 4)” to get it to work in fish
  • on Mac OS, Ctrl+left arrow switches workspaces by default, so I had to turn that off.
  • Also apparently Ubuntu configures libreadline in /etc/inputrc to make Ctrl+left/right arrow go back/forward a word, so it’ll work in bash on Ubuntu and maybe other Linux distros too. Here’s a stack overflow question talking about that

a downside: not everything has a fish integration

Sometimes tools don’t have instructions for integrating them with fish. That’s annoying, but:

  • I’ve found this has gotten better over the last 10 years as fish has gotten more popular. For example Python’s virtualenv has had a fish integration for a long time now.
  • If I need to run a POSIX shell command real quick, I can always just run bash or zsh
  • I’ve gotten much better over the years at translating simple commands to fish syntax when I need to

My biggest day-to-day to annoyance is probably that for whatever reason I’m still not used to fish’s syntax for setting environment variables, I get confused about set vs set -x.

on POSIX compatibility

When I started using fish, you couldn’t do things like cmd1 && cmd2 – it would complain “no, you need to run cmd1; and cmd2” instead.

It seems like over the years fish has started accepting a little more POSIX-style syntax than it used to, like:

  • cmd1 && cmd2
  • export a=b to set an environment variable (though this seems a bit limited, you can’t do export PATH=$PATH:/whatever so I think it’s probably better to learn set instead)

on fish as a default shell

Changing my default shell to fish is always a little annoying, I occasionally get myself into a situation where

  1. I install fish somewhere like maybe /home/bork/.nix-stuff/bin/fish
  2. I add the new fish location to /etc/shells as an allowed shell
  3. I change my shell with chsh
  4. at some point months/years later I reinstall fish in a different location for some reason and remove the old one
  5. oh no!!! I have no valid shell! I can’t open a new terminal tab anymore!

This has never been a major issue because I always have a terminal open somewhere where I can fix the problem and rescue myself, but it’s a bit alarming.

If you don’t want to use chsh to change your shell to fish (which is very reasonable, maybe I shouldn’t be doing that), the Arch wiki page has a couple of good suggestions – either configure your terminal emulator to run fish or add an exec fish to your .bashrc.

I’ve never really learned the scripting language

Other than occasionally writing a for loop interactively on the command line, I’ve never really learned the fish scripting language. I still do all of my shell scripting in bash.

I don’t think I’ve ever written a fish function or if statement.

I ran a highly unscientific poll on Mastodon asking people what shell they use interactively. The results were (of 2600 responses):

  • 46% bash
  • 49% zsh
  • 16% fish
  • 5% other

I think 16% for fish is pretty remarkable, since (as far as I know) there isn’t any system where fish is the default shell, and my sense is that it’s very common to just stick to whatever your system’s default shell is.

It feels like a big achievement for the fish project, even if maybe my Mastodon followers are more likely than the average shell user to use fish for some reason.

who might fish be right for?

Fish definitely isn’t for everyone. I think I like it because:

  1. I really dislike configuring my shell (and honestly my dev environment in general), I want things to “just work” with the default settings
  2. fish’s defaults feel good to me
  3. I don’t spend that much time logged into random servers using other shells so there’s not too much context switching
  4. I liked its features so much that I was willing to relearn how to do a few “basic” shell things, like using parentheses (seq 1 10) to run a command instead of backticks or using set instead of export

Maybe you’re also a person who would like fish! I hope a few more of the people who fish is for can find it, because I spend so much of my time in the terminal and it’s made that time much more pleasant.

2024-08-31T18:36:50-07:00 Fullscreen Open in Tab
Thoughts on the Resiliency of Web Projects

I just did a massive spring cleaning of one of my servers, trying to clean up what has become quite the mess of clutter. For every website on the server, I either:

  • Documented what it is, who is using it, and what version of language and framework it uses
  • Archived it as static HTML flat files
  • Moved the source code from GitHub to a private git server
  • Deleted the files

It feels good to get rid of old code, and to turn previously dynamic sites (with all of the risk they come with) into plain HTML.

This is also making me seriously reconsider the value of spinning up any new projects. Several of these are now 10 years old, still churning along fine, but difficult to do any maintenance on because of versions and dependencies. For example:

  • indieauth.com - this has been on the chopping block for years, but I haven't managed to build a replacement yet, and is still used by a lot of people
  • webmention.io - this is a pretty popular service, and I don't want to shut it down, but there's a lot of problems with how it's currently built and no easy way to make changes
  • switchboard.p3k.io - this is a public WebSub (PubSubHubbub) hub, like Superfeedr, and has weirdly gained a lot of popularity in the podcast feed space in the last few years

One that I'm particularly happy with, despite it being an ugly pile of PHP, is oauth.net. I inherited this site in 2012, and it hasn't needed any framework upgrades since it's just using PHP templates. My ham radio website w7apk.com is similarly a small amount of templated PHP, and it is low stress to maintain, and actually fun to quickly jot some notes down when I want. I like not having to go through the whole ceremony of setting up a dev environment, installing dependencies, upgrading things to the latest version, checking for backwards incompatible changes, git commit, deploy, etc. I can just sftp some changes up to the server and they're live.

Some questions for myself for the future, before starting a new project:

  • Could this actually just be a tag page on my website, like #100DaysOfMusic or #BikeTheEclipse?
  • If it really needs to be a new project, then:
  • Can I create it in PHP without using any frameworks or libraries? Plain PHP ages far better than pulling in any dependencies which inevitably stop working with a version 2-3 EOL cycles back, so every library brought in means signing up for annual maintenance of the whole project. Frameworks can save time in the short term, but have a huge cost in the long term.
  • Is it possible to avoid using a database? Databases aren't inherently bad, but using one does make the project slightly more fragile, since it requires plans for migrations and backups, and 
  • If a database is required, is it possible to create it in a way that does not result in ever-growing storage needs?
  • Is this going to store data or be a service that other people are going to use? If so, plan on a registration form so that I have a way to contact people eventually when I need to change it or shut it down.
  • If I've got this far with the questions, am I really ready to commit to supporting this code base for the next 10 years?

One project I've been committed to maintaining and doing regular (ok fine, "semi-regular") updates for is Meetable, the open source events website that I run on a few domains:

I started this project in October 2019, excited for all the IndieWebCamps we were going to run in 2020. Somehow that is already 5 years ago now. Well that didn't exactly pan out, but I did quickly pivot it to add a bunch of features that are helpful for virtual events, so it worked out ok in the end. We've continued to use it for posting IndieWeb events, and I also run an instance for two IETF working groups. I'd love to see more instances pop up, I've only encountered one or two other ones in the wild. I even spent a significant amount of time on the onboarding flow so that it's relatively easy to install and configure. I even added passkeys for the admin login so you don't need any external dependencies on auth providers. It's a cool project if I may say so myself.

Anyway, this is not a particularly well thought out blog post, I just wanted to get my thoughts down after spending all day combing through the filesystem of my web server and uncovering a lot of ancient history.

2024-08-29T12:59:53-07:00 Fullscreen Open in Tab
OAuth Oh Yeah!

The first law of OAuth states that
the total number of authorized access tokens
in an isolated system
must remain constant over time. Over time.

In the world of OAuth, where the sun always shines,
Tokens like treasures, in digital lines.
Security's a breeze, with every law so fine,
OAuth, oh yeah, tonight we dance online!

The second law of OAuth states that
the overall security of the system
must always remain constant over time.
Over time. Over time. Over time.

In the world of OAuth, where the sun always shines,
Tokens like treasures, in digital lines.
Security's a breeze, with every law so fine,
OAuth, oh yeah, tonight we dance online!

The third law of OAuth states that
as the security of the system approaches absolute,
the ability to grant authorized access approaches zero. Zero!

In the world of OAuth, where the sun always shines,
Tokens like treasures, in digital lines.
Security's a breeze, with every law so fine,
OAuth, oh yeah, tonight we dance online!

Tonight we dance online!
OAuth, oh yeah!
Lyrics and music by AI, prompted and edited by Aaron Parecki
2024-08-19T08:15:28+00:00 Fullscreen Open in Tab
Migrating Mess With DNS to use PowerDNS

About 3 years ago, I announced Mess With DNS in this blog post, a playground where you can learn how DNS works by messing around and creating records.

I wasn’t very careful with the DNS implementation though (to quote the release blog post: “following the DNS RFCs? not exactly”), and people started reporting problems that eventually I decided that I wanted to fix.

the problems

Some of the problems people have reported were:

  • domain names with underscores weren’t allowed, even though they should be
  • If there was a CNAME record for a domain name, it allowed you to create other records for that domain name, even if it shouldn’t
  • you could create 2 different CNAME records for the same domain name, which shouldn’t be allowed
  • no support for the SVCB or HTTPS record types, which seemed a little complex to implement
  • no support for upgrading from UDP to TCP for big responses

And there are certainly more issues that nobody got around to reporting, for example that if you added an NS record for a subdomain to delegate it, Mess With DNS wouldn’t handle the delegation properly.

the solution: PowerDNS

I wasn’t sure how to fix these problems for a long time – technically I could have started addressing them individually, but it felt like there were a million edge cases and I’d never get there.

But then one day I was chatting with someone else who was working on a DNS server and they said they were using PowerDNS: an open source DNS server with an HTTP API!

This seemed like an obvious solution to my problems – I could just swap out my own crappy DNS implementation for PowerDNS.

There were a couple of challenges I ran into when setting up PowerDNS that I’ll talk about here. I really don’t do a lot of web development and I think I’ve never built a website that depends on a relatively complex API before, so it was a bit of a learning experience.

challenge 1: getting every query made to the DNS server

One of the main things Mess With DNS does is give you a live view of every DNS query it receives for your subdomain, using a websocket. To make this work, it needs to intercept every DNS query before they it gets sent to the PowerDNS DNS server:

There were 2 options I could think of for how to intercept the DNS queries:

  1. dnstap: dnsdist (a DNS load balancer from the PowerDNS project) has support for logging all DNS queries it receives using dnstap, so I could put dnsdist in front of PowerDNS and then log queries that way
  2. Have my Go server listen on port 53 and proxy the queries myself

I originally implemented option #1, but for some reason there was a 1 second delay before every query got logged. I couldn’t figure out why, so I implemented my own very simple proxy instead.

challenge 2: should the frontend have direct access to the PowerDNS API?

The frontend used to have a lot of DNS logic in it – it converted emoji domain names to ASCII using punycode, had a lookup table to convert numeric DNS query types (like 1) to their human-readable names (like A), did a little bit of validation, and more.

Originally I considered keeping this pattern and just giving the frontend (more or less) direct access to the PowerDNS API to create and delete, but writing even more complex code in Javascript didn’t feel that appealing to me – I don’t really know how to write tests in Javascript and it seemed like it wouldn’t end well.

So I decided to take all of the DNS logic out of the frontend and write a new DNS API for managing records, shaped something like this:

  • GET /records
  • DELETE /records/<ID>
  • DELETE /records/ (delete all records for a user)
  • POST /records/ (create record)
  • POST /records/<ID> (update record)

This meant that I could actually write tests for my code, since the backend is in Go and I do know how to write tests in Go.

what I learned: it’s okay for an API to duplicate information

I had this idea that APIs shouldn’t return duplicate information – for example if I get a DNS record, it should only include a given piece of information once.

But I ran into a problem with that idea when displaying MX records: an MX record has 2 fields, “preference”, and “mail server”. And I needed to display that information in 2 different ways on the frontend:

  1. In a form, where “Preference” and “Mail Server” are 2 different form fields (like 10 and mail.example.com)
  2. In a summary view, where I wanted to just show the record (10 mail.example.com)

This is kind of a small problem, but it came up in a few different places.

I talked to my friend Marco Rogers about this, and based on some advice from him I realized that I could return the same information in the API in 2 different ways! Then the frontend just has to display it. So I started just returning duplicate information in the API, something like this:

{
  values: {'Preference': 10, 'Server': 'mail.example.com'},
  content: '10 mail.example.com',
  ...
}

I ended up using this pattern in a couple of other places where I needed to display the same information in 2 different ways and it was SO much easier.

I think what I learned from this is that if I’m making an API that isn’t intended for external use (there are no users of this API other than the frontend!), I can tailor it very specifically to the frontend’s needs and that’s okay.

challenge 3: what’s a record’s ID?

In Mess With DNS (and I think in most DNS user interfaces!), you create, add, and delete records.

But that’s not how the PowerDNS API works. In PowerDNS, you create a zone, which is made of record sets. Records don’t have any ID in the API at all.

I ended up solving this by generate a fake ID for each records which is made of:

  • its name
  • its type
  • and its content (base64-encoded)

For example one record’s ID is brooch225.messwithdns.com.|NS|bnMxLm1lc3N3aXRoZG5zLmNvbS4=

Then I can search through the zone and find the appropriate record to update it.

This means that if you update a record then its ID will change which isn’t usually what I want in an ID, but that seems fine.

challenge 4: making clear error messages

I think the error messages that the PowerDNS API returns aren’t really intended to be shown to end users, for example:

  • Name 'new\032site.island358.messwithdns.com.' contains unsupported characters (this error encodes the space as \032, which is a bit disorienting if you don’t know that the space character is 32 in ASCII)
  • RRset test.pear5.messwithdns.com. IN CNAME: Conflicts with pre-existing RRset (this talks about RRsets, which aren’t a concept that the Mess With DNS UI has at all)
  • Record orange.beryl5.messwithdns.com./A '1.2.3.4$': Parsing record content (try 'pdnsutil check-zone'): unable to parse IP address, strange character: $ (mentions “pdnsutil”, a utility which Mess With DNS’s users don’t have access to in this context)

I ended up handling this in two ways:

  1. Do some initial basic validation of values that users enter (like IP addresses), so I can just return errors like Invalid IPv4 address: "1.2.3.4$
  2. If that goes well, send the request to PowerDNS and if we get an error back, then do some hacky translation of those messages to make them clearer.

Sometimes users will still get errors from PowerDNS directly, but I added some logging of all the errors that users see, so hopefully I can review them and add extra translations if there are other common errors that come up.

I think what I learned from this is that if I’m building a user-facing application on top of an API, I need to be pretty thoughtful about how I resurface those errors to users.

challenge 5: setting up SQLite

Previously Mess With DNS was using a Postgres database. This was problematic because I only gave the Postgres machine 256MB of RAM, which meant that the database got OOM killed almost every single day. I never really worked out exactly why it got OOM killed every day, but that’s how it was. I spent some time trying to tune Postgres’ memory usage by setting the max connections / work-mem / maintenance-work-mem and it helped a bit but didn’t solve the problem.

So for this refactor I decided to use SQLite instead, because the website doesn’t really get that much traffic. There are some choices involved with using SQLite, and I decided to:

  1. Run db.SetMaxOpenConns(1) to make sure that we only open 1 connection to the database at a time, to prevent SQLITE_BUSY errors from two threads trying to access the database at the same time (just setting WAL mode didn’t work)
  2. Use separate databases for each of the 3 tables (users, records, and requests) to reduce contention. This maybe isn’t really necessary, but there was no reason I needed the tables to be in the same database so I figured I’d set up separate databases to be safe.
  3. Use the cgo-free modernc.org/sqlite, which translates SQLite’s source code to Go. I might switch to a more “normal” sqlite implementation instead at some point and use cgo though. I think the main reason I prefer to avoid cgo is that cgo has landed me with difficult-to-debug errors in the past.
  4. use WAL mode

I still haven’t set up backups, though I don’t think my Postgres database had backups either. I think I’m unlikely to use litestream for backups – Mess With DNS is very far from a critical application, and I think daily backups that I could recover from in case of a disaster are more than good enough.

challenge 6: upgrading Vue & managing forms

This has nothing to do with PowerDNS but I decided to upgrade Vue.js from version 2 to 3 as part of this refresh. The main problem with that is that the form validation library I was using (FormKit) completely changed its API between Vue 2 and Vue 3, so I decided to just stop using it instead of learning the new API.

I ended up switching to some form validation tools that are built into the browser like required and oninvalid (here’s the code). I think it could use some of improvement, I still don’t understand forms very well.

challenge 7: managing state in the frontend

This also has nothing to do with PowerDNS, but when modifying the frontend I realized that my state management in the frontend was a mess – in every place where I made an API request to the backend, I had to try to remember to add a “refresh records” call after that in every place that I’d modified the state and I wasn’t always consistent about it.

With some more advice from Marco, I ended up implementing a single global state management store which stores all the state for the application, and which lets me create/update/delete records.

Then my components can just call store.createRecord(record), and the store will automatically resynchronize all of the state as needed.

challenge 8: sequencing the project

This project ended up having several steps because I reworked the whole integration between the frontend and the backend. I ended up splitting it into a few different phases:

  1. Upgrade Vue from v2 to v3
  2. Make the state management store
  3. Implement a different backend API, move a lot of DNS logic out of the frontend, and add tests for the backend
  4. Integrate PowerDNS

I made sure that the website was (more or less) 100% working and then deployed it in between phases, so that the amount of changes I was managing at a time stayed somewhat under control.

the new website is up now!

I released the upgraded website a few days ago and it seems to work! The PowerDNS API has been great to work on top of, and I’m relieved that there’s a whole class of problems that I now don’t have to think about at all, other than potentially trying to make the error messages from PowerDNS a little clearer. Using PowerDNS has fixed a lot of the DNS issues that folks have reported in the last few years and it feels great.

If you run into problems with the new Mess With DNS I’d love to hear about them here.

2024-08-06T08:38:35+00:00 Fullscreen Open in Tab
Go structs are copied on assignment (and other things about Go I'd missed)

I’ve been writing Go pretty casually for years – the backends for all of my playgrounds (nginx, dns, memory, more DNS) are written in Go, but many of those projects are just a few hundred lines and I don’t come back to those codebases much.

I thought I more or less understood the basics of the language, but this week I’ve been writing a lot more Go than usual while working on some upgrades to Mess with DNS, and ran into a bug that revealed I was missing a very basic concept!

Then I posted about this on Mastodon and someone linked me to this very cool site (and book) called 100 Go Mistakes and How To Avoid Them by Teiva Harsanyi. It just came out in 2022 so it’s relatively new.

I decided to read through the site to see what else I was missing, and found a couple of other misconceptions I had about Go. I’ll talk about some of the mistakes that jumped out to me the most, but really the whole 100 Go Mistakes site is great and I’d recommend reading it.

Here’s the initial mistake that started me on this journey:

mistake 1: not understanding that structs are copied on assignment

Let’s say we have a struct:

type Thing struct {
    Name string
}

and this code:

thing := Thing{"record"}
other_thing := thing
other_thing.Name = "banana"
fmt.Println(thing)

This prints “record” and not “banana” (play.go.dev link), because thing is copied when you assign it to other_thing.

the problem this caused me: ranges

The bug I spent 2 hours of my life debugging last week was effectively this code (play.go.dev link):

type Thing struct {
  Name string
}
func findThing(things []Thing, name string) *Thing {
  for _, thing := range things {
    if thing.Name == name {
      return &thing
    }
  }
  return nil
}

func main() {
  things := []Thing{Thing{"record"}, Thing{"banana"}}
  thing := findThing(things, "record")
  thing.Name = "gramaphone"
  fmt.Println(things)
}

This prints out [{record} {banana}] – because findThing returned a copy, we didn’t change the name in the original array.

This mistake is #30 in 100 Go Mistakes.

I fixed the bug by changing it to something like this (play.go.dev link), which returns a reference to the item in the array we’re looking for instead of a copy.

func findThing(things []Thing, name string) *Thing {
  for i := range things {
    if things[i].Name == name {
      return &things[i]
    }
  }
  return nil
}

why didn’t I realize this?

When I learned that I was mistaken about how assignment worked in Go I was really taken aback, like – it’s such a basic fact about the language works! If I was wrong about that then what ELSE am I wrong about in Go????

My best guess for what happened is:

  1. I’ve heard for my whole life that when you define a function, you need to think about whether its arguments are passed by reference or by value
  2. So I’d thought about this in Go, and I knew that if you pass a struct as a value to a function, it gets copied – if you want to pass a reference then you have to pass a pointer
  3. But somehow it never occurred to me that you need to think about the same thing for assignments, perhaps because in most of the other languages I use (Python, JS, Java) I think everything is a reference anyway. Except for in Rust, where you do have values that you make copies of but I think most of the time I had to run .clone() explicitly. (though apparently structs will be automatically copied on assignment if the struct implements the Copy trait)
  4. Also obviously I just don’t write that much Go so I guess it’s never come up.

mistake 2: side effects appending slices (#25)

When you subset a slice with x[2:3], the original slice and the sub-slice share the same backing array, so if you append to the new slice, it can unintentionally change the old slice:

For example, this code prints [1 2 3 555 5] (code on play.go.dev)

x := []int{1, 2, 3, 4, 5}
y := x[2:3]
y = append(y, 555)
fmt.Println(x)

I don’t think this has ever actually happened to me, but it’s alarming and I’m very happy to know about it.

Apparently you can avoid this problem by changing y := x[2:3] to y := x[2:3:3], which restricts the new slice’s capacity so that appending to it will re-allocate a new slice. Here’s some code on play.go.dev that does that.

mistake 3: not understanding the different types of method receivers (#42)

This one isn’t a “mistake” exactly, but it’s been a source of confusion for me and it’s pretty simple so I’m glad to have it cleared up.

In Go you can declare methods in 2 different ways:

  1. func (t Thing) Function() (a “value receiver”)
  2. func (t *Thing) Function() (a “pointer receiver”)

My understanding now is that basically:

  • If you want the method to mutate the struct t, you need a pointer receiver.
  • If you want to make sure the method doesn’t mutate the struct t, use a value receiver.

Explanation #42 has a bunch of other interesting details though. There’s definitely still something I’m missing about value vs pointer receivers (I got a compile error related to them a couple of times in the last week that I still don’t understand), but hopefully I’ll run into that error again soon and I can figure it out.

more interesting things I noticed

Some more notes from 100 Go Mistakes:

Also there are some things that have tripped me up in the past, like:

this “100 common mistakes” format is great

I really appreciated this “100 common mistakes” format – it made it really easy for me to skim through the mistakes and very quickly mentally classify them into:

  1. yep, I know that
  2. not interested in that one right now
  3. WOW WAIT I DID NOT KNOW THAT, THAT IS VERY USEFUL!!!!

It looks like “100 Common Mistakes” is a series of books from Manning and they also have “100 Java Mistakes” and an upcoming “100 SQL Server Mistakes”.

Also I enjoyed what I’ve read of Effective Python by Brett Slatkin, which has a similar “here are a bunch of short Python style tips” structure where you can quickly skim it and take what’s useful to you. There’s also Effective C++, Effective Java, and probably more.

some other Go resources

other resources I’ve appreciated:

2024-07-21T12:54:40-07:00 Fullscreen Open in Tab
My IETF 120 Agenda

Here's where you can find me at IETF 120 in Vancouver!

Monday

  • 9:30 - 11:30 • alldispatch • Regency C/D
  • 13:00 - 15:00 • oauth • Plaza B
  • 18:30 - 19:30 • Hackdemo Happy Hour • Regency Hallway

Tuesday

  • 15:30 - 17:00 • oauth • Georgia A
  • 17:30 - 18:30 • oauth • Plaza B

Wednesday

  • 9:30 - 11:30 • wimse • Georgia A
  • 11:45 - 12:45 • Chairs Forum • Regency C/D
  • 17:30 - 19:30 • IETF Plenary • Regency A/B/C/D

Thursday

  • 17:00 - 18:00 • spice • Regency A/B
  • 18:30 - 19:30 • spice • Regency A/B

Friday

  • 13:00 - 15:00 • oauth • Regency A/B

My Current Drafts

2024-07-08T13:00:15+00:00 Fullscreen Open in Tab
Entering text in the terminal is complicated

The other day I asked what folks on Mastodon find confusing about working in the terminal, and one thing that stood out to me was “editing a command you already typed in”.

This really resonated with me: even though entering some text and editing it is a very “basic” task, it took me maybe 15 years of using the terminal every single day to get used to using Ctrl+A to go to the beginning of the line (or Ctrl+E for the end – I think I used Home/End instead).

So let’s talk about why entering text might be hard! I’ll also share a few tips that I wish I’d learned earlier.

it’s very inconsistent between programs

A big part of what makes entering text in the terminal hard is the inconsistency between how different programs handle entering text. For example:

  1. some programs (cat, nc, git commit --interactive, etc) don’t support using arrow keys at all: if you press arrow keys, you’ll just see ^[[D^[[D^[[C^[[C^
  2. many programs (like irb, python3 on a Linux machine and many many more) use the readline library, which gives you a lot of basic functionality (history, arrow keys, etc)
  3. some programs (like /usr/bin/python3 on my Mac) do support very basic features like arrow keys, but not other features like Ctrl+left or reverse searching with Ctrl+R
  4. some programs (like the fish shell or ipython3 or micro or vim) have their own fancy system for accepting input which is totally custom

So there’s a lot of variation! Let’s talk about each of those a little more.

mode 1: the baseline

First, there’s “the baseline” – what happens if a program just accepts text by calling fgets() or whatever and doing absolutely nothing else to provide a nicer experience. Here’s what using these tools typically looks for me – If I start the version of dash installed on my machine (a pretty minimal shell) press the left arrow keys, it just prints ^[[D to the terminal.

$ ls l-^[[D^[[D^[[D

At first it doesn’t seem like all of these “baseline” tools have much in common, but there are actually a few features that you get for free just from your terminal, without the program needing to do anything special at all.

The things you get for free are:

  1. typing in text, obviously
  2. backspace
  3. Ctrl+W, to delete the previous word
  4. Ctrl+U, to delete the whole line
  5. a few other things unrelated to text editing (like Ctrl+C to interrupt the process, Ctrl+Z to suspend, etc)

This is not great, but it means that if you want to delete a word you generally can do it with Ctrl+W instead of pressing backspace 15 times, even if you’re in an environment which is offering you absolutely zero features.

You can get a list of all the ctrl codes that your terminal supports with stty -a.

mode 2: tools that use readline

The next group is tools that use readline! Readline is a GNU library to make entering text more pleasant, and it’s very widely used.

My favourite readline keyboard shortcuts are:

  1. Ctrl+E (or End) to go to the end of the line
  2. Ctrl+A (or Home) to go to the beginning of the line
  3. Ctrl+left/right arrow to go back/forward 1 word
  4. up arrow to go back to the previous command
  5. Ctrl+R to search your history

And you can use Ctrl+W / Ctrl+U from the “baseline” list, though Ctrl+U deletes from the cursor to the beginning of the line instead of deleting the whole line. I think Ctrl+W might also have a slightly different definition of what a “word” is.

There are a lot more (here’s a full list), but those are the only ones that I personally use.

The bash shell is probably the most famous readline user (when you use Ctrl+R to search your history in bash, that feature actually comes from readline), but there are TONS of programs that use it – for example psql, irb, python3, etc.

tip: you can make ANYTHING use readline with rlwrap

One of my absolute favourite things is that if you have a program like nc without readline support, you can just run rlwrap nc to turn it into a program with readline support!

This is incredible and makes a lot of tools that are borderline unusable MUCH more pleasant to use. You can even apparently set up rlwrap to include your own custom autocompletions, though I’ve never tried that.

some reasons tools might not use readline

I think reasons tools might not use readline might include:

  • the program is very simple (like cat or nc) and maybe the maintainers don’t want to bring in a relatively large dependency
  • license reasons, if the program’s license is not GPL-compatible – readline is GPL-licensed, not LGPL
  • only a very small part of the program is interactive, and maybe readline support isn’t seen as important. For example git has a few interactive features (like git add -p), but not very many, and usually you’re just typing a single character like y or n – most of the time you need to really type something significant in git, it’ll drop you into a text editor instead.

For example idris2 says they don’t use readline to keep dependencies minimal and suggest using rlwrap to get better interactive features.

how to know if you’re using readline

The simplest test I can think of is to press Ctrl+R, and if you see:

(reverse-i-search)`':

then you’re probably using readline. This obviously isn’t a guarantee (some other library could use the term reverse-i-search too!), but I don’t know of another system that uses that specific term to refer to searching history.

the readline keybindings come from Emacs

Because I’m a vim user, It took me a very long time to understand where these keybindings come from (why Ctrl+A to go to the beginning of a line??? so weird!)

My understanding is these keybindings actually come from Emacs – Ctrl+A and Ctrl+E do the same thing in Emacs as they do in Readline and I assume the other keyboard shortcuts mostly do as well, though I tried out Ctrl+W and Ctrl+U in Emacs and they don’t do the same thing as they do in the terminal so I guess there are some differences.

There’s some more history of the Readline project here.

mode 3: another input library (like libedit)

On my Mac laptop, /usr/bin/python3 is in a weird middle ground where it supports some readline features (for example the arrow keys), but not the other ones. For example when I press Ctrl+left arrow, it prints out ;5D, like this:

$ python3
>>> importt subprocess;5D

Folks on Mastodon helped me figure out that this is because in the default Python install on Mac OS, the Python readline module is actually backed by libedit, which is a similar library which has fewer features, presumably because Readline is GPL licensed.

Here’s how I was eventually able to figure out that Python was using libedit on my system:

$ python3 -c "import readline; print(readline.__doc__)"
Importing this module enables command line editing using libedit readline.

Generally Python uses readline though if you install it on Linux or through Homebrew. It’s just that the specific version that Apple includes on their systems doesn’t have readline. Also Python 3.13 is going to remove the readline dependency in favour of a custom library, so “Python uses readline” won’t be true in the future.

I assume that there are more programs on my Mac that use libedit but I haven’t looked into it.

mode 4: something custom

The last group of programs is programs that have their own custom (and sometimes much fancier!) system for editing text. This includes:

  • most terminal text editors (nano, micro, vim, emacs, etc)
  • some shells (like fish), for example it seems like fish supports Ctrl+Z for undo when typing in a command. Zsh’s line editor is called zle.
  • some REPLs (like ipython), for example IPython uses the prompt_toolkit library instead of readline
  • lots of other programs (like atuin)

Some features you might see are:

  • better autocomplete which is more customized to the tool
  • nicer history management (for example with syntax highlighting) than the default you get from readline
  • more keyboard shortcuts

custom input systems are often readline-inspired

I went looking at how Atuin (a wonderful tool for searching your shell history that I started using recently) handles text input. Looking at the code and some of the discussion around it, their implementation is custom but it’s inspired by readline, which makes sense to me – a lot of users are used to those keybindings, and it’s convenient for them to work even though atuin doesn’t use readline.

prompt_toolkit (the library IPython uses) is similar – it actually supports a lot of options (including vi-like keybindings), but the default is to support the readline-style keybindings.

This is like how you see a lot of programs which support very basic vim keybindings (like j for down and k for up). For example Fastmail supports j and k even though most of its other keybindings don’t have much relationship to vim.

I assume that most “readline-inspired” custom input systems have various subtle incompatibilities with readline, but this doesn’t really bother me at all personally because I’m extremely ignorant of most of readline’s features. I only use maybe 5 keyboard shortcuts, so as long as they support the 5 basic commands I know (which they always do!) I feel pretty comfortable. And usually these custom systems have much better autocomplete than you’d get from just using readline, so generally I prefer them over readline.

lots of shells support vi keybindings

Bash, zsh, and fish all have a “vi mode” for entering text. In a very unscientific poll I ran on Mastodon, 12% of people said they use it, so it seems pretty popular.

Readline also has a “vi mode” (which is how Bash’s support for it works), so by extension lots of other programs have it too.

I’ve always thought that vi mode seems really cool, but for some reason even though I’m a vim user it’s never stuck for me.

understanding what situation you’re in really helps

I’ve spent a lot of my life being confused about why a command line application I was using wasn’t behaving the way I wanted, and it feels good to be able to more or less understand what’s going on.

I think this is roughly my mental flowchart when I’m entering text at a command line prompt:

  1. Do the arrow keys not work? Probably there’s no input system at all, but at least I can use Ctrl+W and Ctrl+U, and I can rlwrap the tool if I want more features.
  2. Does Ctrl+R print reverse-i-search? Probably it’s readline, so I can use all of the readline shortcuts I’m used to, and I know I can get some basic history and press up arrow to get the previous command.
  3. Does Ctrl+R do something else? This is probably some custom input library: it’ll probably act more or less like readline, and I can check the documentation if I really want to know how it works.

Being able to diagnose what’s going on like this makes the command line feel a more predictable and less chaotic.

some things this post left out

There are lots more complications related to entering text that we didn’t talk about at all here, like:

  • issues related to ssh / tmux / etc
  • the TERM environment variable
  • how different terminals (gnome terminal, iTerm, xterm, etc) have different kinds of support for copying/pasting text
  • unicode
  • probably a lot more
2024-07-03T08:00:20+00:00 Fullscreen Open in Tab
Reasons to use your shell's job control

Hello! Today someone on Mastodon asked about job control (fg, bg, Ctrl+z, wait, etc). It made me think about how I don’t use my shell’s job control interactively very often: usually I prefer to just open a new terminal tab if I want to run multiple terminal programs, or use tmux if it’s over ssh. But I was curious about whether other people used job control more often than me.

So I asked on Mastodon for reasons people use job control. There were a lot of great responses, and it even made me want to consider using job control a little more!

In this post I’m only going to talk about using job control interactively (not in scripts) – the post is already long enough just talking about interactive use.

what’s job control?

First: what’s job control? Well – in a terminal, your processes can be in one of 3 states:

  1. in the foreground. This is the normal state when you start a process.
  2. in the background. This is what happens when you run some_process &: the process is still running, but you can’t interact with it anymore unless you bring it back to the foreground.
  3. stopped. This is what happens when you start a process and then press Ctrl+Z. This pauses the process: it won’t keep using the CPU, but you can restart it if you want.

“Job control” is a set of commands for seeing which processes are running in a terminal and moving processes between these 3 states

how to use job control

  • fg brings a process to the foreground. It works on both stopped processes and background processes. For example, if you start a background process with cat < /dev/zero &, you can bring it back to the foreground by running fg
  • bg restarts a stopped process and puts it in the background.
  • Pressing Ctrl+z stops the current foreground process.
  • jobs lists all processes that are active in your terminal
  • kill sends a signal (like SIGKILL) to a job (this is the shell builtin kill, not /bin/kill)
  • disown removes the job from the list of running jobs, so that it doesn’t get killed when you close the terminal
  • wait waits for all background processes to complete. I only use this in scripts though.
  • apparently in bash/zsh you can also just type %2 instead of fg %2

I might have forgotten some other job control commands but I think those are all the ones I’ve ever used.

You can also give fg or bg a specific job to foreground/background. For example if I see this in the output of jobs:

$ jobs
Job Group State   Command
1   3161  running cat < /dev/zero &
2   3264  stopped nvim -w ~/.vimkeys $argv

then I can foreground nvim with fg %2. You can also kill it with kill -9 %2, or just kill %2 if you want to be more gentle.

how is kill %2 implemented?

I was curious about how kill %2 works – does %2 just get replaced with the PID of the relevant process when you run the command, the way environment variables are? Some quick experimentation shows that it isn’t:

$ echo kill %2
kill %2
$ type kill
kill is a function with definition
# Defined in /nix/store/vicfrai6lhnl8xw6azq5dzaizx56gw4m-fish-3.7.0/share/fish/config.fish

So kill is a fish builtin that knows how to interpret %2. Looking at the source code (which is very easy in fish!), it uses jobs -p %2 to expand %2 into a PID, and then runs the regular kill command.

on differences between shells

Job control is implemented by your shell. I use fish, but my sense is that the basics of job control work pretty similarly in bash, fish, and zsh.

There are definitely some shells which don’t have job control at all, but I’ve only used bash/fish/zsh so I don’t know much about that.

Now let’s get into a few reasons people use job control!

reason 1: kill a command that’s not responding to Ctrl+C

I run into processes that don’t respond to Ctrl+C pretty regularly, and it’s always a little annoying – I usually switch terminal tabs to find and kill and the process. A bunch of people pointed out that you can do this in a faster way using job control!

How to do this: Press Ctrl+Z, then kill %1 (or the appropriate job number if there’s more than one stopped/background job, which you can get from jobs). You can also kill -9 if it’s really not responding.

reason 2: background a GUI app so it’s not using up a terminal tab

Sometimes I start a GUI program from the command line (for example with wireshark some_file.pcap), forget to start it in the background, and don’t want it eating up my terminal tab.

How to do this:

  • move the GUI program to the background by pressing Ctrl+Z and then running bg.
  • you can also run disown to remove it from the list of jobs, to make sure that the GUI program won’t get closed when you close your terminal tab.

Personally I try to avoid starting GUI programs from the terminal if possible because I don’t like how their stdout pollutes my terminal (on a Mac I use open -a Wireshark instead because I find it works better but sometimes you don’t have another choice.

reason 2.5: accidentally started a long-running job without tmux

This is basically the same as the GUI app thing – you can move the job to the background and disown it.

I was also curious about if there are ways to redirect a process’s output to a file after it’s already started. A quick search turned up this Linux-only tool which is based on nelhage’s reptyr (which lets you for example move a process that you started outside of tmux to tmux) but I haven’t tried either of those.

reason 3: running a command while using vim

A lot of people mentioned that if they want to quickly test something while editing code in vim or another terminal editor, they like to use Ctrl+Z to stop vim, run the command, and then run fg to go back to their editor.

You can also use this to check the output of a command that you ran before starting vim.

I’ve never gotten in the habit of this, probably because I mostly use a GUI version of vim. I feel like I’d also be likely to switch terminal tabs and end up wondering “wait… where did I put my editor???” and have to go searching for it.

reason 4: preferring interleaved output

A few people said that they prefer to the output of all of their commands being interleaved in the terminal. This really surprised me because I usually think of having the output of lots of different commands interleaved as being a bad thing, but one person said that they like to do this with tcpdump specifically and I think that actually sounds extremely useful. Here’s what it looks like:

# start tcpdump
$ sudo tcpdump -ni any port 1234 &
tcpdump: data link type PKTAP
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on any, link-type PKTAP (Apple DLT_PKTAP), snapshot length 524288 bytes

# run curl
$ curl google.com:1234
13:13:29.881018 IP 192.168.1.173.49626 > 142.251.41.78.1234: Flags [S], seq 613574185, win 65535, options [mss 1460,nop,wscale 6,nop,nop,TS val 2730440518 ecr 0,sackOK,eol], length 0
13:13:30.881963 IP 192.168.1.173.49626 > 142.251.41.78.1234: Flags [S], seq 613574185, win 65535, options [mss 1460,nop,wscale 6,nop,nop,TS val 2730441519 ecr 0,sackOK,eol], length 0
13:13:31.882587 IP 192.168.1.173.49626 > 142.251.41.78.1234: Flags [S], seq 613574185, win 65535, options [mss 1460,nop,wscale 6,nop,nop,TS val 2730442520 ecr 0,sackOK,eol], length 0
 
# when you're done, kill the tcpdump in the background
$ kill %1 

I think it’s really nice here that you can see the output of tcpdump inline in your terminal – when I’m using tcpdump I’m always switching back and forth and I always get confused trying to match up the timestamps, so keeping everything in one terminal seems like it might be a lot clearer. I’m going to try it.

reason 5: suspend a CPU-hungry program

One person said that sometimes they’re running a very CPU-intensive program, for example converting a video with ffmpeg, and they need to use the CPU for something else, but don’t want to lose the work that ffmpeg already did.

You can do this by pressing Ctrl+Z to pause the process, and then run fg when you want to start it again.

reason 6: you accidentally ran Ctrl+Z

Many people replied that they didn’t use job control intentionally, but that they sometimes accidentally ran Ctrl+Z, which stopped whatever program was running, so they needed to learn how to use fg to bring it back to the foreground.

The were also some mentions of accidentally running Ctrl+S too (which stops your terminal and I think can be undone with Ctrl+Q). My terminal totally ignores Ctrl+S so I guess I’m safe from that one though.

reason 7: already set up a bunch of environment variables

Some folks mentioned that they already set up a bunch of environment variables that they need to run various commands, so it’s easier to use job control to run multiple commands in the same terminal than to redo that work in another tab.

reason 8: it’s your only option

Probably the most obvious reason to use job control to manage multiple processes is “because you have to” – maybe you’re in single-user mode, or on a very restricted computer, or SSH’d into a machine that doesn’t have tmux or screen and you don’t want to create multiple SSH sessions.

reason 9: some people just like it better

Some people also said that they just don’t like using terminal tabs: for instance a few folks mentioned that they prefer to be able to see all of their terminals on the screen at the same time, so they’d rather have 4 terminals on the screen and then use job control if they need to run more than 4 programs.

I learned a few new tricks!

I think my two main takeaways from thos post is I’ll probably try out job control a little more for:

  1. killing processes that don’t respond to Ctrl+C
  2. running tcpdump in the background with whatever network command I’m running, so I can see both of their output in the same place
2024-06-03T09:45:11+00:00 Fullscreen Open in Tab
New zine: How Git Works!

Hello! I’ve been writing about git on here nonstop for months, and the git zine is FINALLY done! It came out on Friday!

You can get it for $12 here: https://wizardzines.com/zines/git, or get an 14-pack of all my zines here.

Here’s the cover:

the table of contents

Here’s the table of contents:

who is this zine for?

I wrote this zine for people who have been using git for years and are still afraid of it. As always – I think it sucks to be afraid of the tools that you use in your work every day! I want folks to feel confident using git.

My goals are:

  • To explain how some parts of git that initially seem scary (like “detached HEAD state”) are pretty straightforward to deal with once you understand what’s going on
  • To show some parts of git you probably should be careful around. For example, the stash is one of the places in git where it’s easiest to lose your work in a way that’s incredibly annoying to recover form, and I avoid using it heavily because of that.
  • To clear up a few common misconceptions about how the core parts of git (like commits, branches, and merging) work

what’s the difference between this and Oh Shit, Git!

You might be wondering – Julia! You already have a zine about git! What’s going on? Oh Shit, Git! is a set of tricks for fixing git messes. “How Git Works” explains how Git actually works.

Also, Oh Shit, Git! is the amazing Katie Sylor Miller’s concept: we made it into a zine because I was such a huge fan of her work on it.

I think they go really well together.

what’s so confusing about git, anyway?

This zine was really hard for me to write because when I started writing it, I’d been using git pretty confidently for 10 years. I had no real memory of what it was like to struggle with git.

But thanks to a huge amount of help from Marie as well as everyone who talked to me about git on Mastodon, eventually I was able to see that there are a lot of things about git that are counterintuitive, misleading, or just plain confusing. These include:

  • confusing terminology (for example “fast-forward”, “reference”, or “remote-tracking branch”)
  • misleading messages (for example how Your branch is up to date with 'origin/main' doesn’t necessary mean that your branch is up to date with the main branch on the origin)
  • uninformative output (for example how I STILL can’t reliably figure out which code comes from which branch when I’m looking at a merge conflict)
  • a lack of guidance around handling diverged branches (for example how when you run git pull and your branch has diverged from the origin, it doesn’t give you great guidance how to handle the situation)
  • inconsistent behaviour (for example how git’s reflogs are almost always append-only, EXCEPT for the stash, where git will delete entries when you run git stash drop)

The more I heard from people how about how confusing they find git, the more it became clear that git really does not make it easy to figure out what its internal logic is just by using it.

handling git’s weirdnesses becomes pretty routine

The previous section made git sound really bad, like “how can anyone possibly use this thing?”.

But my experience is that after I learned what git actually means by all of its weird error messages, dealing with it became pretty routine! I’ll see an error: failed to push some refs to 'github.com:jvns/wizard-zines-site', realize “oh right, probably a coworker made some changes to main since I last ran git pull”, run git pull --rebase to incorporate their changes, and move on with my day. The whole thing takes about 10 seconds.

Or if I see a You are in 'detached HEAD' state warning, I’ll just make sure to run git checkout mybranch before continuing to write code. No big deal.

For me (and for a lot of folks I talk to about git!), dealing with git’s weird language can become so normal that you totally forget why anybody would even find it weird.

a little bit of internals

One of my biggest questions when writing this zine was how much to focus on what’s in the .git directory. We ended up deciding to include a couple of pages about internals (“inside .git”, pages 14-15), but otherwise focus more on git’s behaviour when you use it and why sometimes git behaves in unexpected ways.

This is partly because there are lots of great guides to git’s internals out there already (1, 2), and partly because I think even if you have read one of these guides to git’s internals, it isn’t totally obvious how to connect that information to what you actually see in git’s user interface.

For example: it’s easy to find documentation about remotes in git – for example this page says:

Remote-tracking branches […] remind you where the branches in your remote repositories were the last time you connected to them.

But even if you’ve read that, you might not realize that the statement Your branch is up to date with 'origin/main'" in git status doesn’t necessarily mean that you’re actually up to date with the remote main branch.

So in general in the zine we focus on the behaviour you see in Git’s UI, and then explain how that relates to what’s happening internally in Git.

the cheat sheet

The zine also comes with a free printable cheat sheet: (click to get a PDF version)

it comes with an HTML transcript!

The zine also comes with an HTML transcript, to (hopefully) make it easier to read on a screen reader! Our Operations Manager, Lee, transcribed all of the pages and wrote image descriptions. I’d love feedback about the experience of reading the zine on a screen reader if you try it.

I really do love git

I’ve been pretty critical about git in this post, but I only write zines about technologies I love, and git is no exception.

Some reasons I love git:

  • it’s fast!
  • it’s backwards compatible! I learned how to use it 10 years ago and everything I learned then is still true
  • there’s tons of great free Git hosting available out there (GitHub! Gitlab! a million more!), so I can easily back up all my code
  • simple workflows are REALLY simple (if I’m working on a project on my own, I can just run git commit -am 'whatever' and git push over and over again and it works perfectly)
  • Almost every internal file in git is a pretty simple text file (or has a version which is a text file), which makes me feel like I can always understand exactly what’s going on under the hood if I want to.

I hope this zine helps some of you love it too.

people who helped with this zine

I don’t make these zines by myself!

I worked with Marie Claire LeBlanc Flanagan every morning for 8 months to write clear explanations of git.

The cover is by Vladimir Kašiković, Gersande La Flèche did copy editing, James Coglan (of the great Building Git) did technical review, our Operations Manager Lee did the transcription as well as a million other things, my partner Kamal read the zine and told me which parts were off (as he always does), and I had a million great conversations with Marco Rogers about git.

And finally, I want to thank all the beta readers! There were 66 this time which is a record! They left hundreds of comments about what was confusing, what they learned, and which of my jokes were funny. It’s always hard to hear from beta readers that a page I thought made sense is actually extremely confusing, and fixing those problems before the final version makes the zine so much better.

get the zine

Here are some links to get the zine again:

As always, you can get either a PDF version to print at home or a print version shipped to your house. The only caveat is print orders will ship in July – I need to wait for orders to come in to get an idea of how many I should print before sending it to the printer.

thank you

As always: if you’ve bought zines in the past, thank you for all your support over the years. And thanks to all of you (1000+ people!!!) who have already bought the zine in the first 3 days. It’s already set a record for most zines sold in a single day and I’ve been really blown away.

2024-05-12T07:39:30-07:00 Fullscreen Open in Tab
FedCM for IndieAuth

IndieWebCamp Düsseldorf took place this weekend, and I was inspired to work on a quick hack for demo day to show off a new feature I've been working on for IndieAuth.

Since I do actually use my website to log in to different websites on a regular basis, I am often presented with the login screen asking for my domain name, which is admittedly an annoying part of the process. I don't even like having to enter my email address when I log in to a site, and entering my domain isn't any better.

So instead, I'd like to get rid of this prompt, and let the browser handle it for you! Here's a quick video of logging in to a website using my domain with the new browser API:

So how does this work?

For the last couple of years, there has been an ongoing effort at the Federated Identity Community Group at the W3C to build a new API in browsers that can sit in the middle of login flows. It's primarily being driven by Google for their use case of letting websites show a Google login popup dialog without needing 3rd party cookies and doing so in a privacy-preserving way. There's a lot to unpack here, more than I want to go into in this blog post. You can check out Tim Cappalli's slides from the OAuth Security Workshop for a good explainer on the background and how it works.

However, there are a few experimental features that are being considered for the API to accommodate use cases beyond the "Sign in with Google" case. The one that's particularly interesting to the IndieAuth use case is the IdP Registration API. This API allows any website to register itself as an identity provider that can appear in the account chooser popup, so that a relying party website doesn't have to list out all the IdPs it supports, it can just say it supports "any" IdP. This maps to how IndieAuth is already used today, where a website can accept any user's IndieAuth server without any prior relationship with the user. For more background, check out my previous blog post "OAuth for the Open Web".

So now, with the IdP Registration API in FedCM, your website can tell your browser that it is an IdP, then when a website wants to log you in, it asks your browser to prompt you. You choose your account from the list, the negotiation happens behind the scenes, and you're logged in!

One of the nice things about combining FedCM with IndieAuth is it lends itself nicely to running the FedCM IdP as a separate service from your actual website. I could run an IndieAuth IdP service that you could sign up for and link your website to. Since your identity is your website, your website would be the thing ultimately sent to the relying party that you're signing in to, even though it was brokered through the IdP service. Ultimately this means much faster adoption is possible, since all it takes to turn your website into a FedCM-supported site is adding a single <link> tag to your home page.

So if this sounds interesting to you, leave a comment below! The IdP registration API is currently an early experiment, and Google needs to see actual interest in it in order to keep it around! In particular, they are looking for Relying Parties who would be interested in actually using this to log users in. I am planning on launching this on webmention.io as an experiment. If you have a website where users can sign in with IndieAuth, feel free to get in touch and I'd be happy to help you set up FedCM support as well!

2024-05-02T15:06:00-07:00 Fullscreen Open in Tab
OAuth for Browser-Based Apps Working Group Last Call!

The draft specification OAuth for Browser-Based Applications has just entered Working Group Last Call!

https://datatracker.ietf.org/doc/html/draft-ietf-oauth-browser-based-apps

This begins a two-week period to collect final comments on the draft. Please review the draft and reply on the OAuth mailing list if you have any comments or concerns. And if you've reviewed the document and are happy with the current state, it is also extremely helpful if you can reply on the list to just say "looks good to me"!

If joining the mailing list is too much work, you're also welcome to comment on the Last Call issue on GitHub.

In case you were wondering, yes your comments matter! Even just a small indication of support goes a long way in these discussions!

I am extremely happy with how this draft has turned out, and would like to again give a huge thanks to Philippe De Ryck for the massive amount of work he's put in to the latest few versions to help get this over the finish line!

2024-04-10T12:43:14+00:00 Fullscreen Open in Tab
Notes on git's error messages

While writing about Git, I’ve noticed that a lot of folks struggle with Git’s error messages. I’ve had many years to get used to these error messages so it took me a really long time to understand why folks were confused, but having thought about it much more, I’ve realized that:

  1. sometimes I actually am confused by the error messages, I’m just used to being confused
  2. I have a bunch of strategies for getting more information when the error message git gives me isn’t very informative

So in this post, I’m going to go through a bunch of Git’s error messages, list a few things that I think are confusing about them for each one, and talk about what I do when I’m confused by the message.

improving error messages isn’t easy

Before we start, I want to say that trying to think about why these error messages are confusing has given me a lot of respect for how difficult maintaining Git is. I’ve been thinking about Git for months, and for some of these messages I really have no idea how to improve them.

Some things that seem hard to me about improving error messages:

  • if you come up with an idea for a new message, it’s hard to tell if it’s actually better!
  • work like improving error messages often isn’t funded
  • the error messages have to be translated (git’s error messages are translated into 19 languages!)

That said, if you find these messages confusing, hopefully some of these notes will help clarify them a bit.

error: git push on a diverged branch

$ git push
To github.com:jvns/int-exposed
! [rejected]        main -> main (non-fast-forward)
error: failed to push some refs to 'github.com:jvns/int-exposed'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

$ git status
On branch main
Your branch and 'origin/main' have diverged,
and have 2 and 1 different commits each, respectively.

Some things I find confusing about this:

  1. You get the exact same error message whether the branch is just behind or the branch has diverged. There’s no way to tell which it is from this message: you need to run git status or git pull to find out.
  2. It says failed to push some refs, but it’s not totally clear which references it failed to push. I believe everything that failed to push is listed with ! [rejected] on the previous line– in this case just the main branch.

What I like to do if I’m confused:

  • I’ll run git status to figure out what the state of my current branch is.
  • I think I almost never try to push more than one branch at a time, so I usually totally ignore git’s notes about which specific branch failed to push – I just assume that it’s my current branch

error: git pull on a diverged branch

$ git pull
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint:
hint:   git config pull.rebase false  # merge
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.

The main thing I think is confusing here is that git is presenting you with a kind of overwhelming number of options: it’s saying that you can either:

  1. configure pull.rebase false, pull.rebase true, or pull.ff only locally
  2. or configure them globally
  3. or run git pull --rebase or git pull --no-rebase

It’s very hard to imagine how a beginner to git could easily use this hint to sort through all these options on their own.

If I were explaining this to a friend, I’d say something like “you can use git pull --rebase or git pull --no-rebase to resolve this with a rebase or merge right now, and if you want to set a permanent preference, you can do that with git config pull.rebase false or git config pull.rebase true.

git config pull.ff only feels a little redundant to me because that’s git’s default behaviour anyway (though it wasn’t always).

What I like to do here:

  • run git status to see the state of my current branch
  • maybe run git log origin/main or git log to see what the diverged commits are
  • usually run git pull --rebase to resolve it
  • sometimes I’ll run git push --force or git reset --hard origin/main if I want to throw away my local work or remote work (for example because I accidentally commited to the wrong branch, or because I ran git commit --amend on a personal branch that only I’m using and want to force push)

error: git checkout asdf (a branch that doesn't exist)

$ git checkout asdf
error: pathspec 'asdf' did not match any file(s) known to git

This is a little weird because we my intention was to check out a branch, but git checkout is complaining about a path that doesn’t exist.

This is happening because git checkout’s first argument can be either a branch or a path, and git has no way of knowing which one you intended. This seems tricky to improve, but I might expect something like “No such branch, commit, or path: asdf”.

What I like to do here:

  • in theory it would be good to use git switch instead, but I keep using git checkout anyway
  • generally I just remember that I need to decode this as “branch asdf doesn’t exist”

error: git switch asdf (a branch that doesn't exist)

$ git switch asdf
fatal: invalid reference: asdf

git switch only accepts a branch as an argument (unless you pass -d), so why is it saying invalid reference: asdf instead of invalid branch: asdf?

I think the reason is that internally, git switch is trying to be helpful in its error messages: if you run git switch v0.1 to switch to a tag, it’ll say:

$ git switch v0.1
fatal: a branch is expected, got tag 'v0.1'`

So what git is trying to communicate with fatal: invalid reference: asdf is “asdf isn’t a branch, but it’s not a tag either, or any other reference”. From my various git polls my impression is that a lot of git users have literally no idea what a “reference” is in git, so I’m not sure if that’s coming across.

What I like to do here:

90% of the time when a git error message says reference I just mentally replace it with branch in my head.

error: git checkout HEAD^

$ git checkout HEAD^
Note: switching to 'HEAD^'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c 

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 182cd3f add "swap byte order" button

This is a tough one. Definitely a lot of people are confused about this message, but obviously there's been a lot of effort to improve it too. I don't have anything smart to say about this one.

What I like to do here:

  • my shell prompt tells me if I’m in detached HEAD state, and generally I can remember not to make new commits while in that state
  • when I’m done looking at whatever old commits I wanted to look at, I’ll run git checkout main or something to go back to a branch

message: git status when a rebase is in progress

This isn’t an error message, but I still find it a little confusing on its own:

$ git status
interactive rebase in progress; onto c694cf8
Last command done (1 command done):
   pick 0a9964d wip
No commands remaining.
You are currently rebasing branch 'main' on 'c694cf8'.
  (fix conflicts and then run "git rebase --continue")
  (use "git rebase --skip" to skip this patch)
  (use "git rebase --abort" to check out the original branch)

Unmerged paths:
  (use "git restore --staged ..." to unstage)
  (use "git add ..." to mark resolution)
  both modified:   index.html

no changes added to commit (use "git add" and/or "git commit -a")

Two things I think could be clearer here:

  1. I think it would be nice if You are currently rebasing branch 'main' on 'c694cf8'. were on the first line instead of the 5th line – right now the first line doesn’t say which branch you’re rebasing.
  2. In this case, c694cf8 is actually origin/main, so I feel like You are currently rebasing branch 'main' on 'origin/main' might be even clearer.

What I like to do here:

My shell prompt includes the branch that I’m currently rebasing, so I rely on that instead of the output of git status.

error: git rebase when a file has been deleted

$ git rebase main
CONFLICT (modify/delete): index.html deleted in 0ce151e (wip) and modified in HEAD.  Version HEAD of index.html left in tree.
error: could not apply 0ce151e... wip

The thing I still find confusing about this is – index.html was modified in HEAD. But what is HEAD? Is it the commit I was working on when I started the merge/rebase, or is it the commit from the other branch? (the answer is “HEAD is your branch if you’re doing a merge, and it’s the “other branch” if you’re doing a rebase, but I always find that hard to remember)

I think I would personally find it easier to understand if the message listed the branch names if possible, something like this:

CONFLICT (modify/delete): index.html deleted on `main` and modified on `mybranch`

error: git status during a merge or rebase (who is "them"?)

$ git status 
On branch master
You have unmerged paths.
  (fix conflicts and run "git commit")
  (use "git merge --abort" to abort the merge)

Unmerged paths: (use “git add/rm …” as appropriate to mark resolution) deleted by them: the_file

no changes added to commit (use “git add” and/or “git commit -a”)

I find this one confusing in exactly the same way as the previous message: it says deleted by them:, but what “them” refers to depends on whether you did a merge or rebase or cherry-pick.

  • for a merge, them is the other branch you merged in
  • for a rebase, them is the branch that you were on when you ran git rebase
  • for a cherry-pick, I guess it’s the commit you cherry-picked

What I like to do if I’m confused:

  • try to remember what I did
  • run git show main --stat or something to see what I did on the main branch if I can’t remember

error: git clean

$ git clean
fatal: clean.requireForce defaults to true and neither -i, -n, nor -f given; refusing to clean

I just find it a bit confusing that you need to look up what -i, -n and -f are to be able to understand this error message. I’m personally way too lazy to do that so even though I’ve probably been using git clean for 10 years I still had no idea what -i stood for (interactive) until I was writing this down.

What I like to do if I’m confused:

Usually I just chaotically run git clean -f to delete all my untracked files and hope for the best, though I might actually switch to git clean -i now that I know what -i stands for. Seems a lot safer.

that’s all!

Hopefully some of this is helpful!

2024-04-01T07:37:00+00:00 Fullscreen Open in Tab
Making crochet cacti

I noticed some tech bloggers I follow have been making April Cools Day posts about topics they don’t normally write about (like decaf or microscopes). The goal isn’t to trick anyone, just to write about something different for a day.

I thought those posts were fun so here is a post with some notes on learning to crochet tiny cacti.

first, the cacti

I’ve been trying to do some non-computer hobbies, without putting a lot of pressure on myself to be “good” at them. Here are some cacti I crocheted:

They are a little wonky and I like them.

a couple of other critters

Here are a couple of other things I made: an elephant, an orange guy, a much earlier attempt at a cactus, and an in-progress cactus

Some of these are also pretty wonky, but sometimes it adds to the charm: for example the elephant’s head is attached at an angle which was not on purpose but I think adds to the effect. (orange guy pattern, elephant pattern)

I haven’t really been making clothing: I like working in a pretty chaotic way and I think you need to be a lot more careful when you make clothing so that it will actually fit.

the first project: a mouse

The first project I made was this little mouse. It took me a few hours (maybe 3 hours?) and I made a lot of mistakes and it definitely was not as cute as it was in the pictures in the pattern, but it was still good! I can’t find a picture right now though.

buying patterns is great

Originally I started out using free patterns, but I found some cacti patterns I really liked in an ebook called Knotmonsters: Cactus Gardens Edition, so I bought it.

I like the patterns in that book and also buying patterns seems like a nice way to support people who are making fun patterns. I found this guide to designing your own patterns through searching on Ravelry and it seems like a lot of work! Maybe I will do it one day but for now I appreciate the work of other people who make the patterns.

modifying patterns chaotically is great too

I’ve been modifying all of the patterns I make in a somewhat chaotic way, often just because I made a mistake somewhere along the way and then decide to move forward and change the pattern to adjust for the mistake instead of undoing my work. Some of of the changes I’ve made are:

  • remove rows
  • put fewer stitches in a row
  • use a different stitch

This doesn’t always work but often it works well enough, and I think all of the mistakes help me learn.

no safety eyes

A lot of the patterns I’ve been seeing for animals suggest using “safety eyes” (plastic eyes). I didn’t really feel like buying those , so I’ve been embroidering eyes on instead. “Embroidering” might not be accurate, really I just sew some black yarn on in a haphazard way and hope it doesn’t come out looking too weird.

My crochet kit came with a big plastic yarn needle that I’ve been using to embroider and also

no stitch markers

My crochet kit came with some plastic “stitch markers” which you can use to figure out where the beginning of your row is, so you know when you’re done. I’ve been finding it easier to just use a short piece of scrap yarn instead.

on dealing with all the counting

In crochet there is a LOT of counting. Like “single crochet 3 times, then double crochet 1 time, then repeat that 6 times”. I find it hard to do that accurately without making mistakes, and all of the counting is not that fun! A few things that have helped:

  • go back and look at my stitches to see what I did (“have I done 1 single crochet, or 2?”). I’m not actually very good at doing this, but I find it easier to see my stitches with wool/cotton yarn than with acrylic yarn for some reason.
  • count how many stitches in total I’ve done since the last row, and make sure it seems approximately right (“well, I’m supposed to have 20 stitches and I have 19, that’s pretty close!”). Then I’ll maybe just add an extra stitch in the wrong place to adjust, or maybe just leave it the way it is.

notes on yarn

So far I’ve tried three kinds of yarn: merino (for the elephant), cotton (for the cacti), and acrylic (for the orange dude). I still don’t know which one I like best, but since I’m doing small projects it feels like the right move is still to just buy small amounts of yarn and experiment. I think I like the cotton and merino more than the acrylic.

For the cacti I used Ricorumi cotton yarn, which comes in tiny balls (which is good for me because if I don’t end up liking it, I don’t have a lot of extra!) and in a lot of different colours.

There are a lot of yarn weights (lace! sock! sport! DK! worsted! bulky! and more!). I don’t really underestand them yet but I think so far I’ve been mostly using DK and worsted yarn.

hook size? who knows!

I’ve mostly been using a 3.5mm hook, probably because I read a tutorial that said to use a 3.5mm hook. It seems to work fine! I used a larger hook size when making a hat, and that also worked.

I still don’t really know how to choose hook sizes but that doesn’t seem to have a lot of consequences when making cacti.

every stitch I’ve learned

I think I’ve probably only learned how to do 5 things in crochet so far:

  • magic ring (mr)
  • single crochet (sc)
  • half double crochet (hdc)
  • front post half double crochet (fphdc)
  • double crochet (dc)
  • back loops only/front loops only (flo/blo)
  • increase/decrease

The way I’ve been approaching learning new crochet stitches is:

  1. find a pattern I want to make
  2. start it without reviewing it very much at all
  3. when I get to a stitch I don’t know, watch youtube videos
  4. don’t watch it very carefully and get it wrong
  5. eventually realize that it doesn’t look right at all, rewatch the video, and continue

I’ve been using Sarah Maker’s pages a lot, except for the magic ring where I used this 3-minute youtube video.

The magic ring took me a very long time to learn to do correctly, I didn’t pay attention very closely to the 3-minute youtube video so I did it wrong in maybe 4 projects before I figured out how to do it right.

every single thing I’ve bought

So far I’ve only needed:

  1. a crochet kit (which I got as a gift). it came with yarn, a bunch of crochet needles in different sizes, big sewing needles, and some other things I haven’t needed yet.
  2. some Ricorumi cotton (for the cacti)
  3. 1 ball of gray yarn (for the elephant)

I’ve been trying to not buy too much stuff, because I never know if I’ll get bored with a new hobby, and if I get bored it’s annoying to have a bunch of stuff lying around. Some examples of things I’ve avoided buying so far:

  • Instead of buying polyester fiberfill, to fill all of the critters I’ve just been cutting up an old sweater I have that was falling apart.
  • I’ve been embroidering the eyes instead of buying safety eyes

Everything I have right now fits in a the box the crochet kit came in (which is about the size of a large shoebox), and my plan is to keep it that way for a while.

that’s all!

Mainly what I like about crochet so far is that:

  • it’s a way to not be on the computer, and you can chat with people while doing it
  • you can do it without buying too much stuff, it’s pretty compact
  • I end up with cacti in our living room which is great (I also have a bunch of real succulents, so they go with those)
  • it seems extremely forgiving of mistakes and experimentation

There are definitely still a lot of things I’m doing “wrong” but it’s fun to learn through trial and error.

2024-03-29T08:15:24-07:00 Fullscreen Open in Tab
OAuth: "grant" vs "flow" vs "grant type"
Is it called an OAuth "grant" or a "flow"? What about "grant type"?

These are common questions when writing documentation for OAuth-related things. While these terms are all used in RFC 6749 and many extensions, the differences between the terminology is never actually explained.

I wanted to finally write down a definition of the terms, along with examples of when each is appropriate.

  • flow - use "flow" when referring to the end-to-end process, for example:
    • "the client initiates the flow by..."
    • "the flow ends with the successful issuance of an access token"
    • This can also be combined with the type of flow, for example:
    • "The Authorization Code flow starts by..."
  • grant - use "grant" when referring to the specific POST request to the token endpoint, for example:
    • "The authorization code grant includes the PKCE code verifier..."
    • "The refresh token grant can be used with or without client authentication..."
    • "Grant" also refers to the abstract concept of the user having granted authorization, which is expressed as the authorization code, or implicitly with the client credentials grant. This is a bit of an academic definition of the term, and is used much less frequently in normal conversation around OAuth.
  • grant type - use "grant type" when referring to the definition of the flow in the spec itself, for example:
    • "there are several drawbacks to the Implicit grant type"
    • "the Authorization Code grant type enables the use of..."

Let me know if you have any suggestions for clarifying any of this, or any other helpful examples to add! I'm planning on adding this summary to OAuth 2.1 so that we have a formal reference for it in the future!

2024-03-28T08:35:56+00:00 Fullscreen Open in Tab
Some Git poll results

A new thing I’ve been trying while writing this Git zine is doing a bunch of polls on Mastodon to learn about:

  • which git commands/workflows people use (like “do you use merge or rebase more?” or “do you put your current git branch in your shell prompt?”)
  • what kinds of problems people run into with git (like “have you lost work because of a git problem in the last year or two?”)
  • which terminology people find confusing (like “how confident do you feel that you know what HEAD means in git?”)
  • how people think about various git concepts (“how do you think about git branches?”)
  • in what ways my usage of git is “normal” and in what ways it’s “weird”. Where am I pretty similar to the majority of people, and where am I different?

It’s been a lot of fun and some of the results have been surprising to me, so here are some of the results. I’m partly just posting these so that I can have them all in one place for myself to refer to, but maybe some of you will find them interesting too.

these polls are highly unscientific

Polls on social media that I thought about for approximately 45 seconds before posting are not the most rigorous way of doing user research, so I’m pretty cautious about drawing conclusions from them. Potential problems include: I phrased the poll badly, the set of possible responses aren’t chosen very carefully, some of the poll responses I just picked because I thought they were funny, and the set of people who follow me on Mastodon is not representative of all git users.

But here are a couple of examples of why I still find these poll results useful:

  • The first poll is “what’s your approach to merge commits and rebase in git”? 600 people (30% of responders) replied “I usually use merge, rarely/never rebase”. It’s helpful for me to know that there are a lot of people out there who rarely/never use rebase, because I use rebase all the time – it’s a good reminder that my experiences isn’t necessarily representative.
  • For the poll “how confident do you feel that you know what HEAD means in git?”, 14% of people replied “literally no idea”. That tells me to be careful about assuming that people know what HEAD means in my writing.

where to read more

If you want to read more about any given poll, you can click at the date at the bottom – there’s usually a bunch of interesting follow-up discussion.

Also this post has a lot of CSS so it might not work well in a feed reader.

Now! Here are the polls! I’m mostly just going to post the results without commenting on them.

merge and rebase

poll: what's your approach to merge commits and rebase in git?

merge conflicts

poll: if you use git, how often do you deal with nontrivial merge conflicts? (like where 2 people were really editing the same code at the same time and you need to take time to think about how to reconcile the edits)

another merge conflict poll:

have you ever seen a bug in production caused by an incorrect merge conflict resolution? I've heard about this as a reason to prefer merges over rebase (because it makes the merge conflict resolution easier to audit) and I'm curious about how common it is

I thought it was interesting in the next one that “edit the weird text file by hand” was most people’s preference:

poll: when you have a merge conflict, how do you prefer to handle it?

merge conflict follow up: if you prefer to edit the weird text file by hand instead of using a dedicated merge conflict tool, why is that?

poll: did you know that in a git merge conflict, the order of the code is different when you do a merge/rebase?

merge:

<<<<<<< HEAD
YOUR CODE
=======
OTHER BRANCH'S CODE
>>>>>>> c694cf8aabe

rebase:

<<<<<<< HEAD
OTHER BRANCH'S CODE
=======
YOUR CODE
>>>>>>> d945752 (your commit message)

(where "YOUR CODE" is the code from the branch you were on when you ran `git merge` or `git rebase`)

git pull

poll: do you prefer `git fetch` or `git pull`?

(no lectures about why you think `git pull` is bad please but if you use both I'd be curious to hear in what cases you use fetch!)

commits

[poll] how do you think of a git commit?

(sorry, you can't pick “it’s all 3”, I'm curious about which one feels most true to you)

branches

poll: how do you think about git branches? (I'll put an image in a reply with pictures for the 3 options)

as with all of these polls obviously all 3 are valid, I'm curious which one feels the most true to you

git environment

poll: do you put your current git branch in your shell prompt?

poll: do you use git on the command line or in a GUI?

(you can pick more than one option if it’s a mix of both, sorry magit users I didn't have space for you in this poll)

losing work

poll: have you lost work because of a git problem in the last year or two? (it counts even if it was "your fault" :))

meaning of various git terms

These polls gave me the impression that for a lot of git terms (fast-forward, reference, HEAD), there are a lot of git users who have “literally no idea” what they mean. That makes me want to be careful about using and defining those terms.

poll: how confident do you feel that you know what HEAD means in git?

another poll: how do you think of HEAD in git?

poll: when you see this message in `git status`:

”Your branch is up to date with 'origin/main’.”

do you know that your branch may not actually be up to date with the `main` branch on the remote?

poll: how confident do you feel that you know what the term "fast-forward" means in git, for example in this error message:

`! [rejected] main -> main (non-fast-forward)`

or this one:

fatal: Not possible to fast-forward, aborting.

(I promise this is not a trick question, I'm just writing a blog post about git terminology and I'm trying to gauge how people feel about various core git terms)

poll: how confident do you feel that you know what a "ref" or "reference" is in git? (“ref” and “reference” are the same thing)

for example in this error message (from `git push`)

error: failed to push some refs to 'github.com:jvns/int-exposed'

or this one: (from `git switch mybranch`)

fatal: invalid reference: mybranch

another git terminology poll: how confident do you feel that you know what a git commit is?

(not a trick question, I'm mostly curious how this one relates to people's reported confidence about more "advanced" terms like reference/fast-forward/HEAD)

poll: in git, do you think of "detached HEAD state" and "not having any branch checked out" as being the same thing?

poll: how confident do you feel that you know what the term "current branch" means in git?

(deleted & reposted to clarify that I'm asking about the meaning of the term)

other version control systems

I occasionally hear “SVN was better than git!” but this “svn vs git” poll makes me think that’s a minority opinion. I’m much more cautious about concluding anything from the hg-vs-git poll but it does seem like some people prefer git and some people prefer Mercurial.

poll 2: if you've used both svn and git, which do you prefer?

(no replies please, i have already read 300 comments about git vs other version control systems today and they were great but i can't read more)

gonna do a short thread of git vs other version control systems polls just to get an overall vibe

poll 1: if you've used both hg and git, which do you prefer?

(no replies please though, i have already read 300 comments about git vs other version control systems today and i can't read more)

that’s all!

It’s been very fun to run all of these polls and I’ve learned a lot about how people use and think about git.

2024-03-22T08:15:02+00:00 Fullscreen Open in Tab
The "current branch" in git

Hello! I know I just wrote a blog post about HEAD in git, but I’ve been thinking more about what the term “current branch” means in git and it’s a little weirder than I thought.

four possible definitions for “current branch”

  1. It’s what’s in the file .git/HEAD. This is how the git glossary defines it.
  2. It’s what git status says on the first line
  3. It’s what you most recently checked out with git checkout or git switch
  4. It’s what’s in your shell’s git prompt. I use fish_git_prompt so that’s what I’ll be talking about.

I originally thought that these 4 definitions were all more or less the same, but after chatting with some people on Mastodon, I realized that they’re more different from each other than I thought.

So let’s talk about a few git scenarios and how each of these definitions plays out in each of them. I used git version 2.39.2 (Apple Git-143) for all of these experiments.

scenario 1: right after git checkout main

Here’s the most normal situation: you check out a branch.

  1. .git/HEAD contains ref: refs/heads/main
  2. git status says On branch main
  3. The thing I most recently checked out was: main
  4. My shell’s git prompt says: (main)

In this case the 4 definitions all match up: they’re all main. Simple enough.

scenario 2: right after git checkout 775b2b399

Now let’s imagine I check out a specific commit ID (so that we’re in “detached HEAD state”).

  1. .git/HEAD contains 775b2b399fb8b13ee3341e819f2aaa024a37fa92
  2. git status says HEAD detached at 775b2b39
  3. The thing I most recently checked out was 775b2b399
  4. My shell’s git prompt says ((775b2b39))

Again, these all basically match up – some of them have truncated the commit ID and some haven’t, but that’s it. Let’s move on.

scenario 3: right after git checkout v1.0.13

What if we’ve checked out a tag, instead of a branch or commit ID?

  1. .git/HEAD contains ca182053c7710a286d72102f4576cf32e0dafcfb
  2. git status says HEAD detached at v1.0.13
  3. The thing I most recently checked out was v1.0.13
  4. My shell’s git prompt says ((v1.0.13))

Now things start to get a bit weirder! .git/HEAD disagrees with the other 3 indicators: git status, the git prompt, and what I checked out are all the same (v1.0.13), but .git/HEAD contains a commit ID.

The reason for this is that git is trying to help us out: commit IDs are kind of opaque, so if there’s a tag that corresponds to the current commit, git status will show us that instead.

Some notes about this:

  • If we check out the commit by its ID (git checkout ca182053c7710a286d72) instead of by its tag, what shows up in git status and in my shell prompt are exactly the same – git doesn’t actually “know” that we checked out a tag.
  • it looks like you can find the tags matching HEAD by running git describe HEAD --tags --exact-match (here’s the fish git prompt code)
  • You can see where git-prompt.sh added support for describing a commit by a tag in this way in commit 27c578885 in 2008.
  • I don’t know if it makes a difference whether the tag is annotated or not.
  • If there are 2 tags with the same commit ID, it gets a little weird. For example, if I add the tag v1.0.12 to this commit so that it’s with both v1.0.12 and v1.0.13, you can see here that my git prompt changes, and then the prompt and git status disagree about which tag to display:
bork@grapefruit ~/w/int-exposed ((v1.0.12))> git status
HEAD detached at v1.0.13

(my prompt shows v1.0.12 and git status shows v1.0.13)

scenario 4: in the middle of a rebase

Now: what if I check out the main branch, do a rebase, but then there was a merge conflict in the middle of the rebase? Here’s the situation:

  1. .git/HEAD contains c694cf8aabe2148b2299a988406f3395c0461742 (the commit ID of the commit that I’m rebasing onto, origin/main in this case)
  2. git status says interactive rebase in progress; onto c694cf8
  3. The thing I most recently checked out was main
  4. My shell’s git prompt says (main|REBASE-i 1/1)

Some notes about this:

  • I think that in some sense the “current branch” is main here – it’s what I most recently checked out, it’s what we’ll go back to after the rebase is done, and it’s where we’d go back to if I run git rebase --abort
  • in another sense, we’re in a detached HEAD state at c694cf8aabe2. But it doesn’t have the usual implications of being in “detached HEAD state” – if you make a commit, it won’t get orphaned! Instead, assuming you finish the rebase, it’ll get absorbed into the rebase and put somewhere in the middle of your branch.
  • it looks like during the rebase, the old “current branch” (main) is stored in .git/rebase-merge/head-name. Not totally sure about this though.

scenario 5: right after git init

What about when we create an empty repository with git init?

  1. .git/HEAD contains ref: refs/heads/main
  2. git status says On branch main (and “No commits yet”)
  3. The thing I most recently checked out was, well, nothing
  4. My shell’s git prompt says: (main)

So here everything mostly lines up, except that we’ve never run git checkout or git switch. Basically Git automatically switches to whatever branch was configured in init.defaultBranch.

scenario 6: a bare git repository

What if we clone a bare repository with git clone --bare https://github.com/rbspy/rbspy?

  1. HEAD contains ref: refs/heads/main
  2. git status says fatal: this operation must be run in a work tree
  3. The thing I most recently checked out was, well, nothing, git checkout doesn’t even work in bare repositories
  4. My shell’s git prompt says: (BARE:main)

So #1 and #4 match (they both agree that the current branch is “main”), but git status and git checkout don’t even work.

Some notes about this one:

  • I think HEAD in a bare repository mainly only really affects 1 thing: it’s the branch that gets checked out when you clone the repository. It’s also used when you run git log.
  • if you really want to, you can update HEAD in a bare repository to a different branch with git symbolic-ref HEAD refs/heads/whatever. I’ve never needed to do that though and it seems weird because git symbolic ref doesn’t check if the thing you’re pointing HEAD at is actually a branch that exists. Not sure if there’s a better way.

all the results

Here’s a table with all of the results:

.git/HEAD git status checked out prompt
1. checkout main ref: refs/heads/main On branch main main (main)
2. checkout 775b2b 775b2b399... HEAD detached at 775b2b39 775b2b399 ((775b2b39))
3. checkout v1.0.13 ca182053c... HEAD detached at v1.0.13 v1.0.13 ((v1.0.13))
4. inside rebase c694cf8aa... interactive rebase in progress; onto c694cf8 main (main|REBASE-i 1/1)
5. after git init ref: refs/heads/main On branch main n/a (main)
6. bare repository ref: refs/heads/main fatal: this operation must be run in a work tree n/a (BARE:main)

“current branch” doesn’t seem completely well defined

My original instinct when talking about git was to agree with the git glossary and say that HEAD and the “current branch” mean the exact same thing.

But this doesn’t seem as ironclad as I used to think anymore! Some thoughts:

  • .git/HEAD is definitely the one with the most consistent format – it’s always either a branch or a commit ID. The others are all much messier
  • I have a lot more sympathy than I used to for the definition “the current branch is whatever you last checked out”. Git does a lot of work to remember which branch you last checked out (even if you’re currently doing a bisect or a merge or something else that temporarily moves HEAD off of that branch) and it feels weird to ignore that.
  • git status gives a lot of helpful context – these 5 status messages say a lot more than just what HEAD is set to currently
    1. on branch main
    2. HEAD detached at 775b2b39
    3. HEAD detached at v1.0.13
    4. interactive rebase in progress; onto c694cf8
    5. on branch main, no commits yet

some more “current branch” definitions

I’m going to try to collect some other definitions of the term current branch that I heard from people on Mastodon here and write some notes on them.

  1. “the branch that would be updated if i made a commit”
  • Most of the time this is the same as .git/HEAD
  • Arguably if you’re in the middle of a rebase, it’s different from HEAD, because ultimately that new commit will end up on the branch in .git/rebase-merge/head-name
  1. “the branch most git operations work against”
  • This is sort of the same as what’s in .git/HEAD, except that some operations (like git status) will behave differently in some situations, like how git status won’t tell you the current branch if you’re in a bare repository

on orphaned commits

One thing I noticed that wasn’t captured in any of this is whether the current commit is orphaned or not – the git status message (HEAD detached from c694cf8) is the same whether or not your current commit is orphaned.

I imagine this is because figuring out whether or not a given commit is orphaned might take a long time in a large repository: you can find out if the current commit is orphaned with git branch --contains HEAD, and that command takes about 500ms in a repository with 70,000 commits.

Git will warn you if the commit is orphaned (“Warning: you are leaving 1 commit behind, not connected to any of your branches…”) when you switch to a different branch though.

that’s all!

I don’t have anything particularly smart to say about any of this. The more I think about git the more I can understand why people get confused.

2023-12-01T19:38:05-08:00 Fullscreen Open in Tab
I took the High-Speed Brightline Train from Miami to Orlando with only two hours notice

It was 11am at the Fort Lauderdale airport, an hour after my non-stop flight to Portland was supposed to have boarded. As I had been watching our estimated departure get pushed back in 15 minute increments, I finally received the dreaded news over the loudspeaker - the flight was cancelled entirely. As hordes of people started lining up to rebook their flights with the gate agent, I found a quiet spot in the corner and opened up my laptop to look at my options.

The other Alaska Airlines flight options were pretty terrible. There was a Fort Lauderdale to Seattle to Portland option that would have me landing at midnight. A flight on a partner airline had a 1-hour connection through Dallas, and there were only middle seats available on both legs. So I started to get creative, and searched for flights from Orlando, about 200 miles north. There was a non-stop on Alaska Airlines at 7pm, with plenty of available seats, so I called up customer service and asked them to change my booking. Since the delay was their fault, there were no change fees even though the flight was leaving from a different airport.

So now it was my responsibility to get myself from Miami to Orlando by 7pm. I could have booked a flight on a budget airline for $150, but it wouldn't have been a very nice experience, and I'd have a lot of time to kill in the Orlando airport. Then I remembered the Brightline train recently opened new service from Miami to Orlando, supposedly taking less time than driving there.

Brightline Station Fort Lauderdale

Brightline Station

Never having tried to take that train before, I didn't realize they run a shuttle service from the Fort Lauderdale airport to the train station, so I jumped in an Uber headed to the station. On the way there, I booked a ticket on my phone. The price from Miami to Orlando was $144 for Coach, or $229 for Premium class. Since this will probably be the only time I take this train for the foreseeable future, I splurged for the Premium class ticket to see what that experience is like.

Astute readers will have noticed that I mentioned I booked a ticket from Miami rather than Fort Lauderdale. We'll come back to that in a bit. Once I arrived at the station, I began my Brightline experience.

Walking in to the station felt like something between an airport and a car rental center.

Brightline Station entrance

There was a small ticket counter in the lobby, but I already had a ticket on my phone so I went up the escalators.

Brightline Station escalator

At the top of the escalators was an electronic gate where you scan your QR code to go through. Mine didn't work (again, more on that later), but it was relatively empty and a staff member was able to look at my ticket on my phone and let me through anyway. There was a small X-Ray machine, I tossed my roller bag and backpack onto the belt, but kept my phone and wallet in my pocket, and walked through the security checkpoint.

Once through the minimal security checkpoint, I was up in the waiting area above the platform with a variety of different sections. There was a small bar with drinks and snacks, a couple large seating areas, an automated mini mart, some tall tables...

Stool seating

More seating

Even more seating

Shop entrance

... and the entrance to the Premium lounge.

Brightline Station Premium Lounge

Premium Lounge entrance

The Premium Lounge entrance had another electronic gate with a QR code scanner. I tried getting in but it also rejected my boarding pass. My first thought was I booked my ticket just 10 minutes earlier so it hadn't synced up yet, so I went back to the the security checkpoint and asked what was wrong. They looked at my boarding pass and had no idea what was wrong, and let me in to the lounge via the back employee-only entrance instead.

Once inside the lounge, I did a quick loop to see what kind of food and drink options there were. The lounge was entirely un-attended, the only staff I saw were at the security checkpoint, and someone occasionally coming through to take out dirty dishes.

The first thing you're presented with after entering the lounge is the beverage station. There are 6 taps with beer and wine, and you use a touch screen to make your selection and pour what you want.

Beverages

On the other side of the wall is the food. I arrived at the tail end of the breakfast service, so there were pretty slim pickings by the end.

Breakfast

There were yogurts, granola, a bowl of bacon and egg mix, several kinds of pastries, and a bowl of fruit that nobody seemed to have touched. I don't know if this was just because this was the end of the morning, but if you were vegan or gluten free there was really nothing you could eat there.

There was also a coffee and tea station with some minimal options.

Coffee station

Shortly after I arrived, it rolled over to lunch time, so the staff came out to swap out the food at the food station. The lunch options were also minimal, but there was a bit more selection.

Lunch

There was a good size meat and cheese spread. I'm not a big fan of when they mix the meat and cheese on the same plate, but there was enough of a cheese island in the middle I was reasonably confident I wasn't eating meat juice off the side of the cheeses. The pasta dish also had meat so I didn't investigate further. Two of the three wraps had meat and I wasn't confident about which were which so I skipped those. There was a pretty good spinach and feta salad, and some hummus as well as artichoke dip, and a variety of crackers. If you like desserts, there was an even better selection of small desserts as well.

At this point I was starting to listen for my train's boarding announcement. There was really barely any staff visible anywhere, but the few people I saw had made it clear they would clearly announce the train over the loudspeakers when it was time. There was also a sign at the escalators to the platform that said boarding opens 10 minutes before the train departs.

Ten minute warning

The trains run northbound and southbound every 1-2 hours, so it's likely that you'll only hear one announcement for a train other than yours the entire time you're there.

Departure board

The one train announcement I heard was a good demonstration of how quickly the whole process actually is once the train shows up. The train pulls up, they call everyone down to the platform, and you have ten minutes to get onto the train. Ten minutes isn't much, but you're sitting literally right on top of the train platform so it takes no time to get down there.

View from the lounge

Once your train is called, it's time to head down the escalator to the train platform!

Boarding the Train

Escalators

Escalators

But wait, I mentioned my barcode had failed to be scanned a couple times at this point. Let me explain. Apparently, in my haste in the back of the Uber, I had actually booked a ticket from Miami to Orlando, but since I was already at the Fort Lauderdale airport, I had gone to the Fort Lauderdale Brightline station since it was the closest. So the departure time I saw on my ticket didn't match the time the train arrived at Fort Lauderdale, and the ticket gates refused to let me in because the ticket didn't depart from that station. I don't know why none of the employees who looked at my ticket mentioned this ever. It didn't end up being a big deal because thankfully Miami was earlier in the route, so I essentially just got on my scheduled train 2 stops late.

Brightline Route

So anyway, I made my way down to the platform to board the train. I should also mention at this point that I was on a conference call from my phone. I had previously connected my phone to the free wifi at the station, and it was plenty good enough for the call. As I went down the escalator to the platform, it broke up a bit in the middle of the escalator, but picked back up once I was on the platform outside.

Platform

There were some signs on the platform to indicate "Coach 1", "Coach 2" and "Coach 3" cars. However my ticket was a "Premium" ticket, so I walked to where I assumed the front of the train would be when it pulled up.

Train approach

I got on the train on the front car marked "SMART" and "3", seats 9-17. It wasn't clear what "SMART" was since I didn't see that option when booking online. My seat was seat 9A, so I wasn't entirely sure I was in the right spot, but I figured better to be on the train than on the platform, so I just went in. We started moving shortly after. As soon as I walked in, I had to walk past the train attendant pushing a beverage cart through the aisles. I made it to seat 9, but it was occupied. I asked the attendant where my seat was, and she said it was in car 1 at the "front", and motioned to the back of the train. I don't know why their cars are in the opposite order you'd expect. So I took my bags back to car 1 where I was finally greeted with the "Premium" sign I was looking for.

Premium

I was quickly able to find my seat, which was not in fact occupied. The Premium car was configured with 2 seats on one side and 1 seat on the other side.

The Brightline Premium Car

Premium Seats

Some of the seats are configured to face each other, so there is a nice variety of seating options. You could all be sitting around a table if you booked a ticket for 4 people, or you could book 2 tickets and sit either next to each other or across from each other.

Seating across

Since I had booked my ticket so last minute, I had basically the last available seat in the car so I was sitting next to someone. As soon as I sat down, the beverage cart came by with drinks. The cart looked like the same type you'd find on an airplane, and even had some identical warning stickers on it such as the "must be secured for takeoff and landing" sign. The drink options were also similar to what you'd get on a Premium Economy flight service. I opted for a glass of prosecco, and made myself comfortable.

The tray table at the seat had two configurations. You could either drop down a small flap or the whole tray.

Small tray table

Large tray table

The small tray was big enough to hold a drink or an iPad or phone, but not much else. The large tray was big enough for my laptop with a drink next to it as well as an empty glass or bottle behind it.

Under the seat there was a single power outlet for the 2 seats with 120v power as well as two USB-C ports.

Power outlets

Shortly after I had settled in, the crew came back with a snack tray and handed me these four snacks without really giving me the option of refusing any of them.

Snacks

At this point I wasn't really hungry since I had just eaten at the airport, so I stuffed the snacks in my bag, except for the prosciutto, which I offered to my seat mate but he refused.

By this point we were well on our way to the Boca Raton stop. A few people got off and on there, and we continued on. I should add here that I always feel a bit unsettled when there is that much movement of people getting on and off all the time. These stops were about 20-30 minutes away from each other, which meant the beginning of the ride I never really felt completely settled in. This is the same reason I prefer a 6 hour flight over two 3 hour flights. I like to be able to settle in and just not think about anything until we arrive.

We finally left the last of the South Florida stops, West Palm Beach, and started the rest of the trip to Orlando. A bunch of people got off at West Palm Beach, enough that the Premium cabin was nearly empty at that point. I was able to move to the seat across the aisle which was a window/aisle seat all to myself!

My own seat

Finally I could settle in for the long haul. Shortly before 3, the crew came by with the lunch cart. The options were either a vegetarian or non-vegetarian option, so that made the choice easy for me.

Lunch

The vegetarian option was a tomato basil mozzarella sandwich, a side of fruit salad, and some vegetables with hummus. The hummus was surprisingly good, not like the little plastic tubs you get at the airport. The sandwich was okay, but did have a nice pesto spread on it.

After lunch, I opened up my computer to start writing this post and worked on it for most of the rest of the trip.

As the train started making a left turn to head west, the conductor came on the loudspeaker and made an announcement along the lines of "we're about to head west onto the newest tracks that have been built in the US in 100 years. We'll be reaching 120 miles per hour, so feel free to feel smug as we whiz by the cars on the highway." And sure enough, we really picked up the speed on that stretch! While we had reached 100-120mph briefly during the trip north, that last stretch was a solid 120mph sustained for about 20 minutes!

Orlando Station

Orlando Station

We finally slowed down and pulled into the Orlando station at the airport.

Disembarking the train was simple enough. This was the last stop of the train so there wasn't quite as much of a rush to get off before the train started again. There's no need to mind the gap as you get off since there's a little platform that extends from the train car.

Don't mind the gap

At the Orlando station there was a short escalator up and then you exit through the automated gates.

Exit gates

I assumed I would have to scan my ticket when exiting but that ended up not being the case. Which actually meant that the only time my ticket was ever checked was when entering the station. I never saw anyone come through to check tickets on the train.

At this point I was already in the airport, and it was a short walk around the corner to the tram that goes directly to the airport security checkpoint.

The whole trip took 176 minutes for 210 miles, which is an average speed of 71 miles per hour. When moving, we were typically moving at anywhere from 80-120 miles per hour.

Summary

  • The whole experience was way nicer than an airplane, I would take this over a short flight from Miami to Orlando any day.
  • It felt similar to a European train, but with service closer to an airline.
  • The service needs to be better timed with the stops when people are boarding.
  • The only ticket check was when entering the station, nobody came to check my ticket or seat on the train, or even when I left the destination station.
  • While the Premium car food and drinks were free, I'm not sure it was worth the $85 extra ticket price over just buying the food you want.
  • Unfortunately the ticket cost was similar to that of budget airlines, I would have preferred the cost to be slightly lower. But even still, I would definitely take this train over a budget airline at the same cost.

We need more high speed trains in the US! I go from Portland to Seattle often enough that a train running every 90 minutes that was faster than a car and easier and more comfortable than an airplane would be so nice!

2023-10-23T09:12:55-07:00 Fullscreen Open in Tab
OAuth for Browser-Based Apps Draft 15

After a lot of discussion on the mailing list over the last few months, and after some excellent discussions at the OAuth Security Workshop, we've been working on revising the draft to provide clearer guidance and clearer discussion of the threats and consequences of the various architectural patterns in the draft.

I would like to give a huge thanks to Philippe De Ryck for stepping up to work on this draft as a co-author!

This version is a huge restructuring of the draft and now starts with a concrete description of possible threats of malicious JavaScript as well as the consequences of each. The architectural patterns have been updated to reference which of each threat is mitigated by the pattern. This restructuring should help readers make a better informed decision by being able to evaluate the risks and benefits of each solution.

https://datatracker.ietf.org/doc/html/draft-ietf-oauth-browser-based-apps

https://www.ietf.org/archive/id/draft-ietf-oauth-browser-based-apps-15.html

Please give this a read, I am confident that this is a major improvement to the draft!

2023-03-09T17:09:09-08:00 Fullscreen Open in Tab
OAuth Support in Bluesky and AT Protocol

Bluesky, a new social media platform and AT Protocol, is unsurprisingly running up against the same challenges and limitations that Flickr, Twitter and many other social media platforms faced in the 2000s: passwords!

yelp asks you to enter your gmail password

You wouldn't give your Gmail password to Yelp, right? Why should you give your Bluesky password to random apps either!

The current official Bluesky iOS application unsurprisingly works by logging in with a username and password. It's the easiest form of authentication to implement, even if it is the least secure. Since Bluesky and the AT Protocol are actually intending on creating an entire ecosystem of servers and clients, this is inevitably going to lead to a complete security disaster. In fact, we're already seeing people spin up prototype Bluesky clients, sharing links around to them, which result in users being taught that there's nothing wrong with handing out their account passwords to random website and applications that ask for them. Clearly there has to be a solution, right?

The good news is there has been a solution that has existed for about 15 years -- OAuth! This is exactly the problem that OAuth was created to solve. How do we let third party applications access data in a web service without sharing the password with that application.

What's novel about Bluesky (and other similarly decentralized and open services like WordPress, Mastodon, Micro.blog, and others), is that there is an expectation that any user should be able to bring any client to any server, without prior relationships between client developers and servers. This is in contrast to consumer services like Twitter and Google, where they limit which developers can access their API by going through a developer registration process. I wrote more about this problem in a previous blog post, OAuth for the Open Web.

There are two separate problems that Bluesky can solve with OAuth, especially a flavor of OAuth like IndieAuth.

  1. How apps can access data in the user's Personal Data Server (PDS)
  2. How the user logs in to their PDS

How apps can access the user's data

This is the problem OAuth solved when it was originally created, and the problem ATProto currently has. It's obviously very unsafe to have users give their PDS password to every third party application that's created, especially since the ecosystem is totally open so there's no way for a user to know how legitimate a particular application is. OAuth solves this by having the application redirect to the OAuth server, the user logs in there, and then the application gets only an access token.

ATProto already uses access tokens and refresh tokens, (although they strangely call them accessJwt and refreshJwt) so this is a small leap to make. OAuth support in mobile apps has gotten a lot better than it was 10 years ago, and there is first class support for this pattern on iOS and Android to make the experience work better than the much older plain redirect model used to work a decade ago.

Here is what the rough experience the user would see when logging in to an app:

app login flow

  1. The user launches the app and taps the "Sign In" button
  2. The user enters their handle or server name (e.g. jay.bsky.social, bsky.social, or aaronpk.com)
  3. The app discovers the user's OAuth server, and launches an in-app browser
  4. The user lands on their own PDS server, and logs in there (however they log in is not relevant to the app, it could be with a password, via email magic link, a passkey, or even delegated login to another provider)
  5. The user is presented with a dialog asking if they want to grant access to this app (this step is optional, but it's up to the OAuth server whether to do this and what it looks like)
  6. The application receives the authorization code and exchanges it at the PDS for an access token and refresh token


Most of this is defined in the core OAuth specifications. The part that's missing from OAuth is:

  • discovering an OAuth server given a server name
  • and how clients should be identified when there is no client preregistration step.

That's where IndieAuth fills this in. With IndieAuth, the user's authorization server is discovered by fetching the web page at their URL. IndieAuth avoids the need for client registration by also using URLs as OAuth client_ids.

This does mean IndieAuth assumes there is an HTML document hosted at the URL the user enters, which works well for web based solutions, and might even work well for Bluesky given the number of people who have already rushed to set their Bluesky handle to the same URL as their personal website. But, long term it might be an additional burden for people who want to bring their own domain to Bluesky if they aren't also hosting a website there.

There's a new discussion happening in the OAuth working group to enable this kind of authorization server discovery from a URL which could rely on DNS or a well-known endpoint. This is in-progress work at the IETF, and I would love to have ATProto/Bluesky involved in those discussions!

How the user logs in to their PDS

Currently, the AT Protocol specifies that login happens with a username and password to get the tokens the app needs. Once clients start using OAuth to log in to apps, this method can be dropped from the specification, which interestingly opens up a lot of new possibilities.

Passwords are inherently insecure, and there has been a multi-year effort to improve the security of every online service by adding two-factor authentication and even moving away from passwords entirely by using passkeys instead.

Imagine today, Bluesky wants to add multifactor authenticaiton to their current service. There's no good way to add this to the existing API, since the Bluesky client will send the password to the API and expect an access token immediately. If Bluesky switches to an OAuth flow described above, then the app never sees the password, which means the Bluesky server can start doing more fun things with multifactor auth as well as even passwordless flows!

Logging in with a passkey

Here is the same sequence of steps but this time swapping out the password step for a passkey.

app login flow with passkey

  1. The user launches the app and taps the "Sign In" button
  2. The user enters their handle or server name (e.g. jay.bsky.social, bsky.social, or aaronpk.com)
  3. The app discovers the user's OAuth server, and launches an in-app browser
  4. The user lands on their own PDS server, and logs in there with a passkey
  5. The user is presented with a dialog asking if they want to grant access to this app (this step is optional, but it's up to the OAuth server whether to do this and what it looks like)
  6. The application receives the authorization code and exchanges it at the PDS for an access token and refresh token

This is already a great improvement, and the nice thing is app developers don't need to worry about implementing passkeys, they just need to implement OAuth! The user's PDS implements passkeys and abstracts that away by providing the OAuth API instead.

Logging in with IndieAuth

Another variation of this would be if the Bluesky service itself supported delegating logins instead of managing any passwords or passkeys at all.

Since Bluesky already supports users setting their handle to their own personal website, it's a short leap to imaging allowing users to authenticate themselves to Bluesky using their website as well!

That is the exact problem IndieAuth already solves, with quite a few implementations in the wild of services that are IndieAuth providers, including Micro.blog, a WordPress plugin, a Drupal module, and many options for self-hosting and endpoint.

Let's look at what the sequence would look like for a user to use the bsky.social PDS with their custom domain handle mapped to it.

app login flow with indieauth

  1. The user launches the app and taps the "Sign In" button
  2. The user enters their server name (e.g. bsky.social)
  3. The app discovers the OAuth server and launches an in-app browser
  4. The user enters their handle, and bsky.social determines whether to prompt for a password or do an IndieAuth flow to their server
  5. The user is redirected to their own website (IndieAuth server) and authenticates there, and is then redirected back to bsky.social
  6. The user is presented by bsky.social with a dialog asking if they want to grant access to this app
  7. The application receives the authorization code and exchanges it at the PDS for an access token and refresh token

This is very similar to the previous flows, the difference being that in this version, bsky.social is the OAuth server as far as the app is concerned. The app never sees the user's actual IndieAuth server at all.

Further Work

These are some ideas to kick off the discussion of improving the security of Bluesky and the AT Protocol. Let me know if you have any thoughts on this! There is of course a lot more detail to discuss about the specifics, so if you're interested in diving in, a good place to start is reading up on OAuth as well as the IndieAuth extension to OAuth which has solved some of the problems that exist in the space.

You can reply to this post by sending a Webmention from your own website, or you can get in touch with me via Mastodon or, of course, find me on Bluesky as @aaronpk.com!