Tuesday, November 3, 2026

Computer bugs, legacy programs, and the coming crime wave

 

Eric S. Raymond, well-known computer systems author and commenter, recently commented on the potential usefulness of artificial intelligence to detect and fix errors in computer software.  He observed on X:



I have to agree with him:  if we turn a blind eye to the capacity of AI to fix past errors, we basically give in to cybercriminals who will have no hesitation in using AI to find such errors, and then to exploit them rather than fix them.

The scale of the problem was recently revealed.


The prevalence of COBOL is hard to overstate. Created in 1959, the “common business-oriented language” is still widely used today. According to IBM, COBOL underpins over 40 percent of online banking systems, facilitates 80 percent of in-person credit card transactions, and manages 95 percent of ATM transactions. It also supports various government systems, including Social Security and IRS operations. One estimate suggests that COBOL’s inefficiencies cost the US GDP around $105 billion annually.

However, replacing COBOL is no easy task. The same goes for other legacy programming languages like Fortran, which are still utilized in scientific computing, weather forecasting, and critical nuclear security codes. These systems are often too vital to risk breaking, and many of the programmers who once understood them have retired or passed away.

. . .

In its latest update, OpenAI shared encouraging results in migrating COBOL code to more contemporary programming languages such as C++, Java, Kotlin, Python, and Rust, all while preserving the original software’s functionality ... “These evaluation results demonstrate progress toward more accurate, affordable code migration for teams modernizing the software their businesses depend on,” OpenAI stated.

. . .

Experts ... caution that the advancements highlighted by OpenAI are still far from enabling the safe replacement of critical legacy systems ... When dealing with systems as critical as those running on COBOL, experts stress the need for absolute certainty that replacements function correctly. “In many cases, even minor differences in system behavior before and after migration are unacceptable,” Zaytsev noted. While AI can certainly provide efficiencies and speed, the complexity of legacy systems means that partial automation isn’t sufficient.

“Suppose you have a magic AI wand that handles 99 percent of your code,” Zaytsev said. “What do you do with the remaining 1 percent? That 1 percent can be a million lines of code, scattered throughout the system and potentially failing in ways you can’t even imagine.”


There's more at the link.

I couldn't agree more, particularly given that "legacy" code - originally written years or even decades ago, and since then updated and maintained in operation because of various pressures that made it uneconomic to replace - can now be almost impossible to update any further, because of the myriad internal cross-references and patchings over the years.  Let me give you an example.

Way back when, I wrote the main computer program for BP South Africa's Price Book system.  Every day, this program ran in batch mode to update the price charged for every single item sold by BP - engine fuels, lubricants, chemicals, whatever.  When I was given the task to write it, I recommended that I do so in modular fashion:  one program for fuels, one for lubricants, one for chemicals, one for specialized products, and so on.  That way, if any one category needed a major update, its specialized program could be modified and updated without affecting the rest of the Price Book system.  However, I was told that wasn't acceptable.  I had to write one program covering every product in BP's catalog.  Rolling my eyes a little, I set to work.

By the time I finished, if I recall correctly, the program was 6-7,000 lines of COBOL code.  It called in dozens of computer files, moved data around through hundreds of working-storage entries to hold interim calculations and results, and had a test data file of over 5,000 product entries.  It took almost a year to write, test, correct, re-test, etc. and get it into production.

By the time I left South Africa in the mid-1990's, I was told that the program now had a team of three programmers permanently assigned to it;  a lead analyst/programmer designing the updates and fixes, and two programmers to implement them.  It had grown to more than twice the original size, and all of the documentation I had left with it was so far out of date it was almost useless.  The source code and diagrams of section activity were filled with handwritten notes, exclamation points, and even a few profanities.  That wasn't due to anything lacking in the program as I'd handed it over:  it was because so many modifications and changes had come down the pike that one single, monolithic program could not cope with their rapidity.  It wasn't unusual for one fix to be in preparation (design), one to be in the implementation phase (programming and testing), and one going into production - simultaneously.  If it was that bad then, I shudder to think what it's like today . . . assuming it's still in use, of course.

Now, imagine trying to analyze a program like that using AI.  It's comparatively small compared to some very large systems out there, yet I think most AI agents and systems would battle to follow all the convolutions of the design, the code and the output.  Whether authorized or malicious, they'd have a doozy on their hands!

