Sometimes backwards compatibility means preserving bugs. When working on AMX Mod X 1.8.0, we found a very nasty bug in the code for creating new-menus.
For the unfamiliar, new-menus are a replacement for the original menu code (now dubbed “old-menus”). They were designed to be much simpler to use, though the basics are similar:
- menu_create() binds a new-menu to a new-menu callback.
- register_menucmd() binds an old-menu to an old-menu callback.
The two callbacks are very different: new-menu callbacks have three parameters (menu, client, item). Old-menu callbacks have two parameters (client, keypress). They are mutually exclusive.
Yet, there was a serious, accidental bug in AMX Mod X 1.7x — menu_create called register_menucmd on the same callback it used for its own callback. Effectively, your new-menu callback could receive random, invalid data because it was being invoked as an old-menu handler and a new-menu handler. This created almost untraceable and inexplicable bugs in a few plugins that had ventured into new-menu territory.
Needless to say, the code was removed very fast. Then when it came time to beta test 1.8.0, we received two reports that a specific plugin had stopped working. One of its menus was broken. After successfully reproducing the problem, I opened the plugin’s source code and found why.
The plugin was calling menu_create on callback X. However, it never called any of the other relevant new-menu functions. Instead, it used old-menus to actually draw and display the menu. Effectively, the author had replaced register_menucmd with menu_create. He probably intended to rewrite the rest of his code as well, but forgot. After all, his functionality continued to work as normal! So when AMX Mod X 1.8.0 removed this bug, his plugin broke.
Deciding whether to insert backward compatibility shims is always tough. Generally, we always want plugins to work on future versions, no matter what. There is a rough checklist I went through.
- How many plugins are affected by the change? One.
- How many people are affected by the change? 100-200. Punishing one author punishes all of these users.
- How much code exists that is affected by the change? Unknown, assumed minimal.
- Is the compatibility change a design decision, or a bug fix? How severe? Severe bug fix.
- Is the break occurring from valid API usage or invalid API usage? If invalid, is it a mistake that is pervasive? Invalid usage localized to one line in one plugin.
- Is backwards compatibility possible? No, the flaw is too severe to revert in any form.
- Are any of the affected plugins no longer being maintained? No.
Given the above checklist, we decided to allow for this one plugin to receive reverted functionality. menu_create will call register_menucmd if and only if the plugin matches X and the plugin’s version matches Y. We notified the author saying, “if you release version Y+1, it will break on future AMX Mod X versions, so you will want to fix it.”
The conclusion: backwards compatibility sometimes means preserving bugs. Unfortunately, this gives new meaning to bugs being “undocumented features.” In the end, choosing whether to preserve bugs (or indeed any compatibility) depends on how many users you want to affect and how badly you want to affect them.
Makes sense. No big deal, I am sure the author is just happy to have it fixed.
This was actually discussed a while ago and I was for it initially. Over time though it became apparent that the total community was getting involved with this project. Archiving this would be best for everyone.
Great post! We’re a successful software design and development company specializing in creating e-commerce Websites, iPhone, Android, and windows 8 applications, facebook applications, Internet marketing (SEO/SEM/SMO and PPC campaigns)
Life can be tough at times, you put in the hours of work and only end up with blank stares. You know what I mean? That’s the time posts like this keep me motivated.
We research, develop and provide unique repair solutions for your computer problems. We will always diagnose your machine with no strings attached.
Con el tema de no tener frío en la parte del refrigerador, calculo que puede ser sensor, lo que no se es cuanto me tiene que medir en ohm. Tengo un combi FAGOR no-frost que en verano se dispara la alarma acústica a la más mínima. En segundo lugar, distinguir tu generosidad y gran persona que debes ser, ya que tomarte tanto tiempo para dedicar a ayudar a otros, habla por si solo. Hola, comparto con ustedes las experiencias que tenemos de ser sufridos pero contentos usuarios de una heladera NF General Electric TBG 16 ZBC desde el año 1995.
I have recently started a website, the info you offer on this website has helped me tremendously. Thanks for all of your time & work. “Her grandmother, as she gets older, is not fading but rather becoming more concentrated.” by Paulette Bates Alden.
I saw a lot of website but I conceive this one holds something extra in it in itCosmosEntertainment
I’ve learn a few excellent stuff here. Definitely helpful bookmarking for revisiting. I wonder how much effort you place to create this type of great informative website.
Aw, this was an exceptional good article. It must have taken you great efforts to create this article… Appreciate!
At that time, he had the ability to match his
two sisters who had been glorious basketball player.
Thank you for every other excellent blog.I’ve a presentation next week, and I have found what I can add in my speech. Great job!
thanks for the onfo