Why writing a system cleaner is hard

From the outside, a cleaner looks like one of the simplest apps in any category: find files, delete files, show a number that went down. To-do lists and note apps get cloned by the dozen because the blast radius of a bug is small. A cleaner is the opposite. Its entire job is deleting files that live next to the operating system and the user’s data, often with elevated privileges, on behalf of people who may not understand what it just did. That combination makes cleaners one of the harder categories of software to get right, and one of the more attractive ones to get wrong on purpose.

If you are thinking about writing one, this page is the job description. If you are deciding whether an existing one deserves your trust, that is a different question: is this a good cleaner?

The blast radius is the whole product

It needs privileges, and privileges are the attack surface

The target never stops moving

The scoreboard rewards the wrong thing

The takeaway

The code in a cleaner is not the hard part. The hard parts are everything around it: keeping privileges small, surviving a hostile filesystem, tracking a moving target, and resisting the scoreboard’s pressure to make a small honest number bigger. And even if you get all of it right, you still have to prove you are the safe one in a category where accidents, exploits, and counterfeits all wear the same icon.

The other half of that problem sits with the user: telling the good ones from the bad before installing. That is a different page: is this a good cleaner?

Last reviewed