Unfortunately, there are a lot of systems like that out there.  As Mr. Raymond says, "the only way out is through".  We have to gain control of the mess of our legacy systems, because if we don't, malicious actors will use them to rob us blind.  Let the battle begin!

Peter


21 comments:

Anonymous said...

PL/I was supposed to replace COBOL (according to a lot of talking heads). Since then there have been a number of proposed replacement languages. The size and cost of replacement has scared off company leaders for generations now. Worked on place with a COBOL program that was as large as a mainframe would allow, and it called subroutines that were nearly as large. Replacing all that will be a nightmare.

Anonymous said...

There's so much "legacy code" out there, which is not just "old code" but "antique" and not well known or understood because the people who wrote it have long since retired or died. The so-called "management" in the years since have had multiple opportunities to correct the problem but they had "other priorities."

By the time the Chinese finish attacking - and hacking - that code for us we'll all be huddling aroiund the fire at the cave entrance wearing animal skins wondering "what the hell happened?"

Birdchaser said...

My fire tablet doesn't have any of that bs, if I can't do it on that I don't need to do it. I've bought my last computer.

audeojude said...

from what i can tell AI will be able to generate replacement code in any language you want. it is 90% there now and improving rapidly. Wether it happens before all the old code is destroyed underneath us by the same AI's at the behest of bad actors is another question. Its way easier and quicker even with AI to destroy than to build new and implement.

Mark D said...

I was a computer programmer for over 37 years. Most of my time was spent on legacy systems. My last 22 years were spent on a system that tracked all the parking tickets for a Very Large City. It was written predominantly in COBOL, with Adabase/Natural databases and some PL/I programs. The system went online the year I graduated college (1985), and it was still in operation when I retired five years ago.

The system was an absolute beast. It mostly worked as it was supposed to. As a college professor told us back in the early 1980s, there are two types of computer systems, those that are working but have bugs, and those that aren't working at all.

Here's a for-instance of how the system changed. When it was new, cops and meter maids wrote tickets, a copy went on the windshield and a copy went to data entry. Data entry operators would enter the data onto tapes, those tapes would then be loaded into our system. Average time between issuance and the ticket hitting the system could be weeks depending on backlog, staffing, etc. So there was a good chance the person would pay their ticket before it hit the system. Now tickets are automated, using handheld devices, and tickets hit the system a day or two after issuance. All the code required to handle a payment that arrivede before the ticket is still there, but hardly ever used, and it DOES still happen so it can't be eliminated.

They talked about replacing that system when I started there 27 years ago, to myy knowledge it's still running.

Mark D

Mark said...

You may be fine with your fire tablet, but no matter how good it is, your tablet won''t support the internet and "modern" financial systems which are essential to our day to day life. Please note that I put modern in quotes for a reason. While much of todays on-line financial systems have been developed using newer programming languages, much of the core processing is still done on systems based on Cobol and even BAL in many cases. As pointed out in the article the systems must function in certain ways and banks and other financial institutions are loath to switch out all of their core processing and risk having it fail in unexpected ways. Yes there are new systems providers that have built truly modern financial systems using C++, Java, etc. but there are still legacy systems out there that need to continue to process. 50 years ago, I ran a regional bank's financial systems on an IBM 360 which was less powerful than the tablet and/or smart phone I have on my desk today. But that doesn't imply that I could run a bank's cored systems on said tablet. Part of the problem is code complexity that has developed over the years as Peter noted. Part of the problem is the sheer volume of transactions. I tend to agree with the article that Peter cites.

Mark said...

I should add, in response to a prior comment, that legacy code is not just around because management had other priorities, but because management was too scared to replace working systems with new code - appropriately in many cases. I know of at least one major bank that is no longer in existence because they tried to replace major systems in too short of a time frame. The only way they could continue was to be purchased by another bank that installed all of the purchaser's systems to replace the old bank's systems that no longer functioned properly.

Anonymous said...

So was/is this the "October Surprise" that we have been warned about?

Anonymous said...

My company wanted me to write an inventory program.
I declined to participate because I just knew that the project would never end due to requests for changes, additional tracking options, etc.
Best decision I ever made...

Samuel E. Hancock said...

