传统,却令人费解
"Traditional, but Puzzling"

原始链接: https://unsung.aresluna.org/traditional-but-puzzling/

1990年代,Unix sendmail可能返回令人困惑的邮件错误“User unknown: Not a typewriter.”这是因为sendmail将收件人名称转为小写,所以“MWichary”变成不存在的“mwichary”,然后追加了系统错误。“Not a typewriter”(ENOTTY)历史上表示后台进程缺少终端输入/输出,源自打字机/电传接口。冒号让它听起来像是用户应该是一台打字机。它后来被改名为“Inappropriate ioctl for device”,不过ENOTTY仍保留。

一个标题为“Traditional, but Puzzling”的 Hacker News 帖子链接到 aresluna.org,并收集关于令人困惑或措辞出人意料的信息的评论。用户讨论 Unix 错误 ENOTTY 的词源、一个停车场系统显示“Payment Declined: Exit permitted”、一条温馨的英国停车机信息“change possible”,以及 Linux 的“lp0 on fire”打印机错误。有一位评论者开玩笑说把标题误读为“traditional butt puzzling”。总体而言,该帖子收集了技术或服务信息含糊、有趣或历史上令人费解的例子。
相关文章

原文

In the 1990s, users of some Unix-based operating systems would sometimes see a peculiar error. It happened occasionally when sending an email to a person you might have already sent email to before, and in addition to the error being confusing, the message itself was particularly bewildering.

Let’s say you wanted to send an email to “MWichary.” Instead of a confirmation, you would see this:

550 mwichary... User unknown: Not a typewriter

As many strange errors tend to be, this one was at an intersection of four different things.

The cause of the error was something many of you will recognize – code being anal about lower- and uppercase. Behind the scenes, a piece of software called sendmail always assumed lowercase user names, which was true early on. “MWichary” was quietly changed to “mwichary” – a user that didn’t exist – and the program reported the literal outcome, instead of its chain of reasoning.

The second part was a sort of a meta-error in the error handling routine. Sendmail correctly reported back “User unknown,” but then reflexively added whatever the system error value reported, for extra debugging color. These are usually helpful, reporting things like “Host is down” or “No space left of device” – I bet you’ve seen some of the very distinctive strings if you ever did anything adventurous in the terminal.

In this particular context, however, the system error was pretty useless. “Not a typewriter” meant basically “this is a program being run in the background; it’s not meant to accept any user input or write anything for the user to read.” It’s not an error as much as a condition, and is true for a lot of programs quietly doing the operating system’s bidding.

But… why was the message phrased this way?

That’s just history. Computers were originally connected to typewriters as input/​output. Some of these typewriters were local, attached to the front panel, or console. Others were remote typewriters, or teletypewriters, often shortened to teletype or even tty. If you recognize these terms, that’s because they are still with us today!

You can see how “This doesn’t have input/​output I can do something with” can become a terse “Not a typewriter” in an era when every character feels costly, and a typewriter is your only option for input and output. Then, the string was simply kept a few decades too long, even after typewriters were replaced by teletypes, terminals with screens, and eventually Terminal and Console apps.

The fourth piece was fun with grammar: the simple choice of joining the two messages by a colon made it feel like the user was supposed to be a typewriter.

The message was eventually renamed. If you encounter it today, it will say “Inappropriate ioctl for device,” which I guess is an improvement. But its code remains ENOTTY.

It’s entirely possible it will still be named that decades from now, even after we all forget what typewriters were.

The title of the post comes from the explanation in the manual for the Solaris operating system.

联系我们 contact @ memedata.com