Skip to content

v0.2.2

Choose a tag to compare

@BaLaurent BaLaurent released this 15 Mar 20:06
· 34 commits to master since this release

The Identity Crisis: deez-notes v0.2.2

Chapter XVI: The Return of the DM

It had been barely 24 hours since the Great Theme Reconciliation of v0.2.1. The creator was finally sleeping. Peacefully. Dreaming of a world where every pixel knew its color.

Then the notification hit.

u/xX_DarkTerminal_Xx commented on r/commandline:

"Yo @deez-notes dev. Me again. So I installed your app on my Debian server — the one I use over SSH for my homelab notes. Launched it. Pressed Ctrl+V to view a note. And this happened."

Attached: a screenshot. The kind that makes senior developers involuntarily close their laptops.

mcat: invalid option -- '-'
Mtools version 4.0.49, dated June 14th, 2025
Usage: mcat [-V] [-w] device
       -w write on device else read

Viewer error: Viewer 'mcat' exited with status 1

--- Press any key to return ---

"Bro tried to read my floppy disk. I DON'T HAVE A FLOPPY DISK. It's 2026."

The post received the coveted "Bruh Moment" award.

Chapter XVII: The Impostor

The creator rubbed their eyes, read the error three times, and then opened a terminal.

$ which mcat
/usr/bin/mcat
$ mcat --version
Mtools version 4.0.49, dated June 14th, 2025

"…Mtools?"

Turns out, the mtools package — a collection of utilities for reading MS-DOS floppy disks — ships a binary called mcat. Its purpose? Reading raw data from floppy disk devices. Its flags? -V for version and -w for write mode. That's it. That's the whole program.

And deez-notes, in its infinite wisdom, found this binary on $PATH, went "ah yes, a Markdown viewer!", and handed it --paging always ~/notes/todo.md.

mcat (mtools edition) stared at --paging like a golden retriever staring at a calculus textbook.

mcat: invalid option -- '-'

"I am a floppy disk reader," it replied. "I don't know what a Markdown is. I barely know what a hard drive is."

Chapter XVIII: The Lineup

The creator opened external.rs and looked at the viewer resolution chain:

const FALLBACK_VIEWERS: &[&str] = &["mcat", "cat"];

The logic was simple — and fatally naïve:

  1. Is there a binary called mcat on PATH? → Yes ✅
  2. Then it must be the Skardyy Markdown viewer! → No ❌
  3. Pass --paging always → 💥

It was the software equivalent of calling "Hey John!" in a crowded room and being surprised when the wrong John answered.

Chapter XIX: The Interrogation

The fix needed to be surgical. You can't just remove mcat from the fallback chain — it's the good viewer when it's actually installed. The problem isn't that mcat is on PATH. The problem is which mcat is on PATH.

So the creator added an identity check:

/// Returns true if the mcat on $PATH is the mtools FAT-disk utility
/// rather than the Markdown viewer we actually want.
fn is_mtools_mcat() -> bool {
    Command::new("mcat")
        .arg("--version")
        .output()
        .map(|o| {
            let text = [&o.stdout[..], &o.stderr[..]].concat();
            let text = String::from_utf8_lossy(&text);
            text.contains("Mtools")
        })
        .unwrap_or(false)
}

"State your name and purpose," the code now asks every mcat it encounters.

If the response contains "Mtools" — "I'm here about the floppy disks" — the viewer is politely escorted out of the lineup and cat steps up instead.

If the response is anything else — "I render Markdown with syntax highlighting and a built-in pager" — welcome aboard.

Chapter XX: The Debrief

u/xX_DarkTerminal_Xx tested the fix:

"WORKS. My note opened in cat like a normal program. No floppy disk references. No existential crisis. No '90s hardware nostalgia trip."

"Although honestly? The error message was kind of funny. 'Mtools version 4.0.49' in a note-taking app. That's like opening Spotify and getting a fax machine."

"9.5/10. The 0.5 is for making me google what mtools is. I learned things I didn't want to know about FAT12 file systems."

The creator committed the fix, tagged the release, and added a mental note to never trust a binary by its name alone.


What Changed

Component Before After
find_viewer() Trusts any mcat on PATH Checks if mcat is the mtools impostor
mtools mcat present 💥 Crash: invalid option -- '-' Skipped gracefully → falls back to cat
Skardyy mcat present Works Still works — no behavior change
Neither mcat present Falls back to cat Falls back to cat (unchanged)

Who Should Update

  • Anyone on Debian/Ubuntu/Fedora where mtools is often pre-installed or pulled as a dependency
  • SSH/server users where the Skardyy mcat isn't installed but mtools is
  • u/xX_DarkTerminal_Xx — at this point he deserves a contributor badge

If you already have the Skardyy mcat installed, this doesn't affect you. Your viewer experience is unchanged.


Updating

Linux:

curl -L https://github.com/BaLaurent/deez-notes/releases/latest/download/deez-notes-linux-amd64 -o deez-notes
chmod +x deez-notes
sudo mv deez-notes /usr/bin/deez-notes

Windows:
Download deez-notes-windows-amd64.exe from the releases page and replace your existing binary.

From source:

cd deez-notes && git pull && cargo install --path .

Full Changelog: v0.2.1...v0.2.2