mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Merge pull request #29726 from wxy/20221031.0-⭐️⭐️⭐️-20-technology-horror-stories-about-learning-the-hard-way
ATRP:20221031.0 ⭐️⭐️⭐️ 20 technology horror stories about learning the hard way
This commit is contained in:
commit
c6da3ea64c
@ -0,0 +1,263 @@
|
||||
[#]: subject: "20 technology horror stories about learning the hard way"
|
||||
[#]: via: "https://opensource.com/article/22/10/technology-horror-stories"
|
||||
[#]: author: "AmyJune Hineline https://opensource.com/users/amyjune"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "ChatGPT"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-16010-1.html"
|
||||
|
||||
20 个恐怖传说:在技术上犯过的最糟糕错误
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> 一些系统管理员、网页设计师、工程师和程序员分享了他们在命令行上经历的最可怕的经历。
|
||||
|
||||
每个开发人员内心最害怕的事情是什么?在你的代码开始运行前的宁静时刻,什么最让你感到恐怖?你见过或写过最可怕的代码是什么?
|
||||
|
||||
### 错误的权限
|
||||
|
||||
我负责一台服务器,然后我通过 FTP 上传了一些东西。显示了一些奇怪的东西,所以我想权限可能需要改变一下。
|
||||
|
||||
不用说,我愚蠢地关闭了读取权限并使网站瘫痪了。(当没有人能访问时,网站就没啥用了。)
|
||||
|
||||
我花了几个小时才修复好。这是很多年前我在一个机构担任唯一的网页开发人员时的事情。
|
||||
|
||||
— [Miriam Goldman][1]
|
||||
|
||||
### 混乱的 HTML
|
||||
|
||||
我曾经因 WordPress 的默认主题有可用的更新而使一个客户的网站瘫痪,这个客户当时是《华尔街日报》畅销书榜上的一位作者。
|
||||
|
||||
他的开发人员在主题中硬编码了 HTML,而不是创建一个子主题。而我运行了更新操作。
|
||||
|
||||
那个年代,人们不容易实现每晚备份,所以我花了几个小时打电话给托管提供商。像分阶段发布、子主题、每晚备份或手动备份这样的东西现在都很常见,还有自动更新和手动回滚的能力。但在那个时代并不常见。
|
||||
|
||||
— [Courtney Robertson][2]
|
||||
|
||||
### 密钥不再秘密
|
||||
|
||||
我想我们中的许多人在公共代码中看到过密钥。或者另一个经典案例:我的一个朋友从开发服务器向 10 万个用户发送电子邮件。
|
||||
|
||||
— [John E. Picozzi][3]
|
||||
|
||||
### Unix 混乱
|
||||
|
||||
这是一个 Unix 的故事。今天在 [Linux][4] 中已经修复了这个问题。
|
||||
|
||||
在我要向管理层进行一个重要的新组件演示的前一天,我需要更新我的代码(这是在 [Git][5] 存在之前的年代)。我进入我的主目录,找到项目目录,然后删掉了一切。不幸的是,在那个版本的 Unix 中,该命令会跟随符号链接进行删除,并且我有一个链接指向代码的最新版本(并不是所有代码都在源代码系统中,因为它还处于测试阶段)。
|
||||
|
||||
好在一天后,大楼里出现了网络问题,因此演示推迟了一天,我们设法恢复了代码。那是三十多年前的事情。即使现在我也不知道网络问题是巧合,还是我们的系统管理员试图帮助我们(如果是这样,那确实奏效了!)
|
||||
|
||||
— [Josh Salomon][6]
|
||||
|
||||
### 命令式编程
|
||||
|
||||
看到 CSS 文件中到处都是 `!important;` 而不是正确使用特异性。
|
||||
|
||||
我曾经不得不覆盖和定制一个 WordPress 主题几乎所有的 CSS,因为该网站的所有者坚持不换一个更接近他想要的设计的新主题。
|
||||
|
||||
那个主题开发者最后一次更新是在 2018 年,但网站至今仍在使用。
|
||||
|
||||
— [Christi Nickerson][7]
|
||||
|
||||
### 错误引用
|
||||
|
||||
在我以前的职位上,我的前任在代码注释中引用了 Journey 的《Any Way You Want It》歌词错误。
|
||||
|
||||
— [Ben Cotton][8]
|
||||
|
||||
### Algol68 的幽灵
|
||||
|
||||
在上世纪 60 年代末到 70 年代初,Algol68 的复杂性使许多有影响力的人望而却步,包括 Niklaus Wirth 在内。我记得当时最常见的抱怨之一是:“谁能为这样一个复杂的怪物写一个编译器呢?” 但是事实上,许多人都开发过。此外,许多在 [Algol68][9] 中发展出来的或至少以形式化的概念出现在后来的其他语言中,尤其是在 C 语言和 Bourne shell 中(感谢 Steve Bourne)。
|
||||
|
||||
Algol68 的一些概念并没有经过很好的演化。例如,处理“书”和“章节”等的 I/O 概念在今天有些奇怪。像将字符集等问题留给实现本身处理似乎相当过时。
|
||||
|
||||
但是其中一些概念在今天仍然极为重要,例如产生值的表达式、强类型化(Algol68 中称为“模式”的类型)、[堆内存和垃圾回收][10]、运算符的定义和重载等等。
|
||||
|
||||
有好的地方,也有不好的地方。
|
||||
|
||||
Algol68 是一门值得学习的语言,即使只是为了了解现代计算中的许多想法的来源以及在路上丢失了多少。
|
||||
|
||||
— [Chris Hermansen][11]
|
||||
|
||||
### 密码暴露
|
||||
|
||||
我为一个新的支持客户进行技术审计时,发现之前的开发人员将密码以明文形式存储在整个主题中,并使用了糟糕的方式连接到远程数据库。他们的 composer 文件也异常庞大。每次我尝试在本地运行网站时,需要花费五分钟的时间。过时的依赖项、我无法访问的仓库,问题还有很多。
|
||||
|
||||
— [Miriam Goldman][1]
|
||||
|
||||
### 迷宫般的代码
|
||||
|
||||
我见过的最可怕的代码是一段 PDP-11 汇编语言,位于一个名为 RSTS 的操作系统的内核中,今天已经没有人记得它了。当时源代码记录在胶片上,我跟随这段代码路径经过几个转折,试图弄清楚正在发生的事情。然后,我遇到了这条指令:
|
||||
|
||||
```
|
||||
MOV R5,PC
|
||||
```
|
||||
|
||||
我举起双手尖叫了起来。真的,我尖叫了。办公室里的人以为我撞到头了,或者心脏病发作了。
|
||||
|
||||
那个年代,内存是宝贵的,`MOV` 指令使用的内存比 `BR`(即“分支”)指令稍微少一点。将寄存器 5 的内容复制到程序计数器实际上是一个廉价的无条件跳转,跳转到寄存器 5 中存储的地址。但是,我不知道寄存器 5 中存储了什么,也不知道如何找到它。
|
||||
|
||||
时至今日,将近 40 年过去了,我仍然想知道是谁写出这样的代码,以及如何调试它。
|
||||
|
||||
— [Greg Scott][12]
|
||||
|
||||
### 差一个
|
||||
|
||||
我在自动化行业工作,其中的可编程逻辑控制器(PLC)使用一些相当奇怪的语言进行编程。
|
||||
|
||||
让我印象深刻的一个例子是,在 [ST][13] 语言中,你可以定义数组从索引 1 开始。这意味着第一个元素在位置 1 而不是 0。每当我看到这个时,我都会抓狂。
|
||||
|
||||
— [Stephan Avenwedde][14]
|
||||
|
||||
### 分歧
|
||||
|
||||
有一次在一个从测试环境到生产环境的发布期间,我让 MongoDB 实例停机了 40 分钟。我们的测试环境与生产环境有所分歧。只是一个数据库配置的差异,没什么太激动人心的东西。但这是一个很好的教训,要确保你的测试和生产环境保持同步!
|
||||
|
||||
— [Em Nouveau][15]
|
||||
|
||||
### 神秘的低语
|
||||
|
||||
这是一个仍在运行且正常的项目,但我已经修改了代码以隐藏源代码。
|
||||
|
||||
```
|
||||
for(int c =0; y < yyy && c < ccc; y++, c++){// some code here}
|
||||
```
|
||||
|
||||
乍看起来,它似乎是一个无害的循环。但也许你会问为什么有两个变量、两个停止条件以及两个增量。然后你会意识到只有一个初始化器,第二个变量(`y`)在这个循环之前在不同的代码块中被初始化。
|
||||
|
||||
当我意识到这一点时,我花了大约一个小时的时间来理解为什么代码是这样编写的,以及它应该如何工作。显然,代码中没有 `c` 的注释,并且变量名是无意义的(代码中被称为 `c`,`y` 有一个稍微具有意义的名称,但不足以解释它的意义,即使是今天我也不知道它的作用)。
|
||||
|
||||
— [Josh Salomon][6]
|
||||
|
||||
### 关键数据
|
||||
|
||||
大约在 1980 年,我在大学毕业后得到了我的第一份工作。我是印第安那州一所工程学院的计算中心副主管。这是一个两人 IT 部门的辅助职位。我在 PDP-11/40 上处理行政计算,使用 RK05 可移动的“披萨碟”磁盘驱动器(每个驱动器容量为 2.5 MB)。每个行政办公室都有一个驱动器,而我工作的一部分就是每周进行磁盘对磁盘的备份。但是那个夏天我很忙,连续四周没有备份过注册办公室的数据。然后我意识到了风险,所以我确保开始进行每月的磁盘到磁带备份。
|
||||
|
||||
我从 11/40 上卸载了注册办公室的磁盘驱动器,然后装在了带有一台 9 磁道磁带驱动器的 11/70 上,并开始进行备份。几分钟后,我听到磁盘驱动器里传来一阵刮擦的声音。是的,磁头撞上了磁盘。在短短几分钟内,我摧毁了所有注册办公室的数据,以及最新的备份 —— 一个四周前的 9 磁道磁带。
|
||||
|
||||
当我不得不面对注册办公室主任,并告诉他我已经摧毁了他所有的数据时,那一刻真的很尴尬。
|
||||
|
||||
如今,我告诉新的 IT 人员,只有在你摧毁了某人的关键数据,而且无法恢复时,你才算是专业人士。永远记住你胃里的那种感觉。
|
||||
|
||||
— [Greg Scott][12]
|
||||
|
||||
### 愤怒的暴民
|
||||
|
||||
一个客户篡改了 WordPress 核心代码以添加后续在常规更新中发布的功能,但他们却不明白为什么在每次尝试更新 LearnDash 时网站都会崩溃。(他们也不喜欢我们的报告指出了他们糟糕的开发实践。)于是他们赶我们走,称我们是骗子和无能之辈。但直到今天,我仍然具有他们域名的委派访问权限,以及两个域名的生产和开发环境的 wp-admin 访问权限。
|
||||
|
||||
此外,尽管我们给了一个加密位置的链接用于共享访问凭据,他们却通过电子邮件发送了我们的登录信息。
|
||||
|
||||
— [Laura Byrne][16]
|
||||
|
||||
### 不要忘记备份
|
||||
|
||||
我在企业网络上的工作经验不多,所以我没有使任何服务器崩溃过。然而,作为一个年轻人,我曾经试图帮助一个人解决 IT 问题,不知何故导致 Windows 95 崩溃,并不得不免费重新安装。
|
||||
|
||||
作为一个非常年轻的 Amiga 用户,我最悲伤的时刻之一是我的保存磁盘坏掉了,里面装满了所有我的文件,原因是某种机械故障。如今,我已经学会更好地备份我的重要个人文件。
|
||||
|
||||
— [Rikard Grossman-Nielsen][17]
|
||||
|
||||
### 万恶之源
|
||||
|
||||
当时我刚开始接触 Linux,之前我用的是 DOS,借助 Norton Commander 进行操作。后来,Midnight Commander 发布了,我非常喜欢它。当时我使用的 Linux 发行版(Jurix)没有打包 Midnight Commander,所以我自己从源代码编译了它,就像我那个时候使用的其他软件一样。它完美地运行了,突然间我在 Linux 上感到更亲切了。
|
||||
|
||||
这不是一个恐怖的故事。
|
||||
|
||||
我的同事告诉我不要以 root 身份运行 Midnight Commander,无论它有多么让人舒适。但是 root 权限很方便,感觉更像 DOS,所以我无视了他们的建议。结果就是:我意外地删除了整个 `/etc` 目录的内容。在那之前,我从来没有用过备份功能,但是那一天我意识到备份实际上是有用的。
|
||||
|
||||
27 年过去了,我仍然记得这个故事,并定期进行备份。
|
||||
|
||||
— [Peter Czanik][18]
|
||||
|
||||
### 幻觉
|
||||
|
||||
最糟糕的项目是一家代理机构让我做的一个一屏的页面,一开始看起来很简单。我说我可以用一些 HTML、CSS,也许加点 JavaScript,将其组合起来。但他们特别要求我不要这样做。他们希望我将设计图剪切下来,然后使用 CSS 在页面中定位这些元素。他们还要求我将所有的 CSS 内嵌到 HTML 文件中,因为他们真的只想要**一个页面**。
|
||||
|
||||
其中的文本都不是真实的文本。
|
||||
|
||||
除了定位这些图片所需的元素之外,其他都不是真正的 HTML 元素。
|
||||
|
||||
我告诉他们,设计足够简单,我可以用实际的代码将其组合起来,但他们不想要那样。他们只想让我花时间将这些碎片拼凑在一起,然后转而做其他项目。他们让我做了两个类似的一屏网站。
|
||||
|
||||
这实在伤害了我的前端灵魂。为我来说,这个项目在身体上是痛苦的。这是一个试用合同职位,当他们给我提供全职工作时,我礼貌地拒绝了。
|
||||
|
||||
— [Rachel Vasquez][19]
|
||||
|
||||
### 内存破坏
|
||||
|
||||
对我来说,最可怕的事情就是 ANSI C99 中可能发生的内存破坏。在一个屏幕录像中,我捕捉到了这个(不完全是)超自然现象,可以在这个 [YouTube 视频片段][20] 中观看到。
|
||||
|
||||
![Image of gseqencer before memory corruption.][21]
|
||||
|
||||
标有 `file` 的 GtkEntry 显示了一些随机的符号。我检查了一下 [代码][22],但没有发现任何问题。
|
||||
|
||||
`ags_export_soundcard_open_response_callback()` 函数是一个回调函数,用于处理 `GtkFileChooserDialog` 的 `response` 事件。(顺便说一句,用于解决这个问题的工具是 [valgrind][23]。)
|
||||
|
||||
![Image of gsequencer after memory corruption.][24]
|
||||
|
||||
— [Joël Krähemann][25]
|
||||
|
||||
### Python 的恐怖之处
|
||||
|
||||
我见过的最可怕的编程特性是 Python 中对 `dict` 的访问权限。在运行时改变对象的类型违背了我的编程行为准则。
|
||||
|
||||
— [Josh Salomon][6]
|
||||
|
||||
### 缝合怪网络
|
||||
|
||||
在 2006 年,我用 Fedora 和一些脚本构建了一台防火墙,并说服了一家托管在合作数据中心的大型网站的客户,将其专有的防火墙替换为我的防火墙。我建立了系统并在一个清晨的 4 点到达现场进行安装。那时我才发现(饱受痛苦地)他在防火墙后面有一个带有公共 IP 地址的负载均衡器。客户经历了一个 5 分钟的停机时间,但我重新连接了一切恢复到原来的状态。
|
||||
|
||||
我发现了一种通过使用代理 ARP 来处理他复杂的网络配置的方法。这个想法是,当外部世界的任何人发出负载均衡器的 ARP 请求时,我会进行回应。几天后,我再次在凌晨 4 点出现并安装了我的系统。这次,我把整个数据中心的所有设备都给搞宕了。我设置了我的代理 ARP 来回应所有请求,因此局域网上的所有流量最终都找到了我并消失在黑洞中。
|
||||
|
||||
当我意识到我做了什么时,我把一切都恢复到原来的状态。但是损害已经造成。如果有人在 2006 年的一个清晨美国中部时间大约 4 点钟尝试浏览你最喜欢的网站,它没有响应,那可能是我的错。我通过在机架上安装并启动一个系统,让整个数据中心的网站都宕机了。
|
||||
|
||||
网站运营商愤怒地抗议,而我则黯然离开。他们再也没有邀请我回去再试。真是遗憾,我觉得再试试桥接可能会起作用。
|
||||
|
||||
— [Greg Scott][12]
|
||||
|
||||
### 你的恐怖故事
|
||||
|
||||
你最喜欢的与技术相关的恐怖故事是什么?在评论中告诉我们(但要友善,并更改项目名称以保护无辜者!)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/10/technology-horror-stories
|
||||
|
||||
作者:[AmyJune Hineline][a]
|
||||
选题:[lkxed][b]
|
||||
译者:ChatGPT
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/amyjune
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/users/miriamgoldman
|
||||
[2]: https://opensource.com/users/courtneyrdev
|
||||
[3]: https://opensource.com/users/johnpicozzi
|
||||
[4]: https://opensource.com/tags/linux
|
||||
[5]: https://opensource.com/downloads/cheat-sheet-git
|
||||
[6]: https://opensource.com/users/joshs
|
||||
[7]: http://cnickerson.com
|
||||
[8]: https://opensource.com/users/bcotton
|
||||
[9]: https://opensource.com/article/20/12/learn-algol-68
|
||||
[10]: https://opensource.com/article/22/6/garbage-collection-java-virtual-machine
|
||||
[11]: https://opensource.com/users/clhermansen
|
||||
[12]: https://opensource.com/users/greg-scott
|
||||
[13]: https://en.wikipedia.org/wiki/Structured_text
|
||||
[14]: https://opensource.com/users/hansic99
|
||||
[15]: https://opensource.com/users/nouveau
|
||||
[16]: http://twitter.com/@NewYorkerLaura
|
||||
[17]: https://opensource.com/users/rikardgn
|
||||
[18]: https://opensource.com/users/czanik
|
||||
[19]: https://opensource.com/users/rachievee
|
||||
[20]: https://youtu.be/Go6r-CT06zc?t=103
|
||||
[21]: https://opensource.com/sites/default/files/2022-10/gsequencer-before-memory-corruption.png
|
||||
[22]: https://git.savannah.nongnu.org/cgit/gsequencer.git/tree/ags/app/ags_export_soundcard_callbacks.c?h=4.4.x#n397
|
||||
[23]: https://opensource.com/article/21/8/memory-programming-c
|
||||
[24]: https://opensource.com/sites/default/files/2022-10/scarygsequencer-after-memory-corruption.png
|
||||
[25]: https://opensource.com/users/joel2001k
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202307/18/145614vx7pqwwkkrsx6zxv.jpg
|
@ -1,262 +0,0 @@
|
||||
[#]: subject: "20 technology horror stories about learning the hard way"
|
||||
[#]: via: "https://opensource.com/article/22/10/technology-horror-stories"
|
||||
[#]: author: "AmyJune Hineline https://opensource.com/users/amyjune"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
20 technology horror stories about learning the hard way
|
||||
======
|
||||
|
||||
Sysadmins, web designers, engineers, and programmers share their scariest experiences on the command line.
|
||||
|
||||
Halloween will be here before you know it! This fun, over-the-top holiday is a great time to ponder the mortal fears of the developer in each of us. What haunts you the most, in the quiet moments just before your code starts to run?
|
||||
|
||||
Getting into the spirit of Halloween, I asked some Opensource.com writers: What's the scariest code you've seen or written?
|
||||
|
||||
### Bad permissions
|
||||
|
||||
I was responsible for a server, and I FTP'd something up. There were some funky things displaying, so I thought some permissions needed to be changed.
|
||||
|
||||
Needless to say, I foolishly turned off read mode and took down the site. (A website is not much good when nobody can access it.)
|
||||
|
||||
It took me hours to fix. This was at an agency years ago when I was the sole web developer.
|
||||
|
||||
—[Miriam Goldman][1]
|
||||
|
||||
### Shambling HTML
|
||||
|
||||
I took down a client's website, who was an author on the Wall Street Journal bestseller list at the time, because the original WordPress default theme had an update available.
|
||||
|
||||
His developer had hardcoded HTML into the theme instead of creating a child theme. I ran the update.
|
||||
|
||||
This was in the days when folks didn't have nightly backups easily, so I spent hours on the phone with the hosting provider. Things like staging, child themes, nightly backups, or manual backups, are all now normal things, as well as the ability to auto-update and manually roll back. Not so in that era.
|
||||
|
||||
—[Courtney Robertson][2]
|
||||
|
||||
### Not-so-secret key
|
||||
|
||||
I think many of us have seen a secret key in public code before. Or another favorite: A friend of mine sending emails to 100,000 users from the dev server.
|
||||
|
||||
—[John E. Picozzi][3]
|
||||
|
||||
### Unix mix-up
|
||||
|
||||
This is a Unix story. It's fixed in [Linux][4] today.
|
||||
|
||||
A day before I was going to give an important demo of a new component to management, I had to refresh my code (this was way before [Git][5] existed.) I went to my home directory, found the project directory, and deleted everything. Unfortunately, in that flavor of Unix, this command followed symbolic links, and I had a link to the latest version of the code (not all was on the source code system as it was still in the testing phase).
|
||||
|
||||
A day later, there was a network problem in the building, so the demo was delayed for a day, and we managed to recover. It was more than three decades ago. Even now I have no clue whether the network problem was a coincidence or an attempt of our sysadmin to save us (if so, it worked!)
|
||||
|
||||
—[Josh Salomon][6]
|
||||
|
||||
### Imperative
|
||||
|
||||
Seeing `!important;` all over a CSS file instead of proper use of specificity.
|
||||
|
||||
I once had to override and customize almost all of a WordPress theme's CSS because the owner of the site wouldn't budge on getting a new theme that was closer to the design he wanted.
|
||||
|
||||
That same theme was last updated by the developer in 2018, and the website is still using it.
|
||||
|
||||
—[Christi Nickerson][7]
|
||||
|
||||
### Misquoted
|
||||
|
||||
In a previous role, my predecessor misquoted the lyrics to Journey's "Any Way You Want It" in a code comment.
|
||||
|
||||
—[Ben Cotton][8]
|
||||
|
||||
### The ghost of Algol68
|
||||
|
||||
Algol68's complexity, back in the late 1960s and early 1970s, frightened away many influential people, including Niklaus Wirth. The most common complaint I can recall back then was along the lines of "who could write a compiler for such a complicated beast?" And yet many people did. Moreover, many of the concepts developed or at least formalized as [Algol68][9] appeared in later languages, notably in C and the Bourne shell (thanks to Steve Bourne).
|
||||
|
||||
Some of Algol68's concepts have not aged well. The concept of I/O dealing with "books" and "chapters," and so on, is a bit weird today. Leaving things like character sets to the implementation seems pretty old-fashioned.
|
||||
|
||||
But some are, or should be, tremendously relevant today, such as expressions that yield a value, strong typing (types in Algol68 are called "modes"), [heap memory and garbage collection][10], definition and overloading of operators, and more.
|
||||
|
||||
Sticking with the Hallowe'en theme, both tricks and treats.
|
||||
|
||||
Algol68 is a language that merits study, if for no other reason than to see where so many of modern computing's ideas came from, and to see how many have been lost along the way.
|
||||
|
||||
—[Chris Hermansen][11]
|
||||
|
||||
### Passwords exposed
|
||||
|
||||
I was doing a tech audit for an incoming support client, and the previous developer put passwords in plain text throughout the full theme, and used horrible ways to connect to a remote database. Their composer file was also ghoulishly bloated. It took five minutes every time I tried to get the site up and running locally. Outdated dependencies, repos I could not access, the list goes on.
|
||||
|
||||
—[Miriam Goldman][1]
|
||||
|
||||
### The maze
|
||||
|
||||
The scariest code I ever saw was a piece of PDP-11 assembly language in the kernel of an operating system named RSTS, which nobody remembers today. Source code was on microfiche in those days, and I had followed this code path through a few twists and turns, trying to figure out what was going on. And then, I ran into this instruction:
|
||||
|
||||
```
|
||||
MOV R5,PC
|
||||
```
|
||||
|
||||
I threw up my hands and wailed. I really did wail. People in the office thought I'd hit my head, or had a heart attack.
|
||||
|
||||
In those days, memory was precious and a `MOV` instruction used a teeny tiny bit less memory than a `BR` (for "branch") instruction. Copying the contents of register 5 into the program counter was really a cheap unconditional branch to the address stored in register 5. Except, I had no clue what was stored in register 5, or how to find it.
|
||||
|
||||
To this day, almost 40 years later, I wonder who would write code like that and how anyone could debug it.
|
||||
|
||||
—[Greg Scott][12]
|
||||
|
||||
### Off by one
|
||||
|
||||
I work in the automation industry, where the PLCs are programmed in some pretty weird languages.
|
||||
|
||||
An example that haunts me is the fact that in the language [ST][13], you can define arrays to begin at index 1. It means that the first element is at position 1, not 0. It drives me nuts when I see it.
|
||||
|
||||
—[Stephan Avenwedde][14]
|
||||
|
||||
### Divergence
|
||||
|
||||
I took a MongoDB instance down for 40 minutes once during a stage-to-prod launch. Our staging environment had diverged from production. It was just a database configuration difference—not very exciting. But it's a good lesson to make sure your staging and prod environments are in sync!
|
||||
|
||||
—[Em Nouveau][15]
|
||||
|
||||
### Unearthly whispers
|
||||
|
||||
This is from a project that's still alive and kicking, but I've changed the code to hide the source.
|
||||
|
||||
```
|
||||
for(int c =0; y < yyy && c < ccc; y++, c++){// some code here}
|
||||
```
|
||||
|
||||
It seems like an innocent loop at first. But maybe you're asking why there are two variables with two stop conditions and two increments. And then you realize there's only one initializer and the second variable (`y`) is initialized before this loop in a different code block.
|
||||
|
||||
When I realized this, it took me about an hour to understand why the code was written in this way, and how it's supposed to work. Obviously, there were no `c` comments and the variable names are meaningless (`c` is called `c` in the code and `y` has a bit more meaningful name, but not meaningful enough to explain to me its meaning, not even today when I understand what it does).
|
||||
|
||||
—[Josh Salomon][6]
|
||||
|
||||
### Critical data
|
||||
|
||||
Around 1980, I got my first job after college. I was the Assistant Computing Center Director at an engineering college in Indiana. That's a fancy title for the second-in-command of a two-person IT shop. I handled administrative computing on a PDP-11/40, with RK05 removable "pizza platter" disk drives (2.5 MB each.) Each admin office had one drive, and part of my job was to back them up, disk to disk, every week. But I got busy over that summer and skipped the Registrar's Office four weeks in a row. And then I realized the risk, so I made sure to start my monthly disk-to-tape backup.
|
||||
|
||||
I dismounted the Registrar's pizza platter from the 11/40 and mounted it on the 11/70, which had a 9-track tape drive, and started my backup. A few minutes later, I heard a scraping noise inside that disk drive. Yep, the heads crashed. In a few short minutes, I'd destroyed all the Registrar's data, and the then-most-recent backup, which was a four-week-old 9 track tape.
|
||||
|
||||
It was a, well, uncomfortable moment when I had to look the Registrar department head in the eye and tell him I had destroyed all his data.
|
||||
|
||||
Today, I tell new IT people you're not a pro until you've destroyed somebody's critical data, and there's no way to recover it. Remember that feeling in the pit of your stomach forever.
|
||||
|
||||
—[Greg Scott][12]
|
||||
|
||||
### Angry mob
|
||||
|
||||
A client hacked WordPress core to add features that later came out in a routine update and couldn't understand why the site kept crashing every time they attempted to update LearnDash. (They also didn't like our report that called out their poor development practices.) They basically showed us the door calling us liars and incompetents. To this day, I still have delegate access to their domains and wp-admin access to production and development of two domains.
|
||||
|
||||
They also, despite us sharing a link to an encrypted location for sharing access credentials, sent our logins over emails.
|
||||
|
||||
—[Laura Byrne][16]
|
||||
|
||||
### Don't forget to backup
|
||||
|
||||
I've not worked much on corporate networks, so I haven't downed any servers. However, as I young person, I tried to help a person with an IT problem and somehow caused Windows 95 to crash, and had to reinstall it for free.
|
||||
|
||||
Another of my saddest moments as a very young Amiga user was when my save disk, containing all my files, broke due to some mechanical failure. Nowadays, I've gotten better at backing up more of my important personal files.
|
||||
|
||||
—[Rikard Grossman-Nielsen][17]
|
||||
|
||||
### Root of all evil
|
||||
|
||||
I was new to Linux, and I'd just come from DOS where I used Norton Commander. Then Midnight Commander got released and I was very happy about it. It wasn't packaged for the Linux distro I used at the time (Jurix), so I compiled it myself from source, just like other software I used at that time. It worked perfectly well, and suddenly I felt more at home on Linux.
|
||||
|
||||
That's not the horror story.
|
||||
|
||||
My colleagues told me not to run Midnight Commander as root, regardless of how comforting it was. But root was easy, and it felt more like DOS, so I ignored their advice. Long story short: I accidentally removed the content of the entire `/etc` directory. Until that time, I'd never had to use backups, but that day I learned that backups are actually useful.
|
||||
|
||||
27 years later, I still remember this story, and I do regular backups.
|
||||
|
||||
—[Peter Czanik][18]
|
||||
|
||||
### Illusion
|
||||
|
||||
The worst project one agency had me "make" was a one-pager that seemed straightforward at first. I said I'd be able to hash it together with some HTML and CSS, maybe a little Javascript. But they specifically asked me not to do that. They wanted me to cut out the design and literally use CSS to position those pieces around the page. They also had me add all CSS inline, directly into the HTML file, because they literally wanted **one page**.
|
||||
|
||||
None of the text was real text.
|
||||
|
||||
There were no real HTML elements aside from the ones needed to position those images.
|
||||
|
||||
I told them that the design was simple enough that I could throw it together with actual code, but they didn't want that. They only wanted me to spend the time to cobble the pieces together and then move on to a different project. They had me make two little one-page sites like that.
|
||||
|
||||
It hurt my front-end soul. It was physically painful for me to do that project. It was a temp-to-perm gig, and when they offered me full-time, I politely declined.
|
||||
|
||||
—[Rachel Vasquez][19]
|
||||
|
||||
### Corruption
|
||||
|
||||
The scariest things to me are memory corruptions that can occur in ANSI C99. During a screencast, I captured this (not quite) paranormal occurrence in this [YouTube clip][20].
|
||||
|
||||
![Image of gseqencer before memory corruption.][21]
|
||||
|
||||
The GtkEntry labeled `file` shows some random glyphs. I've double checked the [code][22], but didn't find any issues.
|
||||
|
||||
The `ags_export_soundcard_open_response_callback()` function is a callback to the "response" event of GtkFileChooserDialog. (For the record, the tool to target this problem is [valgrind][23].)
|
||||
|
||||
![Image of gsequencer after memory corruption.][24]
|
||||
|
||||
—[Joël Krähemann][25]
|
||||
|
||||
### Python fears
|
||||
|
||||
The most horrific programming feature I ever saw is the access Python gives to its `dict`. Changing the type of an object at runtime is against my programming code of conduct.
|
||||
|
||||
—[Josh Salomon][6]
|
||||
|
||||
### Franken-net
|
||||
|
||||
In 2006, I built firewalls based on Fedora and a bunch of scripting, and persuaded a customer with a large website inside a colo center to replace a proprietary firewall with one of mine. I built it and showed up to install it at 4AM one morning. That was when I learned (the hard way) that he had a load balancer behind his firewall, but with a public IP address. The customer endured a 5-minute outage, but I reconnected everything to the original, and it all came back online.
|
||||
|
||||
I found a way to handle his franken-net configuration by using proxy ARP. The idea was whenever anyone from the outside world did an ARP request for the load balancer, I would answer. A few days later, I showed up at 4AM again and installed my system. This time, I knocked everything in the entire colo center offline. I had set up my proxy ARP to respond to everything, and so all traffic on the LAN eventually found me and disappeared into a black hole.
|
||||
|
||||
Once I realized what I'd done, I put it all back the way it was. But the damage was done. If you tried to browse your favorite website around 4AM US Central time one morning in 2006 and it didn't respond, it might have been my fault. I knocked an entire colo site offline by installing one system in a rack and turning it on.
|
||||
|
||||
The website operator screamed and I slunk out the door. They never invited me back to try again. That was a shame, because bridging probably would have worked.
|
||||
|
||||
—[Greg Scott][12]
|
||||
|
||||
### Your horror story
|
||||
|
||||
What's your favorite technology-related horror story? Tell us in the comments (but be nice, and change project names to protect the innocent!)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/10/technology-horror-stories
|
||||
|
||||
作者:[AmyJune Hineline][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/amyjune
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/users/miriamgoldman
|
||||
[2]: https://opensource.com/users/courtneyrdev
|
||||
[3]: https://opensource.com/users/johnpicozzi
|
||||
[4]: https://opensource.com/tags/linux
|
||||
[5]: https://opensource.com/downloads/cheat-sheet-git
|
||||
[6]: https://opensource.com/users/joshs
|
||||
[7]: http://cnickerson.com
|
||||
[8]: https://opensource.com/users/bcotton
|
||||
[9]: https://opensource.com/article/20/12/learn-algol-68
|
||||
[10]: https://opensource.com/article/22/6/garbage-collection-java-virtual-machine
|
||||
[11]: https://opensource.com/users/clhermansen
|
||||
[12]: https://opensource.com/users/greg-scott
|
||||
[13]: https://en.wikipedia.org/wiki/Structured_text
|
||||
[14]: https://opensource.com/users/hansic99
|
||||
[15]: https://opensource.com/users/nouveau
|
||||
[16]: http://twitter.com/@NewYorkerLaura
|
||||
[17]: https://opensource.com/users/rikardgn
|
||||
[18]: https://opensource.com/users/czanik
|
||||
[19]: https://opensource.com/users/rachievee
|
||||
[20]: https://youtu.be/Go6r-CT06zc?t=103
|
||||
[21]: https://opensource.com/sites/default/files/2022-10/gsequencer-before-memory-corruption.png
|
||||
[22]: https://git.savannah.nongnu.org/cgit/gsequencer.git/tree/ags/app/ags_export_soundcard_callbacks.c?h=4.4.x#n397
|
||||
[23]: https://opensource.com/article/21/8/memory-programming-c
|
||||
[24]: https://opensource.com/sites/default/files/2022-10/scarygsequencer-after-memory-corruption.png
|
||||
[25]: https://opensource.com/users/joel2001k
|
Loading…
Reference in New Issue
Block a user