The sooner the better IMHO. But there must be some method to the madness. Any complex system cannot be fully tested without the real world inputs the programming was designed for. It would not be wise to migrate any platform without a rigorous trial, overseen by people who understand ALL potential paths to failure. Perhaps the process could be: Two separate AI’s both working together to simulate the program offline. They would create the conditions necessary to prove the existing legacy program works EXACTLY as the online system does with the inputs they created for the testing. Once this step has passed the initial trials, the AI’s are split apart to create the new platform program individually while simultaneously documenting the old program. Then these new programs could be tested (still offline) against the SAME inputs used for the legacy block. The results should then be compared to see which ran better. Finally they are joined back together to finish the update using the better AI in the initial testing to have the greater weight in decision making if there is any disagreement. Again a final test is run with (still offline) with not only the old inputs but also any new bottlenecks / issues that were revealed during the initial test runs. If the decision is finally made to NOT change the platform, at least the legacy code has been documented to a level where it could possibly be understood and supported until new AI’s could be brought to the table. Repeat as needed until confidence is assured. I am certain there will be many surprises. My apologies to our host that this ran so long. It is only a suggestion.

Rick T said...

Start with the arrant stupidity of allowing management of critical systems like food freezers from the internet and neither patching the systems nor replacing obsolete hardware because of the perceived expense.

Now add in not disconnecting them after a documented attack in Europe so a second round of industrial freezers got locked into defrost mode and destroyed the contents.

Management will NOT make changes until the immediate costs are high enough, and they will turn a blind eye to exposed problems every time until it is too late.

Robert said...

AI can generate bugs in that replacement code which your programmers will never be able to imagine, let alone correct.

You simple cannot trust AI code. You must understand what that code is doing and why it is doing it in the specific way that the AI generated it.

That is not because the AI is wrong. It is because there will be several hundred things you forgot to tell the AI when you had it regenerate the application. There will be other things you told the AI which were wrong. Oops.

The good news is that AI is very good at spotting incompleteness and inconsistency in code and in specifications - if you prompt it to look for such things. You still must decide how to resolve the findings of a review.

None of that is quick, easy, or cheap.

lynn said...

I am in the middle of converting my 1/3rd Fortran 66 and 2/3rds Fortran 77 calculation engine for my Chemical Process Simulator to a somewhat primitive C++ code set. I started back in 2022 and I have converted around 400,000 lines of code so far and will be running my third set of tests very soon. I have another 400,000 lines of code to convert. I am hoping to finish in the summer of 2027, this set of tests will tell me how things are going.
I am using a custom version of F2C to convert my code, I was hoping for 80% conversion but am getting more like 70% conversion. The rest I have to fix by hand. The big hangups are the array indexing starting at zero instead of one and character strings.

Old NFO said...

Speaking of legacy stuff, WHY does DOS 3.3 still work in the command line in Windoze, if DOS was done away with??? :-)

Anonymous said...

To play it safe, you would need to write new code for one subsystem, then run it in parallel with the legacy subsystem at full volume, then compare all the output. And do this for multiple months, because some bugs are intermittent. Doing this one subsystem at a time will take many manhours and computer resources. Very expensive. You will also be trying to hit a moving target, because management(and customers) will be looking for ongoing improvements. More time, more resources, more money.

Eric Brown said...

It doesn’t. The command prompt is there, but DOS programs won’t run, and haven’t for decades. Windows 11 dropped Win16 support as well.

Anonymous said...

“However, I was told that wasn't acceptable.”. I sure hope plumbers, electricians, etc. don’t listen to unprofessional suggestions. - EG

Paul said...

I worked for a large bank at the end of my career, which has spanned over 50 years now. I was working with a system that intercepted dunning letters for lawyer conditions the base collection system missed. I had a report with 40k lines on it of delinquent loans. this report was sourced into excel monthly and every other month or so the load would fail on a out of date range error. There where two notes that went over 30 days delinquent that triggered the error. They where on lines 8,456 and 12,568 of the data feed, as I recall. Both loan had origination dates that where on or about dates in the years 211 and 205. Maybe more detail than was needed but it took some time to find them.

Those where all running older system created to facilitate a legacy system that handled all the source data. I think if the wheels come off it will be soon and it will be epic.

Jorgan Progmatisti said...

I believe the "bugs" being found don't exist but its lies to force you to upgrade to new software designed by AI to have the actual exploits and backdoors baked in. So I will chance staying on the old stuff unpatched, and I will be fine because I am right.

Andrew Smith said...

Indeed there are many ways of waging war, even with pagers.

BadFrog said...

Cobol is the 1911 of languages. It may be old, it may not be sexy but, by God, it still gets the job done. Like any 1911, it may encounter glitches but the solutions are well known and documented.