Jaunder

Post by mdorman

M
Michael Alan Dorman@mdorman

What I can't even

That was some choice

One of the things that occurred to me relatively late in the game was that jaunder really needed to sanitize any, say, location information in images you upload—especially since even with just the web-based version you can easily access the camera on your phone to make a post. You don't want to accidentally give away the location of the house in an image you post to your blog.

The gold standard for tools to munge metadata in images has long been this command-line tool called ExifTool. Version 1.0 was released in 2003, which means that it's written in the dominant language for a Certain Sort of Tool at a Certain Time in History: Perl.

Since my goal has been for jaunder to ship as a single binary, using ExifTool was a non-starter. Fortunately, I found that someone had started a tool called exiftool-rs—a Rust-based re-implementation of ExifTool, usable as a library. Precisely what I needed!

Of course, I did run into some issues—I submitted four bug reports over the course of a few days, all of which were addressed promptly. That said, I have to admit that I didn't submit bug fixes as well because, honestly, I found the code to be less modular and clear-cut than I might have hoped: every fix I attempted seemed to point to doing architectural reworking that I wasn't going to take on without consulting the author.

Or, let's just say it: it seemed vibe coded.

Still, the code got to a point very quickly where it seemed to be doing what I needed it to do, and we were comparing its output to the original ExifTool as a backstop, so I felt comfortable shipping it.

However what I'd forgotten was that the early versions weren't released, so I was referencing a particular git commit in my cargo.toml file—and I'd accidentally burned myself doing that for a different library, so I decided to check on the status of exiftool-rs. And lo and behold, it had gone 1.0! Great, we could get rid of the tagged commit and use it like a regular library! So I went to look at the changes that had been made in the intervening time…

The author had made the decision to scrap reimplementing the individual parsers and writers in Rust, and instead decided to write an interpreter for a Perl subset in Rust, so that the original ExifTool implementation could literally be embedded and interpreted, but with a Rust library interface.

Nope.

You know, in a way, this was clarifying: I only care about stripping a certain amount of metadata from a limited set of image formats—it's unfortunate that there are no libraries for Rust that do that, but it's easy enough to ask Claude to ship something up. It's a few hundred lines of code—versus the many thousands that were in the Rust-implemented version of exiftool-rs. And it's write-once—once it's working correctly, there's not going to be substantial policy changes or anything like that. It will be easy to maintain.

Anyway, it reminds me of a passage from Vernor Vinge's A Deepness in the Sky:

Pham Nuwen spent years learning to program/explore. Programming went back to the beginning of time. It was a little like the midden out back of his father’s castle. Where the creek had worn that away, ten meters down, there were the crumpled hulks of machines—flying machines, the peasants said—from the great days of Canberra’s original colonial era. But the castle midden was clean and fresh compared to what lay within the Reprise’s local net. There were programs here that had been written five thousand years ago, before Humankind ever left Earth. The wonder of it—the horror of it, Sura said—was that unlike the useless wrecks of Canberra’s past, these programs still worked! And via a million million circuitous threads of inheritance, many of the oldest programs still ran in the bowels of the Qeng Ho system. Take the Traders’ method of timekeeping. The frame corrections were incredibly complex—and down at the very bottom of it was a little program that ran a counter. Second by second, the Qeng Ho counted from the instant that a human had first set foot on Old Earth’s moon. But if you looked at it still more closely…the starting instant was actually about fifteen million seconds later, the 0-second of one of Humankind’s first computer operating systems.

So behind all the top-level interfaces was layer under layer of support. Some of that software had been designed for wildly different situations. Every so often, the inconsistencies caused fatal accidents. Despite the romance of spaceflight, the most common accidents were simply caused by ancient, misused programs finally getting their revenge.

“We should rewrite it all,” said Pham.

“It’s been done,” said Sura, not looking up. She was preparing to go off-Watch, and had spent the last four days trying to root a problem out of the coldsleep automation.

“It’s been tried,” corrected Bret, just back from the freezers. “But even the top levels of fleet system code are enormous. You and a thousand of your friends would have to work for a century or so to reproduce it.” Trinli grinned evilly. “And guess what—even if you did, by the time you finished, you’d have your own set of inconsistencies. And you still wouldn’t be consistent with all the applications that might be needed now and then.”