互联网与文化qntm.org
自杀式 Linux
Suicide Linux
2015 — 2020,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
Suicide Linux 是一个玩笑式的 Linux 发行版概念:在终端里输入任何返回非零退出码的命令,系统就会立即执行 rm -rf / 删除整个文件系统。文章介绍了这个想法,并指出其实际反应其实相当平淡——删根目录并不会立刻让系统崩溃,只是逐渐报错。它是对 Unix 错误处理哲学的一种极端讽刺。
为什么经久不衰:它用夸张的幽默揭示了命令行误操作的可怕后果,以及“失败即惩罚”这一逻辑的荒谬,是程序员文化中经久不衰的梗。
HN 评论精选
将 Suicide Linux 与要求证明代码正确的 Vigil 语言类比,都是对错误零容忍的极端设计。
这让我想起 Vigil,“永恒道德警惕的编程语言”。
sp332查看英文原文
This reminds me of Vigil, "the eternal morally vigilant programming language" https://github.com/munificent/vigil
实际误操作常常因为系统继续运行而延迟暴露,但后果往往更严重。
操作系统的反应其实相当平淡。与此相关,我前同事在一台旧 AIX 生产机上卸载了一些磁盘,他花了一整分钟才意识到由于一个笔误他错误地卸载了 /(是的,这是可能的),因为已经打开文件的旧进程还在正常服务,只有新尝试打开文件才开始报错。还有一次类似的激动时刻的交互失误:`somebox:~$ rm * .o` 返回 `rm: .o: No such file or directory`,然后他盯着提示符,才意识到所有 C 文件都被删了——而且显然没有版本控制。
lloeki查看英文原文
> The reaction from the OS is actually rather underwhelming. Somehow related, a coworker at a previous place unmounted some disks on an old AIX production box. It took him a solid minute to realise he had mistakenly unmounted / due to a typo (yes it was possible) as old processes with already opened files were happily serving stuff and only new attempts at opening files were beginning to produce errors. Also, a similar interactive mishap in the heat of the action: somebox:~$ rm * .o rm: .o: No such file or directory somebox:~$ # ... somebox:~$ # *stares a prompt* somebox:~$ # Wait, what? _Please_ tell me those C files were versioned! (The answer was, obviously, "no")
反向思维:与其立即惩罚错误,不如让错误尽可能晚被发现,讽刺了隐藏错误信息的危险。
这给了我一个想法:地狱 Linux。在地狱 Linux 中,操作系统尽力假装一切正常,让你花尽可能长的时间才意识到自己犯了错误。命令忽略所有无法识别的标志;shell 脚本中一个分支非零退出就执行另一个分支;stderr 总是重定向到 /dev/null;所有进程无论怎么终止都报告退出码 0;执行不存在的文件会运行一个立即退出的空进程(除非在管道中则消耗标准输入);读取不存在的 .json 文件会得到“{}”;日志里含“ERROR”或“WARN”的行被跳过;连接没有监听器的端口时尽力模拟该服务。哦,可能性……
dkarl查看英文原文
> Perhaps rm -rf / should be replaced with something with more verbose flags set. That way, when you run a bad command, you are told immediately that things are being deleted This gives me an idea: Hell Linux. In Hell Linux, the operating system does its best to pretend that nothing is wrong, so it takes you as long as possible to realize that you've made a mistake. Commands ignore all unrecognized flags. In shell scripts, if one branch exits with a nonzero exit code, the other branch is taken. stderr is always redirected to /dev/null. 0 exit code is reported for all processes, no matter how they terminate. If you try to exec a file that doesn't exist, it runs a process that does nothing and immediately exits, unless it is part of a pipeline, in which case it consumes standard in. If you try to read a .json file that doesn't exist, you get the bytes "{}". When you read a log file, any lines containing "ERROR" or "WARN" are skipped. If you try to connect to a port that nothing is listening on, it does its best to behave like the service that should be listening there. Oh, the possibilities....
指出 shell 命令的语法危险:意外提前回车可能执行宽泛操作,缺乏 GUI 式的确认机制。
大多数命令的问题在于,它们通常不需要极其不幸的笔误或俄罗斯轮盘赌式的 shell 才会变成错误:它们往往在你输入时就已是错的。我一直想知道能否防范意外提前回车的后果。`sudo rm -rf /tmp/workdir` 以 `sudo rm -rf /` 开头;`git reset libs` 以 `git reset` 开头,会清空暂存区;`docker-compose rm -f db` 以 `docker-compose rm -f` 开头,会移除所有已停止的容器及其日志。大多数命令在无参数时倾向于做非常宽泛的事,而路径从大文件夹向下到文件的写法也没帮忙。没有 GUI 工具会在你输入路径前要求确认,而 shell 命令往往如此。
remram查看英文原文
A problem with most commands is that they usually don't need extremely-unfortunate typos or russian-roulette-enabled shells to turn into something wrong: they are usually wrong in passing, while you're typing them. I always wondered if something could be done against the effects of an accidental premature return. Some of us have cats... `sudo rm -rf /tmp/workdir` starts with `sudo rm -rf /` `git reset libs` starts with `git reset` which will wipe your staging area `docker-compose rm -f db` starts with `docker-compose rm -f` which will remove all stopped containers (and their logs) Most commands just tend to do something very broad with no arguments, and the fact that paths start with bigger folders and go down to files doesn't help either. No GUI tool would ask you to confirm before you type in the path, the way shell commands tend to.
历次讨论
同类还值得读
如今电脑上几乎所有操作在感知上都比 1983 年更慢(2017)
Almost everything on computers is perceptually slower than it was in 1983 (2017)
2017 年的推文串认为,尽管计算机硬件比 1983 年快得多,日常操作的感知速度却常常更慢:启动、界面响应和网络应用被层层抽象、动画、后台检查与网络依赖拖累。
互联网与文化上首页 5 次 · 2017–2020twitter.com网站肥胖危机
The Website Obesity Crisis
Maciej Cegłowski(idlewords)的经典演讲文稿《网站肥胖症危机》,批评现代网页越来越臃肿:动辄数 MB 的 JavaScript、追踪脚本和广告,把本可以轻…
互联网与文化上首页 5 次 · 2016–2021idlewords.com编辑精选亚马逊那本标价 23,698,655.93 美元的苍蝇书
Amazon’s $23,698,655.93 book about flies
博文讲的是亚马逊上一本关于果蝇的二手书被标到 23,698,655.93 美元。
互联网与文化上首页 5 次 · 2011–2022michaeleisen.org浏览器 User-Agent 字符串的历史
History of the browser user-agent string (2008)
2008 年的经典文章用戏谑的“创世纪”口吻,讲述浏览器 User-Agent 字符串如何从简单的标识演变成层层叠加的伪装:浏览器为了绕过按 UA 分发的网站检测,纷纷把自己伪装…
互联网与文化上首页 5 次 · 2012–2022webaim.org编辑精选最后的问题——艾萨克·阿西莫夫
The Last Question - Isaac Asimov
阿西莫夫最著名的短篇科幻小说《最后的问题》的在线全文。
互联网与文化上首页 5 次 · 2009–2019multivax.com编辑精选