You are invited to Log in or Register a free Frihost Account!

25 year old BSD bug fixed :p


1983. The year of the IBM PC XT, the Apple Lisa, Pioneer 10 leaving the solar system, and Hooters opening up shop in Florida. It's also the birthyear of a 25 year old BSD bug, squashed only a few days ago.

A few days ago, Marc Balmer, OpenBSD developer, received an email from an OpenBSD user. The email claimed that SAMBA would crash when serving files off an MS-DOS filesystem. Balmer got into contact with a few SAMBA developers who claimed that SAMBA uses a special workaround in order to function properly on BSD systems: the code for reading directories in all BSDs was flawed.

Understandably, Balmer's first reaction was disbelief. "Of course my first reaction was to blame Samba," he writes. Despite his initial reaction, he decided to dig deeper into this case, and he uncovered a bug that had been sitting in the code of all BSDs (including Mac OS X), including a lot of old releases. He confirmed the bug was already in 4.2BSD, released in August of 1983.

The bug itself? Well, I'm no programmer so the actual code is kind of gibberish to me, but I think I get the gist of the problem.
This code will not work as expected when seeking to the second entry of a block where the first has been deleted: seekdir() calls readdir() which happily skips the first entry (it has inode set to zero), and advance to the second entry. When the user now calls readdir() to read the directory entry to which he just seekdir()ed, he does not get the second entry but the third.

Marshall Kirk McKusick, the original developer of the *dir() library, commented on the issue in a personal conversation with Balmer:

As the original author of the *dir() library, you probably fixed one of my bugs . Prior to the *dir() commands, programs just opened, read, and interpreted directories directly. I had to update a shocking 22 programs (a large percentage of the programs available on UNIX at the time) to replace their direct interpretation of directories with the *dir() library calls.
This little bug's fix was actually fairly trivial (as is common with these sorts of long-standing bugs): "The fix is surprisingly simple, not to say trivial: _readdir_unlocked() must not skip directory entries with inode set to zero when it is called from __seekdir()."

"Sorry that it took us almost twenty-five years to fix it," Balmer adds, jokingly.

Do you understand what the bug actually is? I'm confused with that guy's explanation, which is obviously intended for geeks. Very Happy
Related topics
“Alien” Embryo Removed From 35-Year-Old Man’s Back....
11 year old girl taking heroin
Sex Before Marriage
Wow, 13 year old kid dies of heroin overdose
6-Year-Old Minn. Boy Brings Pot to School
60 Year Old Woman wins $2 million in matchmaker suit
Former Miss Universe to go on a date with a 17 year old...
Happy birthday for the one year old bill.
WWE Smackdown tapings Tuesday, January 30, 2007
Any 14 year old (or younger) web designers out there?
Are memorie of 1 year old humans less advanced than animals?
My one Year old son
Occupiers raped a 14 year old?
Reply to topic    Frihost Forum Index -> Lifestyle and News -> Discuss World News

© 2005-2011 Frihost, forums powered by phpBB.