←back to thread

Hyrum's Law in Golang

(abenezer.org)
98 points thunderbong | 6 comments | | HN request time: 0s | source | bottom
1. sudhirj ◴[] No.42202147[source]
Weren’t there a couple of anecdotes where Windows couldn’t fix a bug because some popular game (maybe SimCity?) depended on it, so the devs hardcoded a SimCity check inside Windows and made the bug happen if it was running?
replies(2): >>42202200 #>>42202221 #
2. masklinn ◴[] No.42202200[source]
It was not a bug in windows, it was a bug in SimCity: it would UAF some memory, but the Windows 3.x allocator did not unmap / clear that memory so it worked.

Windows 95 changed that, and so one of the compatibility shims it got is that the allocator had a 3.x adjacent mode, which would be turned on when running SimCity (and probably other similarly misbehaving software as well).

Nowadays this is formalised in the compatibility engine (dating back to windows do), which can enable special modes or compatibility shims for applications (windows admins trying to run legacy or unmaintained applications can manage the application of compatibility modes via the “compatibility administrator”).

replies(1): >>42202236 #
3. adontz ◴[] No.42202221[source]
https://www.joelonsoftware.com/2000/05/24/strategy-letter-ii...

Jon Ross, who wrote the original version of SimCity for Windows 3.x, told me that he accidentally left a bug in SimCity where he read memory that he had just freed. Yep. It worked fine on Windows 3.x, because the memory never went anywhere. Here’s the amazing part: On beta versions of Windows 95, SimCity wasn’t working in testing. Microsoft tracked down the bug and added specific code to Windows 95 that looks for SimCity. If it finds SimCity running, it runs the memory allocator in a special mode that doesn’t free memory right away. That’s the kind of obsession with backward compatibility that made people willing to upgrade to Windows 95.

4. praptak ◴[] No.42202236[source]
Still a pretty good example of having to support something which is definitely not part of the official spec.
replies(1): >>42202413 #
5. guappa ◴[] No.42202413{3}[source]
Had it been open source, they could have just fixed the software instead
replies(1): >>42202453 #
6. masklinn ◴[] No.42202453{4}[source]
Fixing the upstream would not have updated it on the millions of machines running it, which is what they wanted to not break.