
Apps for which macOS applies compatibillity fixes - ebcase
https://worthdoingbadly.com/appkitcompat/
======
userbinator
_Microsoft Excel /PowerPoint/Word have a patch in _CFArraySortValues to change
the sorting algorithm slightly. How do you break sorting?!_

To take a wild guess, it could be a change from a stable to unstable sort:
[https://en.wikipedia.org/wiki/Sorting_algorithm#Stability](https://en.wikipedia.org/wiki/Sorting_algorithm#Stability)

 _Apple gets a bad reputation for their supposed lack of backwards
compatibility. Nothing is further from the truth: macOS includes tweaks for
specific important apps to keep them working on new OS versions._

I read it more as "even Apple is willing to put in patches for backwards
compatibility, if your app is important enough." If your app is not, then
Apple couldn't care less. MS is more conservative about not breaking things
even for relatively obscure apps.

~~~
saagarjha
Might be. I took a look at _CFArraySortValues, and the "normal" path through
it ends up calling CFQSortArray. However, the "com.microsoft.*" path performs
what appears to be a bubble sort. Interestingly, the public facing version of
CoreFoundation doesn't have the special-case paths:
[https://github.com/apple/swift-corelibs-
foundation/blob/df3e...](https://github.com/apple/swift-corelibs-
foundation/blob/df3ec55fe6c162d590a7653d89ad669c2b9716b1/CoreFoundation/Collections.subproj/CFArray.c#L951)

~~~
snaily
I suppose Excel data is often almost sorted with a few new additions, which
makes bubble sort an arguably better choice?

~~~
xrisk
Nope, bubble sort always performs the same number of ops regardless of whether
the array is partially sorted or not. You might be thinking about insertion
sort, which has that feature.

~~~
umanwizard
Not true.

(3 2 1) -> (2 3 1) -> (2 1 3) -> (1 2 3) (3 passes, 3 swaps)

Compare: (1 3 2) - > (1 2 3) (2 passes, 1 swap)

~~~
xrisk
Hmm I suppose you're right. My bad!

------
gnachman
I guess I made the big time!

The iTerm2 one is interesting because it came too late. Apple's patch disables
Sierra's native tabbing. Version 3.1.3 did not disable it completely. I
published a fix in version 3.1.4 which came out on October 22, 2017, about a
month after Sierra launched. I guess they must have fixed it in a dot release
of Sierra, but I won the race and got the fix out before 10.12.1 which came
out on October 27.

I'm glad someone's got my back, anyway.

~~~
saagarjha
Speaking of iTerm's tabbing functionality, are you still using
PSMTabBarControl? You make a couple of odd decisions with tabbing, such as
blank spot in the tab strip on the right to make way for the overflow
indicator, which IMO is inferior to how macOS does it (scrolling tabs). In
addition, tab defocusing causes visual discoloration. Does macOS just not
provide the API you need, or what?

~~~
masukomi
i really hate scrolling tabs...

~~~
spronkey
Agree wholeheartedly. Firefox is basically dead to me because of this (that
and it's now trickier than ever to fix it).

I'll take 1px wide tabs over scrolling.

~~~
ksec
Um.... Why? 1px Wide Tab is basically a design that forces people not to have
too many tabs. Which is great for those who can keep their Tabs Numbered. But
even discounting the number of tabs open to be read, a single Feedly section,
or in the old days Google Reader section I could easily bump up to 100+ Tabs,
and much more in WWDC / Apple Keynote time.

Which makes 1px Tabs annoying as hell.

So I really don't understand why 1px Tab is preferred over Scrolling Tabs.

~~~
Pimpus
I guess because you have to do a ton of scrolling to go from one of the first
tabs to the last.

Of course, if you don't have scrolling tabs then the tabs get so small that
it's basically impossible to find what you want.

I solved this dilemma by hiding my FireFox tabs and using Tree Style Tabs. I
find it really helps with keeping tabs organized and I can keep a lot open
without worrying. I removed the scrollbar and close buttons, and made the tabs
smaller, to further save on screen real estate.

~~~
saagarjha
> I guess because you have to do a ton of scrolling to go from one of the
> first tabs to the last.

On a Mac trackpad, this is one swipe. Sure, I see how this can be a problem if
you use a scroll wheel, but I've never had this be a problem otherwise.

------
toomanybeersies
This used to be Microsoft's shtick, Joel Spolsky wrote an amazing article
related to this a few years ago:
[https://www.joelonsoftware.com/2004/06/13/how-microsoft-
lost...](https://www.joelonsoftware.com/2004/06/13/how-microsoft-lost-the-api-
war/)

Relevant excerpt (abridged):

> I first heard about this from one of the developers of the hit game SimCity,
> who told me that there was a critical bug in his application: it used memory
> right after freeing it, a major no-no that happened to work OK on DOS ...
> the Windows developers ... added special code that checked if SimCity was
> running, and if it did, ran the memory allocator in a special mode in which
> you could still use memory after freeing it.

------
forgotmypw
Microsoft does this too, though I can't find the article right now.

There are hundreds of special compatibility hacks for various software baked
into Windows to make things run smoothly.

Edit: The links are broken now, but a paragraph from the article is quoted
here:

[https://www.joelonsoftware.com/2004/06/13/how-microsoft-
lost...](https://www.joelonsoftware.com/2004/06/13/how-microsoft-lost-the-api-
war/)

> Look at the scenario from the customer’s standpoint. You bought programs X,
> Y and Z. You then upgraded to Windows XP. Your computer now crashes
> randomly, and program Z doesn’t work at all. You’re going to tell your
> friends, “Don’t upgrade to Windows XP. It crashes randomly, and it’s not
> compatible with program Z.” Are you going to debug your system to determine
> that program X is causing the crashes, and that program Z doesn’t work
> because it is using undocumented window messages? Of course not. You’re
> going to return the Windows XP box for a refund. (You bought programs X, Y,
> and Z some months ago. The 30-day return policy no longer applies to them.
> The only thing you can return is Windows XP.)

~~~
LoSboccacc
windows hardly changes a function contract. most their patches are to support
bugged programs that used the api in undocumented ways, not because they
changed an api functionality

[http://ptgmedia.pearsoncmg.com/images/9780321440303/samplech...](http://ptgmedia.pearsoncmg.com/images/9780321440303/samplechapter/Chen_bonus_ch01.pdf)

------
wallflower
Reminds me of my all-time favorite Joel Spolsky story about Bill Gates'
amazing technical free-diving skills and the Excel date compatibility problem.

[https://www.joelonsoftware.com/2006/06/16/my-first-billg-
rev...](https://www.joelonsoftware.com/2006/06/16/my-first-billg-review/)

~~~
ggg9990
It’s easy to forget that Bill Gates was once the Jeff Dean of his time.

~~~
copperx
Bill Gates is a genius, maybe even in technical stuff, but he wasn't the Jeff
Dean of his time.

~~~
ggg9990
Well of course, in a way, nobody could be, because software didn’t have the
impact on the world then as it does now.

~~~
coldtea
I'd say it had more impact then.

The major impact of software and computing was front-loaded, as in, it came
with the early hanging fruits: being able to computerize banking, government
data, credit card transactions, international trading, etc. This gave a huge
boost to market efficiency and globalization.

The rest, with the internet, apps, online sales, etc, is just another outlet
for doing business. Whether a 2B2 order happens on the web, or by old-style
computer networks, or even by fax, is not that much of a difference.

------
saagarjha
Honestly, I wouldn't be surprised if this is basically the list of apps
personally used by Apple employees that broke between releases.

EDIT: Here's a list sorted by number of occurrences:
[https://gist.github.com/saagarjha/f36b6d99c3b89acfc02624806e...](https://gist.github.com/saagarjha/f36b6d99c3b89acfc02624806e052462)

------
gwbas1c
I used to maintain a Finder plugin that added icon overlays to files, and
added menu items to right-click menus.

It worked by injecting code into Finder at runtime, and then swapping method
implementations for various classes. (Mac developers call this swizzling.)

We basically had to reverse engineer Finder every time Apple shipped a new
version of MacOS. Later, as the process grew more common, we had to add tricks
to make sure that we could work smoothly with other similar plugins.

I jumped for joy when Apple released the Finder Extension API!

~~~
_fzslm
I know you said you don't maintain this plugin anymore, but does it still
exist in some form? It sounds interesting!

------
enzo1982
_Apple gets a bad reputation for their supposed lack of backwards
compatibility. Nothing is further from the truth._

Well, they definitely break a lot of things. Mostly things that were never
documented or guaranteed to work, though.

My app [1] regularly broke with new macOS releases between 10.9 and 10.12. So
often I actually shivered when they announced a new version.

I was calling Cocoa stuff from separate threads which is almost never
guaranteed to work on macOS (the UI is explicitly not thread-safe). It usually
worked on older releases though, but since 10.9 or so, it broke a little more
with almost every new release.

Not really Apple's fault as it's mosty breaking stuff that was explicitly not
guaranteed to work in the first place and which I shouldn't have used. On the
other hand, Microsoft seems to keep every quirk from Windows 9x time still
working until today.

[1] [https://github.com/enzo1982/freac](https://github.com/enzo1982/freac)

~~~
saagarjha
> I was calling Cocoa stuff from separate threads which is almost never
> guaranteed to work on macOS (the UI is explicitly not thread-safe)

It seems to me that you know what's wrong here, but just in case you don't,
most UI work should be done on the main thread. There are certain lower-lever
layer APIs that IIRC do explicitly allow for calls from multithreaded
contexts, but other than that stick to the main thread. There's actually a new
tool, the thread sanitizer, that helps you adhere to this by flagging all
misuse of Cocoa outside the main thread.

~~~
i386
This is the case for almost every graphical toolkit I’ve developed for.

------
grzm
From the article:

> _" Note that this is just a list of apps Apple has developed compatibility
> tweaks to make them run on newer macOS versions. As the list demonstrates,
> even the best apps often needs some tweaks on newer macOS. In addition, most
> of these patches are only applied to older versions of apps."_

Quite a stretch from this to the clickbait title _" These 299 macOS apps are
so buggy..."_.

~~~
pducks32
That’s not fair to say. These apps may very well have done one or two things
wrong in their code that required Apple to step in. I have a million such
mistakes in my code but no one uses them enough to warrant a checkfix.

Also these apps are huge and push the platform forward more than other apps so
the likelihood of this relying on undocumented behavior is much much higher
and Apple is some sense shares responsibility for those bugs. So the face that
they make these checkfixes makes sense.

------
beefsack
This sounds somewhat analogous to what Nvidia do with their graphics drivers.
You hear stories about how the driver is full of game specific hacks to work
around bugs / poor designs in the games themselves.

While this can be good for performance and stability of these games, it does
result in a bloated and complex driver, which I'm certain is difficult to
maintain.

~~~
badsectoracula
You can confirm these stories by downloading Nvidia Inspector which includes
the Nvidia Profile Inspector that allows you to view and edit the - hundreds -
game profiles the driver knows about and even make new ones (quite useful if
you are playing some obscure game that happens to have a similar bug or use
the same engine as a more popular game). The available tweaks even include
fixes for games released in the 90s.

~~~
aequitas
This imho is how you do this kind of thing. I've seen the contrary to often in
production environment where per customer exceptions (if customer-id ==) are
made. Instead you have to make the exception itself into a concept en manage
the relation between the exception and the customer/application at a different
level like nvidea does with the profiles.

------
robin_reala
Interesting that Firefox made it onto the list; one would have assumed it
would have been easier to produce a patch for an open source application than
to maintain a compatibility fix in your own code.

~~~
saagarjha
Well, who would write the patch? Someone at Apple?

~~~
adrianN
Yes? Or some regular contributor to Firefox that gets guidance from an Apple
engineer?

~~~
saagarjha
> gets guidance from an Apple engineer

You do realize that the chances of this happening is next to nil, right? This
is doubly true for prerelease software.

~~~
threeseed
This happens all of the time. Very common for Apple to reach out to the
popular apps.

And if you aren't popular you can just goto WWDC where hundreds of engineers
will quite happily talk through issues and give guidance on prerelease
software.

~~~
saagarjha
> Very common for Apple to reach out to the popular apps

You have to be _really_ popular for this to happen, or be the only adopter of
a technology they're trying to push. Basically, the question you have to ask
yourself is "could Apple showcase us at a keynote?" Of course, such
arrangements have massive NDAs around them.

> if you aren't popular you can just goto WWDC where hundreds of engineers
> will quite happily talk through issues and give guidance on prerelease
> software

Yes, but they aren't going to tell you what's wrong with your software…you'll
need to go up to them at tell them "so and so doesn't work" and then they'll
help you. I think it's unlikely that they'd just outright tell you that they
made a special case for your software and you should get around to fixing it.

~~~
scrollaway
This is Firefox we're talking about, so yes it's popular. And this does happen
far more than you're claiming. I'm not sure why you're still trying to push
your angle honestly.

~~~
saagarjha
Outside of the extremely rare occasions that I mentioned above, I've never
seen or heard this happen. If you have some stories to share, I'm all ears!

~~~
scrollaway
Look at commit email domains some time. Grep for @apple.com in popular
projects. I don't have the firefox repository on hand but I would wager
they're in there too.

~~~
gsnedders
Only things from @apple.com in mozilla-central are a few commits from the
auto-syncing of web-platform-tests ( [https://github.com/w3c/web-platform-
tests](https://github.com/w3c/web-platform-tests) ), and a few patches from
code shared with WebKit where patches have been copied over. So, uh, no direct
contributions.

------
AceJohnny2
> _[This] function, which returns true if the current app matches the
> specified bundle ID and is linked on or prior to the macOS version. Thus,
> older versions of the app would have the fix applied, while newer versions
> built with a newer SDK would not._

This it notable. It means Apple is ensuring backwards compatibility. Even if
an updated version of your app (as detected by what OS it linked against)
fixes things, these patches are still around for older versions of the app
people may still be running.

Backwards compatibility never ages out...

~~~
Lorkki
I agree that there's a sound reason for this, but I can't help but think that
API versioning would be the more correct way to do it. This is how you pile up
unnecessary complexity.

~~~
macintux
I’d agree, except what Apple is doing here is orthogonal to backwards
compatibility. They’re fixing buggy apps, some of which are buggy because they
rely on undocumented behavior.

~~~
rarepostinlurkr
If it worked yesterday and after an OS update it still works how is that not
backwards compatibility?

Does it matter to a user if the change was due to some “buggy apps”? If it
works, it works.

------
Aissen
As noted elsewhere in the thread, Microsoft does this as well, and Opera used
to do this for broken high-profile websites:

[https://www.opera.com/docs/browserjs/](https://www.opera.com/docs/browserjs/)

 _Edit:_ Even Chrome and Safari used to do it:
[https://dev.opera.com/blog/opera-s-site-
patching/](https://dev.opera.com/blog/opera-s-site-patching/)

------
InclinedPlane
This is an industry standard practice across many different areas. You know
those "game ready" video card drivers you download? Inside the driver there's
a big lookup table of executable names tied to tuned parameters for the video
pipeline. The APIs that are used (DirectX, OpenGL, etc.) don't allow
sufficient tuning of the behavior of GPUs, so instead there's a sort of meta
layer of programming which gets done by the graphics card makers.

------
gwbas1c
I work on some Mac applications that, at times, try to exceed what MacOS
applications are capable of doing.

They almost always break between MacOS releases. Usually the cause is that
Apple improved various security restrictions in Gatekeeper. What tends to
happen is that older builds work fine, but any new builds don't work well.

But, what's interesting is that the page at
[https://worthdoingbadly.com/assets/blog/appkitcompat/appkit_...](https://worthdoingbadly.com/assets/blog/appkitcompat/appkit_processed.html)
doesn't list any bundle hashes. I always assumed that Apple's hacks for
backwards compatibility were tied to the bundle hash, and not the specific
application.

~~~
favorited
Sounds like what you're talking about is what's called a "linked-on-or-after"
check. That's where they'll see what version of the SDK an app was built
against, and enable or disable specific features or bugfixes. Obviously that
could be used in conjunction with your app's bundle id.

------
ec109685
I don’t understand this pseudo code from the article: if
__CFAppVersionCheckLessThan("com.microsoft.Powerpoint",
CFSystemVersionYosemite) {

Why are they comparing an app version to an OS version?

~~~
crooked-v
It's comparing what macOS version the app is linked against, not the app's own
version number.

------
xab9
"I guess Apple’s using the compatibility system to patch other things/change
behaviour for specific system apps."

Sometimes I do think software is doomed - like when a teammate of mine had to
manually edit the bundled and minified javascript files right before release,
because the bundler-crawler frankenstein code would've taken another eight
hours to finish.

------
Lio
Makes me very happy to see FOSS software like Blender in the list and not just
the big commercial applications as I had expected.

~~~
h1d
Maybe they fix apps whose complaints are louder than average.

Putting an effort to make people believe the upgrading on macOS is smooth is
important to avoid version spread like on other OS's.

------
coldcode
When I was at Apple in the mid-90's with access to the (obviously pre-NeXT)
MacOS source code, I was amazed at how many of these version checks were in
the code; there were always a lot of Microsoft app/version checks in there.

------
cyberferret
Interesting. I wonder how much this lookup check adds to _every_ app's load
time?

I may have missed it in the article, but is the lookup run only upon first
time the app is executed, or on every single run instance?

~~~
jsjohnst
> I wonder how much this lookup check adds to every app's load time?

Based on the IDA disassembly, not much. A few extra CPU instructions has
minimal impact generally.

> but is the lookup run only upon first time the app is executed, or on every
> single run instance?

It’s done every time the function in question is executed from what I can
tell.

~~~
saagarjha
_CFAppVersionCheckLessThan is called every time, yes, but the result of the
check is cached as far as I can tell.

------
busterarm
Well, they can remove those patches for AOL Instant Messenger now, eh?

~~~
lmm
Why? It's one of the better group chat apps out there these days.

~~~
tssva
AIM service shutdown in December.

------
gregoriol
This is really fucked up: are the app developers made aware of those? (likely
not) are they going to experience some "strange" behavior, not like anybody
else? if someone at Apple gets aware of a "problem", why not contact the app
developers to help fix?

It also means that if some other developers want to make an app with the same
kind of feature/behavior, they can't?

Some app developers also use special bundle IDs for testing...

I only see "no-go" reasons for such a thing, not a single valid or positive
one!

~~~
ridiculous_fish
Yes, it's common for Apple to report a bug against the app; in fact in many
cases the bug has already been fixed in the latest version! But that doesn't
help users who are using old versions.

Most app developers aren't going to spend resources putting out a dot release
for years-old versions of their app. But users use those apps every day.

Check-fixed behavior is not a "feature," it's some sub-optimal behavior
applied to work around serious bugs. An example is lying to the app about the
OS version, to prevent the app from breaking. No developer wants to opt-into
such behavior.

Note that check-fixes are tied to an SDK version, so when the developer
switches to the newest SDK, they'll see the normal behavior.

------
nanoanderson
Very interesting article, very misleading title.

------
amelius
> Apple gets a bad reputation for their supposed lack of backwards
> compatibility. Nothing is further from the truth.

Yeah, if you have an app that is used by millions of people, that is.

------
pier25
So what is the reasoning behind Apple's constant breaking changes?

~~~
pier25
I'm surprised by the downvotes. This was an honest question since Microsoft
has been able to move on for years without so many changes.

------
raverbashing
1) (optional) OS vendor release an OS with an API quirk or bug

2) App vendor find out about the bug/issue and works around it, OR uses the
API in a weird way that "works" but is non-compliant (see SimCity's use after
free)

3) OS fixes the issue but then app breaks

4) Goto 1

------
nkkollaw
If only they put as much care into making sure their new laptop keyboards
did't start failing after 2 months, I might still consider spending 2-4 times
as much for their hardware..

