A computer bug is an error, flaw, mistake, failure, or fault in a computer program that prevents it from working correctly or produces an incorrect result. Bugs arise from mistakes and errors, made by people, in either a program's source code or its design. It is said that there are bugs in all useful computer programs, but well-written programs contain relatively few bugs, and these bugs typically do not prevent the program from performing its task. A program that contains a large number of bugs, and/or bugs that seriously interfere with its functionality, is said to be buggy. Reports about bugs in a program are referred to as bug reports, also called PRs (problem reports), trouble reports, CRs (change requests), and so forth.
- If you want to report a bug with the MediaWiki software which runs Wikipedia, go to MediaZilla..
Table of contents
Bugs can have a wide variety of effects, with varying levels of inconvenience to the user of the program. Some bugs have only a subtle effect on the program's functionality, and may thus lie undetected for a long time. More serious bugs may cause the program to crash or freeze. In some operating systems, such as Microsoft Windows, a single crashing or freezing program may render the computer unusable until it is rebooted (see blue screen of death.) Other bugs lead to security problems; for example, a common type of bug called a buffer overflow may allow a malicious user to execute other programs that are normally not allowed to run.
It can be psychologicaly difficult for some engineers to accept that their design contains bugs. They may hide behind euphemisms like "issues" or "unplanned features". This is also true of corporate software where a fix for a bug is often called "a reliability enhancement".
The results of bugs may be extremely serious. In 1996, the European Space Agency's US$1 billion prototype Ariane 5 rocket was destroyed less than a minute after launch, due to a bug in the on-board guidance computer.
Usage of the term "bug" to describe inexplicable defects has been a part of engineering jargon for many decades; it may have originally been used in hardware engineering to describe mechanical malfunctions. For instance, Edison wrote the following words in a letter to an associate in 1878:
It has been just so in all of my inventions. The first step is an intuition, and comes with a burst, then difficulties arise—this thing gives out and [it is] then that "Bugs"—as such little faults and difficulties are called—show themselves and months of intense watching, study and labor are requisite before commercial success or failure is certainly reached.Problems with radar electronics during World War II were referred to as bugs (or glitches), and there is additional evidence that the usage dates back much earlier.
- Source: Edison to Puskas, 13 November 1878, Edison papers, Edison National Laboratory, U.S. National Park Service, West Orange, N.J., cited in Thomas P. Hughes, American Genesis: A History of the American Genius for Invention, Penguin Books, 1989, on page 75.
The invention of the term is often erroneously attributed to Grace Hopper, who publicized the cause of a malfunction in an early electromechanical computer. A typical version of the story is given by this quote:
- In 1946, when Hopper was released from active duty, she joined the Harvard Faculty at the Computation Laboratory where she continued her work on the Mark II and Mark III. Operators traced an error in the Mark II to a moth trapped in a relay, coining the term bug. This bug was carefully removed and taped to the log book September 9th 1945. Hopper recounted the cause to be an actual insect stuck between the contacts of a relay in the logic mechanisms of the device. 
Hopper was not actually the one who found the insect, as she readily acknowledged. And the date was September 9th of 1947, not of 1945 . The operators who did find it were familiar with the engineering term and, amused, kept the insect with the notation "First actual case of bug being found." Hopper loved to recount the story. 
Bugs are a consequence of the nature of the programming task. Some bugs arise from simple oversights made when computer programmers write source code carelessly or exceed their hrair limit. Many off-by-one errors fall into this category. Other bugs arise from unintended interactions between different parts of a computer program. This happens because computer programs are often complex, so that programmers are unable to mentally keep track of every possible way in which different parts can interact. Many race condition bugs fall into this category.
The computer software industry has put a great deal of effort into finding methods for preventing programmers from inadvertently introducing bugs while writing software. These include:
- Programming techniques. Bugs often create inconsistencies in the internal data of a running program. Programs can be written to check the consistency of their own internal data while running. If an inconsistency is encountered, the program can immediately halt, so that the bug can be located and fixed. Alternatively, the program can simply inform the user, attempt to correct the inconsistency, and continue running.
- Development methodologies. There are several schemes for managing programmer activity, so that fewer bugs are produced. Many of these fall under the discipline of software engineering (which addresses software design issues as well.) For example, formal program specifications are used to state the exact behavior of programs, so that design bugs can be eliminated.
- Programming language support. Programming languages often include features which help programmers deal with bugs, such as exception handling. In addition, many recently-invented languages have deliberately excluded features which can easily lead to bugs. For example, the Java programming language does not support pointer arithmetic.
Main article: Debugging
Finding and fixing bugs, or "debugging", has always been a major part of computer programming. Maurice Wilkes, an early computing pioneer, described his realization in the late 1940s that much of the rest of his life would be spent finding mistakes in his own programs. As computer programs grow more complex, bugs become more common and difficult to fix. Often, programmers spend more time and effort finding and fixing bugs than writing new code.
Usually, the most difficult part of debugging is locating the erroneous part of the source code. Once the mistake is found, correcting it is usually easy. Programs known as debuggers exist to help programmers locate bugs. However, even with the aid of a debugger, locating bugs is something of an art.
Typically, the first step in locating a bug is finding a way to reproduce it easily. Once the bug is reproduced, the programmer can use a debugger or some other tool to monitor the execution of the program in the faulty region, and (eventually) find the problem. However, it is not always easy to reproduce bugs. Some bugs are triggered by inputs to the program which may be difficult for the programmer to re-create. Other bugs may disappear when the program is run with a debugger; these are heisenbugs (humorously named after the Heisenberg uncertainty principle.)
Debugging is still a tedious task requiring considerable manpower. Since the 1990s, particularly following the Ariane 5 Flight 501 disaster, there has been a renewed interest in the development of effective automated aids to debugging. For instance, methods of static analysis by abstract interpretation have already made significant achievements, while still remaining much of a work in progress.
Famous computer bugs
The following is a list of famous computer bugs:
- ESA Ariane 5 taking off (1996 June 4).
- Progress M1–4
- NASA Apollo 11 landing problem (1969 July 20).
- NASA Mars Climate Orbiter (1999) onboard computer used metric while ground computer used imperial
- Mars Polar Lander
- NASA Voyager 2 (1986 January 25).
- Phobos 1 (1988 September 10).
- NASA Mars Rover (January 21st 2004) too many open files for the flash memory; the robotic Rover freezes in mid-motion; the problem was fixed remotely from Earth.
- The Therac-25 accidents (1985–1987), quite possibly the most serious computer-related failure ever in terms of human life lost.
- Pentium FDIV bug
- Pentium F0 bug
- The year 2000 problem, popularly known as the "Y2K bug", spawned fears of worldwide economic collapse and an industry of consultants providing last-minute fixes
- The MIM-104 Patriot bug, which resulted in the deaths of 28 Americans in Dharan, Saudi Arabia.
- V-22 Osprey
- Douglas Adams' Deep Thought's 42 – "Ah But what is the question?" bug.
- Arthur C. Clarke's HAL 9000's bug.
- The Terminator film series' Skynet bug.
- In the Star Trek episode I, Mudd, an android is defeated by being forced to process the Epimenides paradox. Any artifical intelligence unable to handle such a mundane logical problem is obviously very buggy!
- The Missingno. and Glitch City bugs, found in the Pokémon series
- The Minus world in Super Mario Bros.
Modern bugs and security holes
Traditionally bugs were fixed before a new release. In the first decade of the XXI century, as software is more complex, it happens that a program is released to the public and at the same time it has many bugs that the developers didn't know about when they released the version. Such a bug may just prevent the user to do some tasks, but often they also produce:
- Operating System instability: Some of this bugs will cause the operating system to crash on you.
- It is now a fact that the windows operating system is the only one where this kind of problems are common. The blue screen of death has become legend.
- the Linux kernel has a similar message called "kernel panic", but it seems to exist only in books and web pages. Excepting when an unstable version of the Linux kernel or a buggy driver are used, Linux-based operating systems have a reputation to run on full load for months or even years without a single reboot.
- Application instability: Many applications will crash because of unknown bugs. Usually when an application crash, the system is still running.
- Security vulnerabilities or security holes:
- Many windows computers computers are infected by viruses. They use one of the many known (but not yet fixed) vulnerabilities that are discovered very often in the system.
- Other operating systems like the BSD-based, Linux-based and MaxOS X have no known viruses that can actually compromise a well-configured system.
In general, free software has as many bugs as proprietary software, but in time, the use of web-based bug-tracking systems dramatically discover and reduce this number. While there is no important software that has no bugs, there is a big difference between software: Free software development is based not only on the principle of opening the source code and setting it free, but also publishing all known bugs on web pages, even the bugs that are not confirmed or that do or do not imply security risks.
On the other side, proprietary software will usually not inform the public on the vulnerabilities the software has. Especially on the windows operating system where people are encouraged to buy anti-virus and firewall software that not only does not fix the bugs but also can hide them to the end user. In general, new vulnerabilities are not patched and are hidden to the public until a virus exploiting the vulnerability appears.
Since most spyware infected computers (as of 30 April 2005) run Windows with the Internet Explorer browser, it should be noted that even with the latest security patches from Microsoft, Internet Explorer has (as of April 30, 2005) 19 advisories rated highly critical, some of them two years old. On the contrary, the new Mozilla Firefox 1.0.x browser has only 4 advisories rated less critical that are less than 7 months old. Opera has zero known vulnerabilities.
To find more about the number of known vulnerabilities a particular software may have at this moment, you can search for security bugs on the Secunia web page.
Common types of computer bugs
- Divide by zero
- Infinite loops
- Arithmetic overflow or underflow
- Exceeding array bounds
- Using an uninitialized variable
- Accessing memory not owned (Access violation)
- Memory leak
- Stack overflow or underflow
- Buffer overflow
- Off by one error
- Race hazard
- Loss of precision in type conversion
- ISO 9126, which classifies a bug as either a defect or a nonconformity
- Bug tracking
- Bit rot
- Bohr bug
- Thomas Huckle of TU München has an extensive page on computer bugs
- Nachum Dershowitz's page on computer bugs
- N. Leveson and C. Turner: An Investigation of the Therac-25 Accidents
- Rose, Barbara Wade: Fatal Dose: Radiation Deaths linked to AECL Computer Errors (producers of the Therac-25)
- picture of the first computer bug
- The comp.risks Usenet newsgroup, a forum on risks to the public in computers and related systems