top | item 26845355

I Implemented /dev/printerfact in Rust

164 points| todsacerdoti | 4 years ago |christine.website

88 comments

order
[+] amluto|4 years ago|reply
> It's really annoying to contribute to the Linux Kernel Mailing list with my preferred email client (this is NOT an invitation to get plaintext email mansplained to me, doing so will get you blocked).

Heh. I really wish the kernel list would detect that a post has valid text and html content and just throw away the html rather than rejecting the whole thing. Plain text is, sadly, not a first class feature of most non-terminal email clients these days.

[+] aidenn0|4 years ago|reply
Every single gui email client I tried out a few months ago let me send plain text email. Some would not send HTML email though.

I suspect the author of TFA is using a webmail client, but as they did not state which client they are using, I cannot be sure.

[+] ben0x539|4 years ago|reply
Surely in the preceding decades someone has written an explicit LKML client, that, rather than implementing email and encouraging you to post to LKML, specifically implements the much narrower spec of the locally acceptable post/patch formats. `git send-email` really cannot be the apex of open-source contribution tooling evolution, can it?
[+] Tomte|4 years ago|reply
At the company I work for they invented a whole new process (yes, it's as bureaucratic as it sounds) for the two people who do Linux kernel development.

Because the LKML really doesn't like the standard corporate disclaimer (not just too long, but also not separated by "-- "), but company policy mandated it and company's mail server adds it automatically.

So these two colleagues got special IT treatment: the disclaimer is turned off, but they now got the obligation to manually add it whenever they mail somewhere external that is not LKML.

I certainly don't fault LKML, but I feel amused a little bit.

[+] nolok|4 years ago|reply
> this is NOT an invitation to get plaintext email mansplained to me

That person can reassure herself, there are just as many women know-it-all-better-than-you as there are men, arrogance and condescension are sadly not strictly male traits.

It tends to more often be guys in the tech world, sure, but then it's just https://xkcd.com/1138/

[+] globular-toast|4 years ago|reply
Odd to see this casual sexism thrown in at the end of a technical article. Imagine if I just randomly threw in how long women take to get ready or something at the end of a technical article. It would be completely bizarre and my sanity would probably be called into question.
[+] readingnews|4 years ago|reply
> I really wish the kernel list would detect that a post has valid text and html content and just throw away the html

Because. https://stackoverflow.com/questions/1732348/regex-match-open...

Honestly, I am not trying to put on my old-man hat, but I despise anything other than plain text in email. I agree with the KML. Email should not have binaries, html, tags, etc... of course, M$ and others will happily render them, so why not, right?

[+] j-krieger|4 years ago|reply
I enjoy christines style of writing very much. I can only recommend it to anyone out there interested in dev ops, rust or nix. Her narrative style and different characters may be a bit jarring at first, but I got used to it pretty fast.
[+] ecf|4 years ago|reply
On the other hand, I found this style of writing detestable.

> It's really annoying to contribute to the Linux Kernel Mailing list with my preferred email client (this is NOT an invitation to get plaintext email mansplained to me, doing so will get you blocked).

Get over it. The maintainers of the project have to keep in mind tens of thousands of contributors from all walks of life and I wouldn’t miss a single thing by being blocked by this author.

[+] iudqnolq|4 years ago|reply
> "Printers can judge within 3 inches the precise loprinterion of a sound being made 1 yard away."

> Printer facts were originally made by a very stoned person that had access to the Cat Facts API and sed. As such instances like indiprintere are features.

I love this.

[+] wildmanx|4 years ago|reply
It took me a sadly too-long time to realize that this had nothing to do with any printer API.

Like, I read the whole post, and all the comments here on HN. And only _then_ did it dawn on me.

[+] xena|4 years ago|reply
Author of the post here, I love those kinds of slow burns. I'm really glad you managed to experience one.
[+] xwx|4 years ago|reply
> Printers have been domestiprintered for half as long as scanners have been.
[+] malf|4 years ago|reply
> Printer facts were originally made by a very stoned person that had access to the Cat Facts API and sed. As such instances like indiprintere are features.
[+] xena|4 years ago|reply
It's a feature.
[+] tialaramex|4 years ago|reply
Note that the source JSON data is corrupted. Basically somebody has some UTF-8 encoded data but they've told a machine it is Latin-1 (ISO-8859-1) and then it has produced the Unicode escaped output as-if that was true, so for example where there should be a single Unicode codepoint for a dash, there is instead three nonsensical Unicode codepoints for Latin-1 characters you didn't mean.

You could probably fix that inside the driver, but likely the owner of the JSON file should just fix it to not be gibberish.

[+] lilyball|4 years ago|reply
I love this so much! It’s a really helpful demonstration of how to do Kernel stuff in Rust with Nix, using a ridiculous shitpost idea, and it’s written in a very enjoyable way. I’m just annoyed that I hadn’t run across their blog before now.
[+] whateveracct|4 years ago|reply
this is one of my favorite Nix blogs out there! the NixOS systemd timer one was great - I used it when I had to make my first timer and it was the best resource out there.

The narrative style made it a fun read too. Feels like someone explaining things to me personally off the cuff.

[+] xena|4 years ago|reply
Author of the post here. That's the style I try to go for, that balance of serious, shitpost and interesting side notes you'd get from DMing a particularly sarcastic coworker that means well on Slack. The Mara interludes add into this because it allows some blending in of the Socratic method to make some more complicated things something closer to a dialogue. I have plans to take this further though. If you have any suggestions on how I should skew these plans please let me know.
[+] Zardoz84|4 years ago|reply
Nice article. But I'm sad about how some morons reacted about the last paragraph.
[+] Grollicus|4 years ago|reply
How does this /dev/printerfacts react to partial reads? Does it mix multiple facts?
[+] xena|4 years ago|reply
If your buffer is too small it will just fail. It ends the file after a fact is returned. I think I forgot to shout that out in the article. Oops.
[+] xyst|4 years ago|reply
the use of the neopets-like characters is kind of distracting
[+] O_H_E|4 years ago|reply
I know I am being pedantic, but it is a bit weird to editorialize "How I Implemented /dev/printerfact in Rust" to "I Implemented...", make the author come off a little more boastful than they intended to.
[+] iudqnolq|4 years ago|reply
The author implemented /dev/printerfact. Someone else came up with printerfact. If someone said they implemented /dev/null I wouldn't think they came up with the concept of null.

Also printerfact was implemented by a high person with sed and a list of cat facts. While excellent, it's not an incredible achievement we need to defend the integrity of.

[+] pcr910303|4 years ago|reply
HN strips out prefix ‘How’s by default. I guess that was applied here as well...
[+] a_t48|4 years ago|reply
"I reimplemented" might be better