HOME

TheInfoList



OR:

A software bug is an error, flaw or fault in the design, development, or operation of
computer software Software is a set of computer programs and associated documentation and data. This is in contrast to hardware, from which the system is built and which actually performs the work. At the lowest programming level, executable code consists ...
that causes it to produce an incorrect or unexpected result, or to behave in unintended ways. The process of finding and correcting bugs is termed "
debugging In computer programming and software development, debugging is the process of finding and resolving '' bugs'' (defects or problems that prevent correct operation) within computer programs, software, or systems. Debugging tactics can involve in ...
" and often uses formal techniques or tools to pinpoint bugs. Since the 1950s, some computer systems have been designed to deter, detect or auto-correct various computer bugs during operations. Bugs in software can arise from mistakes and errors made in interpreting and extracting users' requirements, planning a program's
design A design is a plan or specification for the construction of an object or system or for the implementation of an activity or process or the result of that plan or specification in the form of a prototype, product, or process. The verb ''to design'' ...
, writing its
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the wo ...
, and from interaction with humans, hardware and programs, such as
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs. Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
s or libraries. A program with many, or serious, bugs is often described as ''buggy''. Bugs can trigger errors that may have
ripple effect A ripple effect occurs when an initial disturbance to a system propagates outward to disturb an increasingly larger portion of the system, like ripples expanding across the water when an object is dropped into it. The ripple effect is often used ...
s. The effects of bugs may be subtle, such as unintended text formatting, through to more obvious effects such as causing a program to
crash Crash or CRASH may refer to: Common meanings * Collision, an impact between two or more objects * Crash (computing), a condition where a program ceases to respond * Cardiac arrest, a medical condition in which the heart stops beating * Couch su ...
,
freezing Freezing is a phase transition where a liquid turns into a solid when its temperature is lowered below its freezing point. In accordance with the internationally established definition, freezing means the solidification phase change of a liquid o ...
the computer, or causing damage to hardware. Other bugs qualify as
security bugs Security is protection from, or resilience against, potential harm (or other unwanted coercive change) caused by others, by restraining the freedom of others to act. Beneficiaries (technically referents) of security may be of persons and social ...
and might, for example, enable a malicious user to bypass
access control In the fields of physical security and information security, access control (AC) is the selective restriction of access to a place or other resource, while access management describes the process. The act of ''accessing'' may mean consuming ...
s in order to obtain unauthorized privileges. Some software bugs have been linked to disasters. Bugs in code that controlled the
Therac-25 The Therac-25 was a computer-controlled radiation therapy machine produced by Atomic Energy of Canada Limited (AECL) in 1982 after the Therac-6 and Therac-20 units (the earlier units had been produced in partnership with of France). It was invol ...
radiation therapy Radiation therapy or radiotherapy, often abbreviated RT, RTx, or XRT, is a therapy using ionizing radiation, generally provided as part of cancer treatment to control or kill malignant cells and normally delivered by a linear accelerator. Radia ...
machine were directly responsible for patient deaths in the 1980s. In 1996, the
European Space Agency , owners = , headquarters = Paris, Île-de-France, France , coordinates = , spaceport = Guiana Space Centre , seal = File:ESA emblem seal.png , seal_size = 130px , image = Views in the Main Control Room (1205 ...
'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 program. In 1994, an RAF Chinook helicopter crashed, killing 29; this was initially blamed on pilot error, but was later thought to have been caused by a software bug in the engine-control computer. Buggy software caused the early 21st century British Post Office scandal, the most widespread miscarriage of justice in British legal history. In 2002, a study commissioned by the US
Department of Commerce The United States Department of Commerce is an executive department of the U.S. federal government concerned with creating the conditions for economic growth and opportunity. Among its tasks are gathering economic and demographic data for bu ...
's
National Institute of Standards and Technology The National Institute of Standards and Technology (NIST) is an agency of the United States Department of Commerce whose mission is to promote American innovation and industrial competitiveness. NIST's activities are organized into physical sci ...
concluded that "software bugs, or errors, are so prevalent and so detrimental that they cost the US economy an estimated $59 billion annually, or about 0.6 percent of the gross domestic product".


History

The Middle English word '' bugge'' is the basis for the terms " bugbear" and " bugaboo" as terms used for a monster. The term "bug" to describe defects has been a part of engineering jargon since the 1870s and predates electronics and computers; it may have originally been used in hardware engineering to describe mechanical malfunctions. For instance,
Thomas Edison Thomas Alva Edison (February 11, 1847October 18, 1931) was an American inventor and businessman. He developed many devices in fields such as electric power generation, mass communication, sound recording, and motion pictures. These inventio ...
wrote in a letter to an associate in 1878: Baffle Ball, the first mechanical pinball game, was advertised as being "free of bugs" in 1931. Problems with military gear during
World War II World War II or the Second World War, often abbreviated as WWII or WW2, was a world war that lasted from 1939 to 1945. It involved the vast majority of the world's countries—including all of the great powers—forming two opposin ...
were referred to as bugs (or glitches). In a book published in 1942,
Louise Dickinson Rich Louise Dickinson Rich (14 June 1903 – 19 April 1991) was a writer known for fiction and non-fiction works about the New England region of the United States, particularly Massachusetts and Maine. Her best-known work was her first book, the auto ...
, speaking of a powered
ice cutting Ice cutting is a winter task of collecting surface ice from lakes and rivers for storage in ice houses and use or sale as a cooling method. Rare today, it was common (see ice trade) before the era of widespread mechanical refrigeration and air c ...
machine, said, "Ice sawing was suspended until the creator could be brought in to take the bugs out of his darling."
Isaac Asimov yi, יצחק אזימאװ , birth_date = , birth_place = Petrovichi, Russian SFSR , spouse = , relatives = , children = 2 , death_date = , death_place = Manhattan, New York City, U.S. , nationality = Russian (1920–1922)Soviet (192 ...
used the term "bug" to relate to issues with a robot in his short story "
Catch That Rabbit "Catch that Rabbit" is a science fiction short story by American writer Isaac Asimov. It was first published in the February 1944 issue of ''Astounding Science Fiction'' and reprinted in the collections ''I, Robot'' (1950) and ''The Complete Ro ...
", published in 1944. The term "bug" was used in an account by computer pioneer Grace Hopper, who publicized the cause of a malfunction in an early electromechanical computer. A typical version of the story is: Hopper was not present when the bug was found, but it became one of her favorite stories. The date in the log book was September 9, 1947.Log Book With Computer Bug
", National Museum of American History, Smithsonian Institution.
The operators who found it, including William "Bill" Burke, later of the
Naval Weapons Laboratory The United States Naval Surface Warfare Center Dahlgren Division (NSWCDD), named for Rear Admiral John A. Dahlgren, is located in King George County, Virginia, in close proximity to the largest fleet concentration area in the Navy. NSWCDD is ...
, Dahlgren, Virginia, were familiar with the engineering term and amusedly kept the insect with the notation "First actual case of bug being found." This log book, complete with attached moth, is part of the collection of the Smithsonian
National Museum of American History The National Museum of American History: Kenneth E. Behring Center collects, preserves, and displays the heritage of the United States in the areas of social, political, cultural, scientific, and military history. Among the items on display is t ...
. The related term "
debug In computer programming and software development, debugging is the process of finding and resolving '' bugs'' (defects or problems that prevent correct operation) within computer programs, software, or systems. Debugging tactics can involve int ...
" also appears to predate its usage in computing: the ''
Oxford English Dictionary The ''Oxford English Dictionary'' (''OED'') is the first and foundational historical dictionary of the English language, published by Oxford University Press (OUP). It traces the historical development of the English language, providing a com ...
''s etymology of the word contains an attestation from 1945, in the context of aircraft engines. The concept that software might contain errors dates back to Ada Lovelace's 1843 notes on the analytical engine, in which she speaks of the possibility of program "cards" for
Charles Babbage Charles Babbage (; 26 December 1791 – 18 October 1871) was an English polymath. A mathematician, philosopher, inventor and mechanical engineer, Babbage originated the concept of a digital programmable computer. Babbage is considered ...
's
analytical engine The Analytical Engine was a proposed mechanical general-purpose computer designed by English mathematician and computer pioneer Charles Babbage. It was first described in 1837 as the successor to Babbage's difference engine, which was a des ...
being erroneous:


"Bugs in the System" report

The Open Technology Institute, run by the group, New America, released a report "Bugs in the System" in August 2016 stating that U.S. policymakers should make reforms to help researchers identify and address software bugs. The report "highlights the need for reform in the field of software vulnerability discovery and disclosure." One of the report's authors said that
Congress A congress is a formal meeting of the representatives of different countries, constituent states, organizations, trade unions, political parties, or other groups. The term originated in Late Middle English to denote an encounter (meeting of a ...
has not done enough to address cyber software vulnerability, even though Congress has passed a number of bills to combat the larger issue of cyber security. Government researchers, companies, and cyber security experts are the people who typically discover software flaws. The report calls for reforming computer crime and copyright laws.


Terminology

While the use of the term "bug" to describe software errors is common, many have suggested that it should be abandoned. One argument is that the word "bug" is divorced from a sense that a human being caused the problem, and instead implies that the defect arose on its own, leading to a push to abandon the term "bug" in favor of terms such as "defect", with limited success. Since the 1970s Gary Kildall somewhat humorously suggested to use the term "blunder". In software engineering, ''mistake metamorphism'' (from Greek ''meta'' = "change", ''morph'' = "form") refers to the evolution of a defect in the final stage of software deployment. Transformation of a "mistake" committed by an analyst in the early stages of the software development lifecycle, which leads to a "defect" in the final stage of the cycle has been called 'mistake metamorphism'. Different stages of a "mistake" in the entire cycle may be described as "mistakes", "anomalies", "faults", "failures", "errors", "exceptions", "crashes", "glitches", "bugs", "defects", "incidents", or "side effects".


Prevention

The software industry has put much effort into reducing bug counts. These include:


Typographical errors

Bugs usually appear when the programmer makes a logic error. Various innovations in
programming style Programming style, also known as code style, is a set of rules or guidelines used when writing the source code for a computer program. It is often claimed that following a particular programming style will help programmers read and understand sour ...
and
defensive programming Defensive programming is a form of defensive design intended to develop programs that are capable of detecting potential security abnormalities and make predetermined responses. It ensures the continuing function of a piece of software under unf ...
are designed to make these bugs less likely, or easier to spot. Some typos, especially of symbols or logical/
mathematical operators Mathematical Operators is a Unicode block containing characters for mathematical, logical, and set notation. Notably absent are the plus sign (+), greater than sign (>) and less than sign (<), due to them already appearing in the Basic ...
, allow the program to operate incorrectly, while others such as a missing symbol or misspelled name may prevent the program from operating. Compiled languages can reveal some typos when the
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the wo ...
is compiled.


Development methodologies

Several schemes assist managing programmer activity so that fewer bugs are produced.
Software engineering Software engineering is a systematic engineering approach to software development. A software engineer is a person who applies the principles of software engineering to design, develop, maintain, test, and evaluate computer software. The term '' ...
(which addresses software design issues as well) applies many techniques to prevent defects. For example, formal
program specification In computer science, formal specifications are mathematically based techniques whose purpose are to help with the implementation of systems and software. They are used to describe a system, to analyze its behavior, and to aid in its design by verif ...
s state the exact behavior of programs so that design bugs may be eliminated. Unfortunately, formal specifications are impractical for anything but the shortest programs, because of problems of combinatorial explosion and indeterminacy. Unit testing involves writing a test for every function (unit) that a program is to perform. In test-driven development unit tests are written before the code and the code is not considered complete until all tests complete successfully.
Agile software development In software development, agile (sometimes written Agile) practices include requirements discovery and solutions improvement through the collaborative effort of self-organizing and cross-functional teams with their customer(s)/ end user(s), ad ...
involves frequent software releases with relatively small changes. Defects are revealed by user feedback. Open source development allows anyone to examine source code. A school of thought popularized by
Eric S. Raymond Eric Steven Raymond (born December 4, 1957), often referred to as ESR, is an American software developer, open-source software advocate, and author of the 1997 essay and 1999 book ''The Cathedral and the Bazaar''. He wrote a guidebook for the ...
as
Linus's law In software development, Linus's law is the assertion that "given enough eyeballs, all bugs are shallow". The law was formulated by Eric S. Raymond in his essay and book ''The Cathedral and the Bazaar'' (1999), and was named in honor of Linus T ...
says that popular
open-source software Open-source software (OSS) is computer software that is released under a license in which the copyright holder grants users the rights to use, study, change, and distribute the software and its source code to anyone and for any purpose. Op ...
has more chance of having few or no bugs than other software, because "given enough eyeballs, all bugs are shallow". This assertion has been disputed, however: computer security specialist
Elias Levy Elias Levy (also known as Aleph One) is a computer scientist. He was the moderator of "Bugtraq", a full disclosure vulnerability mailing list, from May 14, 1996 until October 15, 2001. He was the CTO and co-founder of the computer security compa ...
wrote that "it is easy to hide vulnerabilities in complex, little understood and undocumented source code," because, "even if people are reviewing the code, that doesn't mean they're qualified to do so." An example of an open-source software bug was the 2008 OpenSSL vulnerability in Debian.


Programming language support

Programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
s include features to help prevent bugs, such as static
type system In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a type to every "term" (a word, phrase, or other set of symbols). Usually the terms are various constructs of a computer progra ...
s, restricted namespaces and modular programming. For example, when a programmer writes (
pseudocode In computer science, pseudocode is a plain language description of the steps in an algorithm or another system. Pseudocode often uses structural conventions of a normal programming language, but is intended for human reading rather than machine re ...
) LET REAL_VALUE PI = "THREE AND A BIT", although this may be syntactically correct, the code fails a type check. Compiled languages catch this without having to run the program. Interpreted languages catch such errors at runtime. Some languages deliberately exclude features that easily lead to bugs, at the expense of slower performance: the general principle being that, it is almost always better to write simpler, slower code than inscrutable code that runs slightly faster, especially considering that
maintenance cost The technical meaning of maintenance involves functional checks, servicing, repairing or replacing of necessary devices, equipment, machinery, building infrastructure, and supporting utilities in industrial, business, and residential installa ...
is substantial. For example, the Java programming language does not support pointer arithmetic; implementations of some languages such as
Pascal Pascal, Pascal's or PASCAL may refer to: People and fictional characters * Pascal (given name), including a list of people with the name * Pascal (surname), including a list of people and fictional characters with the name ** Blaise Pascal, Fren ...
and
scripting language A scripting language or script language is a programming language that is used to manipulate, customize, and automate the facilities of an existing system. Scripting languages are usually interpreted at runtime rather than compiled. A scripting ...
s often have runtime bounds checking of arrays, at least in a debugging build.


Code analysis

Tools for code analysis help developers by inspecting the program text beyond the compiler's capabilities to spot potential problems. Although in general the problem of finding all programming errors given a specification is not solvable (see
halting problem In computability theory, the halting problem is the problem of determining, from a description of an arbitrary computer program and an input, whether the program will finish running, or continue to run forever. Alan Turing proved in 1936 that a g ...
), these tools exploit the fact that human programmers tend to make certain kinds of simple mistakes often when writing software.


Instrumentation

Tools to monitor the performance of the software as it is running, either specifically to find problems such as bottlenecks or to give assurance as to correct working, may be embedded in the code explicitly (perhaps as simple as a statement saying PRINT "I AM HERE"), or provided as tools. It is often a surprise to find where most of the time is taken by a piece of code, and this removal of assumptions might cause the code to be rewritten.


Testing

Software tester Software testing is the act of examining the artifacts and the behavior of the software under test by validation and verification. Software testing can also provide an objective, independent view of the software to allow the business to apprecia ...
s are people whose primary task is to find bugs, or write code to support testing. On some projects, more resources may be spent on testing than in developing the program. Measurements during testing can provide an estimate of the number of likely bugs remaining; this becomes more reliable the longer a product is tested and developed.


Debugging

Finding and fixing bugs, or ''debugging'', is a major part of
computer programming Computer programming is the process of performing a particular computation (or more generally, accomplishing a specific computing result), usually by designing and building an executable computer program. Programming involves tasks such as ana ...
.
Maurice Wilkes Sir Maurice Vincent Wilkes (26 June 1913 – 29 November 2010) was a British computer scientist who designed and helped build the Electronic Delay Storage Automatic Calculator (EDSAC), one of the earliest stored program computers, and who inv ...
, 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. Usually, the most difficult part of debugging is finding the bug. Once it is found, correcting it is usually relatively easy. Programs known as debuggers help programmers locate bugs by executing code line by line, watching variable values, and other features to observe program behavior. Without a debugger, code may be added so that messages or values may be written to a console or to a window or log file to trace program execution or show values. However, even with the aid of a debugger, locating bugs is something of an art. It is not uncommon for a bug in one section of a program to cause failures in a completely different section, thus making it especially difficult to track (for example, an error in a graphics rendering routine causing a file I/O routine to fail), in an apparently unrelated part of the system. Sometimes, a bug is not an isolated flaw, but represents an error of thinking or planning on the part of the programmer. Such '' logic errors'' require a section of the program to be overhauled or rewritten. As a part of
code review Code review (sometimes referred to as peer review) is a software quality assurance activity in which one or several people check a program mainly by viewing and reading parts of its source code, and they do so after implementation or as an interru ...
, stepping through the code and imagining or transcribing the execution process may often find errors without ever reproducing the bug as such. More typically, the first step in locating a bug is to reproduce it reliably. Once the bug is reproducible, the programmer may use a debugger or other tool while reproducing the error to find the point at which the program went astray. Some bugs are revealed by inputs that may be difficult for the programmer to re-create. One cause of the
Therac-25 The Therac-25 was a computer-controlled radiation therapy machine produced by Atomic Energy of Canada Limited (AECL) in 1982 after the Therac-6 and Therac-20 units (the earlier units had been produced in partnership with of France). It was invol ...
radiation machine deaths was a bug (specifically, a race condition) that occurred only when the machine operator very rapidly entered a treatment plan; it took days of practice to become able to do this, so the bug did not manifest in testing or when the manufacturer attempted to duplicate it. Other bugs may stop occurring whenever the setup is augmented to help find the bug, such as running the program with a debugger; these are called '' heisenbugs'' (humorously named after the
Heisenberg uncertainty principle In quantum mechanics, the uncertainty principle (also known as Heisenberg's uncertainty principle) is any of a variety of mathematical inequalities asserting a fundamental limit to the accuracy with which the values for certain pairs of physic ...
). Since the 1990s, particularly following the
Ariane 5 Flight 501 Ariane flight V88 was the failed maiden flight of the Arianespace Ariane 5 rocket, vehicle no. 501, on 4 June 1996. It carried the Cluster spacecraft, a constellation of four European Space Agency research satellites. The launch ended in f ...
disaster, interest in automated aids to debugging rose, such as static code analysis by
abstract interpretation In computer science, abstract interpretation is a theory of sound approximation of the semantics of computer programs, based on monotonic functions over ordered sets, especially lattices. It can be viewed as a partial execution of a computer prog ...
. Some classes of bugs have nothing to do with the code. Faulty documentation or hardware may lead to problems in system use, even though the code matches the documentation. In some cases, changes to the code eliminate the problem even though the code then no longer matches the documentation.
Embedded system An embedded system is a computer system—a combination of a computer processor, computer memory, and input/output peripheral devices—that has a dedicated function within a larger mechanical or electronic system. It is ''embedded'' as ...
s frequently work around hardware bugs, since to make a new version of a
ROM Rom, or ROM may refer to: Biomechanics and medicine * Risk of mortality, a medical classification to estimate the likelihood of death for a patient * Rupture of membranes, a term used during pregnancy to describe a rupture of the amniotic sac * R ...
is much cheaper than remanufacturing the hardware, especially if they are
commodity items In economics, a commodity is an economic good, usually a resource, that has full or substantial fungibility: that is, the market treats instances of the good as equivalent or nearly so with no regard to who produced them. The price of a comm ...
.


Benchmark of bugs

To facilitate reproducible research on testing and debugging, researchers use curated benchmarks of bugs: * the Siemens benchmark * ManyBugs is a benchmark of 185 C bugs in nine open-source programs. * Defects4J is a benchmark of 341 Java bugs from 5 open-source projects. It contains the corresponding patches, which cover a variety of patch type. * BEARS is a benchmark of continuous integration build failures focusing on test failures. It has been created by monitoring builds from open-source projects on
Travis CI Travis CI is a hosted continuous integration service used to build and test software projects hosted on GitHub, Bitbucket, GitLab, Perforce, Apache Subversion and Assembla. Travis CI was the first CI service that provided services to open-sourc ...
.


Bug management

Bug management includes the process of documenting, categorizing, assigning, reproducing, correcting and releasing the corrected code. Proposed changes to software – bugs as well as enhancement requests and even entire releases – are commonly tracked and managed using
bug tracking system A bug tracking system or defect tracking system is a software application that keeps track of reported software bugs in software development projects. It may be regarded as a type of issue tracking system. Many bug tracking systems, such as those ...
s or issue tracking systems. The items added may be called defects, tickets, issues, or, following the
agile development In software development, agile (sometimes written Agile) practices include requirements discovery and solutions improvement through the collaborative effort of self-organizing and cross-functional teams with their customer(s)/ end user(s), ad ...
paradigm, stories and epics. Categories may be objective, subjective or a combination, such as
version number Software versioning is the process of assigning either unique ''version names'' or unique ''version numbers'' to unique states of computer software. Within a given version number category (e.g., major or minor), these numbers are generally assig ...
, area of the software, severity and priority, as well as what type of issue it is, such as a feature request or a bug. A bug triage reviews bugs and decides whether and when to fix them. The decision is based on the bug's priority, and factors such as project schedules. The triage is not meant to investigate the cause of bugs, but rather the cost of fixing them. The triage happens regularly, and goes through bugs opened or reopened since the previous meeting. The attendees of the triage process typically are the project manager, development manager, test manager, build manager, and technical experts.


Severity

''Severity'' is the intensity of the impact the bug has on system operation. This impact may be data loss, financial, loss of goodwill and wasted effort. Severity levels are not standardized. Impacts differ across industry. A crash in a video game has a totally different impact than a crash in a web browser, or real time monitoring system. For example, bug severity levels might be "crash or hang", "no workaround" (meaning there is no way the customer can accomplish a given task), "has workaround" (meaning the user can still accomplish the task), "visual defect" (for example, a missing image or displaced button or form element), or "documentation error". Some software publishers use more qualified severities such as "critical", "high", "low", "blocker" or "trivial". The severity of a bug may be a separate category to its priority for fixing, and the two may be quantified and managed separately.


Priority

''Priority'' controls where a bug falls on the list of planned changes. The priority is decided by each software producer. Priorities may be numerical, such as 1 through 5, or named, such as "critical," "high," "low," or "deferred." These rating scales may be similar or even identical to ''severity'' ratings, but are evaluated as a combination of the bug's severity with its estimated effort to fix; a bug with low severity but easy to fix may get a higher priority than a bug with moderate severity that requires excessive effort to fix. Priority ratings may be aligned with product releases, such as "critical" priority indicating all the bugs that must be fixed before the next software release. A bug severe enough to delay or halt the release of the product is called a "show stopper" or "showstopper bug". It is named so because it "stops the show" – causes unacceptable product failure.


Software releases

It is common practice to release software with known, low-priority bugs. Bugs of sufficiently high priority may warrant a special release of part of the code containing only modules with those fixes. These are known as '' patches''. Most releases include a mixture of behavior changes and multiple bug fixes. Releases that emphasize bug fixes are known as ''maintenance'' releases, to differentiate it from major releases that emphasize feature additions or changes. Reasons that a software publisher opts not to patch or even fix a particular bug include: * A deadline must be met and resources are insufficient to fix all bugs by the deadline. * The bug is already fixed in an upcoming release, and it is not of high priority. * The changes required to fix the bug are too costly or affect too many other components, requiring a major testing activity. * It may be suspected, or known, that some users are relying on the existing buggy behavior; a proposed fix may introduce a
breaking change Backward compatibility (sometimes known as backwards compatibility) is a property of an operating system, product, or technology that allows for interoperability with an older legacy system, or with input designed for such a system, especially i ...
. * The problem is in an area that will be obsolete with an upcoming release; fixing it is unnecessary. * "It's not a bug, it's a feature". A misunderstanding has arisen between expected and perceived behavior or
undocumented feature An undocumented feature is an unintended or undocumented hardware operation, for example an undocumented instruction, or software feature found in computer hardware and software that is considered beneficial or useful. Sometimes the documentation ...
.


Types

In software development projects, a mistake or error may be introduced at any stage. Bugs arise from oversight or misunderstanding by a software team during specification, design, coding, configuration, data entry or documentation. For example, a relatively simple program to alphabetize a list of words, the design might fail to consider what should happen when a word contains a
hyphen The hyphen is a punctuation mark used to join words and to separate syllables of a single word. The use of hyphens is called hyphenation. ''Son-in-law'' is an example of a hyphenated word. The hyphen is sometimes confused with dashes (figure d ...
. Or when converting an abstract design into code, the coder might inadvertently create an
off-by-one error An off-by-one error or off-by-one bug (known by acronyms OBOE, OBO, OB1 and OBOB) is a logic error involving the discrete equivalent of a boundary condition. It often occurs in computer programming when an iterative loop iterates one time too m ...
which can be a "<" where "<=" was intended, and fail to sort the last word in a list. Another category of bug is called a '' race condition'' that may occur when programs have multiple components executing at the same time. If the components interact in a different order than the developer intended, they could interfere with each other and stop the program from completing its tasks. These bugs may be difficult to detect or anticipate, since they may not occur during every execution of a program. Conceptual errors are a developer's misunderstanding of what the software must do. The resulting software may perform according to the developer's understanding, but not what is really needed. Other types:


Arithmetic

In operations on numerical values, problems can arise that result in unexpected output, slowing of a process, or crashing. These can be from a lack of awareness of the qualities of the data storage such as a loss of precision due to
rounding Rounding means replacing a number with an approximate value that has a shorter, simpler, or more explicit representation. For example, replacing $ with $, the fraction 312/937 with 1/3, or the expression with . Rounding is often done to obta ...
,
numerically unstable In the mathematical subfield of numerical analysis, numerical stability is a generally desirable property of numerical algorithms. The precise definition of stability depends on the context. One is numerical linear algebra and the other is algorit ...
algorithms, arithmetic overflow and
underflow The term arithmetic underflow (also floating point underflow, or just underflow) is a condition in a computer program where the result of a calculation is a number of more precise absolute value than the computer can actually represent in memory o ...
, or from lack of awareness of how calculations are handled by different software coding languages such as division by zero which in some languages may throw an exception, and in others may return a special value such as NaN or
infinity Infinity is that which is boundless, endless, or larger than any natural number. It is often denoted by the infinity symbol . Since the time of the ancient Greeks, the philosophical nature of infinity was the subject of many discussions amo ...
.


Control Flow

Control flow In computer science, control flow (or flow of control) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated. The emphasis on explicit control flow distinguishes an ''imper ...
bugs are those found in processes with valid logic, but that lead to unintended results, such as
infinite loops In computer programming, an infinite loop (or endless loop) is a sequence of instructions that, as written, will continue endlessly, unless an external intervention occurs ("pull the plug"). It may be intentional. Overview This differs from: * ...
and infinite
recursion Recursion (adjective: ''recursive'') occurs when a thing is defined in terms of itself or of its type. Recursion is used in a variety of disciplines ranging from linguistics to logic. The most common application of recursion is in mathematics ...
, incorrect comparisons for conditional statements such as using the incorrect
comparison operator In computer science, a relational operator is a programming language construct or Operator (programming), operator that tests or defines some kind of relation (mathematics), relation between Binary function, two entities. These include numerica ...
, and
off-by-one errors An off-by-one error or off-by-one bug (known by acronyms OBOE, OBO, OB1 and OBOB) is a logic error involving the discrete equivalent of a boundary condition. It often occurs in computer programming when an iterative loop iterates one time too m ...
(counting one too many or one too few iterations when looping).


Interfacing

* Incorrect API usage. * Incorrect protocol implementation. * Incorrect hardware handling. * Incorrect assumptions of a particular platform. * Incompatible systems. A new
API An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standa ...
or
communications protocol A communication protocol is a system of rules that allows two or more entities of a communications system to transmit information via any kind of variation of a physical quantity. The protocol defines the rules, syntax, semantics and synchr ...
may seem to work when two systems use different versions, but errors may occur when a function or feature implemented in one version is changed or missing in another. In production systems which must run continually, shutting down the entire system for a major update may not be possible, such as in the telecommunication industry or the internet. In this case, smaller segments of a large system are upgraded individually, to minimize disruption to a large network. However, some sections could be overlooked and not upgraded, and cause compatibility errors which may be difficult to find and repair. * Incorrect code annotations


Multi-threading

* Deadlock, where task A cannot continue until task B finishes, but at the same time, task B cannot continue until task A finishes. * Race condition, where the computer does not perform tasks in the order the programmer intended. * Concurrency errors in critical sections,
mutual exclusion In computer science, mutual exclusion is a property of concurrency control, which is instituted for the purpose of preventing race conditions. It is the requirement that one thread of execution never enters a critical section while a concurrent ...
s and other features of concurrent processing.
Time-of-check-to-time-of-use In software development, time-of-check to time-of-use (TOCTOU, TOCTTOU or TOC/TOU) is a class of software bugs caused by a race condition involving the ''checking'' of the state of a part of a system (such as a security credential) and the ''use'' ...
(TOCTOU) is a form of unprotected critical section.


Resourcing

*
Null pointer In computing, a null pointer or null reference is a value saved for indicating that the pointer or reference does not refer to a valid object. Programs routinely use null pointers to represent conditions such as the end of a list of unknown lengt ...
dereference. * Using an uninitialized variable. * Using an otherwise valid instruction on the wrong
data type In computer science and computer programming, a data type (or simply type) is a set of possible values and a set of allowed operations on it. A data type tells the compiler or interpreter how the programmer intends to use the data. Most progra ...
(see packed decimal/
binary-coded decimal In computing and electronic systems, binary-coded decimal (BCD) is a class of binary encodings of decimal numbers where each digit is represented by a fixed number of bits, usually four or eight. Sometimes, special bit patterns are used for ...
). *
Access violation Access may refer to: Companies and organizations * ACCESS (Australia), an Australian youth network * Access (credit card), a former credit card in the United Kingdom * Access Co., a Japanese software company * Access Healthcare, an Indian BPO se ...
s. * Resource leaks, where a finite system resource (such as
memory Memory is the faculty of the mind by which data or information is encoded, stored, and retrieved when needed. It is the retention of information over time for the purpose of influencing future action. If past events could not be remembered, ...
or
file handles In Unix and Unix-like computer operating systems, a file descriptor (FD, less frequently fildes) is a process-unique identifier (handle) for a file or other input/output resource, such as a pipe or network socket. File descriptors typically have ...
) become exhausted by repeated allocation without release. * Buffer overflow, in which a program tries to store data past the end of allocated storage. This may or may not lead to an access violation or storage violation. These are known as
security bug Security is protection from, or resilience against, potential harm (or other unwanted Coercion, coercive change) caused by others, by restraining the freedom of others to act. Beneficiaries (technically referents) of security may be of persons an ...
s. * Excessive recursion which—though logically valid—causes stack overflow. * Use-after-free error, where a pointer is used after the system has freed the memory it references. * Double free error.


Syntax

* Use of the wrong
token Token may refer to: Arts, entertainment, and media * Token, a game piece or counter, used in some games * The Tokens, a vocal music group * Tolkien Black, a recurring character on the animated television series ''South Park,'' formerly known as ...
, such as performing assignment instead of equality test. For example, in some languages x=5 will set the value of x to 5 while x

5
will check whether x is currently 5 or some other number. Interpreted languages allow such code to fail. Compiled languages can catch such errors before testing begins.


Teamwork

* Unpropagated updates; e.g. programmer changes "myAdd" but forgets to change "mySubtract", which uses the same algorithm. These errors are mitigated by the
Don't Repeat Yourself "Don't repeat yourself" (DRY) is a principle of software development aimed at reducing repetition of software patterns, replacing it with abstractions or using data normalization to avoid redundancy. The DRY principle is stated as "Every piece o ...
philosophy. * Comments out of date or incorrect: many programmers assume the comments accurately describe the code. * Differences between documentation and product.


Implications

The amount and type of damage a software bug may cause naturally affects decision-making, processes and policy regarding software quality. In applications such as
human spaceflight Human spaceflight (also referred to as manned spaceflight or crewed spaceflight) is spaceflight with a crew or passengers aboard a spacecraft, often with the spacecraft being operated directly by the onboard human crew. Spacecraft can also be ...
,
aviation Aviation includes the activities surrounding mechanical flight and the aircraft industry. ''Aircraft'' includes fixed-wing and rotary-wing types, morphable wings, wing-less lifting bodies, as well as lighter-than-air craft such as hot air ...
,
nuclear power Nuclear power is the use of nuclear reactions to produce electricity. Nuclear power can be obtained from nuclear fission, nuclear decay and nuclear fusion reactions. Presently, the vast majority of electricity from nuclear power is produced b ...
,
health care Health care or healthcare is the improvement of health via the prevention, diagnosis, treatment, amelioration or cure of disease, illness, injury, and other physical and mental impairments in people. Health care is delivered by health profe ...
,
public transport Public transport (also known as public transportation, public transit, mass transit, or simply transit) is a system of transport for passengers by group travel systems available for use by the general public unlike private transport, typical ...
or automotive safety, since software flaws have the potential to cause human injury or even death, such software will have far more scrutiny and quality control than, for example, an online shopping website. In applications such as banking, where software flaws have the potential to cause serious financial damage to a bank or its customers, quality control is also more important than, say, a photo editing application. Other than the damage caused by bugs, some of their cost is due to the effort invested in fixing them. In 1978, Lientz et al. showed that the median of projects invest 17 percent of the development effort in bug fixing. In research in 2020 on
GitHub GitHub, Inc. () is an Internet hosting service for software development and version control using Git. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, continuous ...
repositories showed the median is 20%.


Residual bugs in delivered product

In 1994, NASA's
Goddard Space Flight Center The Goddard Space Flight Center (GSFC) is a major NASA space research laboratory located approximately northeast of Washington, D.C. in Greenbelt, Maryland, United States. Established on May 1, 1959 as NASA's first space flight center, GSFC empl ...
managed to reduce their average number of errors from 4.5 per 1000 lines of code ( SLOC) down to 1 per 1000 SLOC. (bibliography
An overview of the Software Engineering Laboratory
Another study in 1990 reported that exceptionally good software development processes can achieve deployment failure rates as low as 0.1 per 1000 SLOC. This figure is iterated in literature such as ''
Code Complete ''Code Complete'' is a software development book, written by Steve McConnell and published in 1993 by Microsoft Press, encouraging developers to continue past code-and-fix programming and the big design up front and waterfall models. It is al ...
'' by
Steve McConnell Steven C. McConnell is an author of software engineering textbooks such as ''Code Complete'', ''Rapid Development'', and ''Software Estimation''. He is cited as an expert in software engineering and project management. Career McConnell graduat ...
, and the ''NASA study on Flight Software Complexity''. (unde
NASA Office of the Chief Engineer Technical Excellence Initiative
Some projects even attained zero defects: the
firmware In computing, firmware is a specific class of computer software that provides the low-level control for a device's specific hardware. Firmware, such as the BIOS of a personal computer, may contain basic functions of a device, and may provide h ...
in the IBM Wheelwriter typewriter which consists of 63,000 SLOC, and the
Space Shuttle The Space Shuttle is a retired, partially reusable low Earth orbital spacecraft system operated from 1981 to 2011 by the U.S. National Aeronautics and Space Administration (NASA) as part of the Space Shuttle program. Its official program na ...
software with 500,000 SLOC.


Well-known bugs

A number of software bugs have become well-known, usually due to their severity: examples include various space and military aircraft crashes. Possibly the most famous bug is the Year 2000 problem or Y2K bug, which caused many programs written long before the transition from 19xx to 20xx dates to malfunction, for example treating a date such as "25 Dec 04" as being in 1904, displaying "19100" instead of "2000", and so on. A huge effort at the end of the 20th century resolved the most severe problems, and there were no major consequences. The 2012 stock trading disruption involved one such incompatibility between the old API and a new API.


In popular culture

* In both the 1968 novel '' 2001: A Space Odyssey'' and the corresponding 1968 film '' 2001: A Space Odyssey'', a spaceship's onboard computer,
HAL 9000 HAL 9000 is a fictional artificial intelligence character and the main antagonist in Arthur C. Clarke's ''Space Odyssey'' series. First appearing in the 1968 film '' 2001: A Space Odyssey'', HAL ( Heuristically programmed ALgorithmic computer ...
, attempts to kill all its crew members. In the follow-up 1982 novel, '' 2010: Odyssey Two'', and the accompanying 1984 film, ''
2010 File:2010 Events Collage New.png, From top left, clockwise: The 2010 Chile earthquake was one of the strongest recorded in history; The Eruption of Eyjafjallajökull in Iceland disrupts air travel in Europe; A scene from the opening ceremony of ...
'', it is revealed that this action was caused by the computer having been programmed with two conflicting objectives: to fully disclose all its information, and to keep the true purpose of the flight secret from the crew; this conflict caused HAL to become paranoid and eventually homicidal. * In the English version of the Nena 1983 song '' 99 Luftballons'' (99 Red Balloons) as a result of "bugs in the software", a release of a group of 99 red balloons are mistaken for an enemy nuclear missile launch, requiring an equivalent launch response, resulting in catastrophe. * In the 1999 American comedy ''
Office Space ''Office Space'' is a 1999 American black comedy film written and directed by Mike Judge. It satirizes the worklife of a typical 1990s software company, focusing on a handful of individuals weary of their jobs. It stars Ron Livingston, Jennifer ...
'', three employees attempt (unsuccessfully) to exploit their company's preoccupation with the Y2K computer bug using a computer virus that sends rounded-off fractions of a penny to their bank account—a long-known technique described as
salami slicing Salami slicing tactics, also known as salami slicing, salami tactics, the salami-slice strategy, or salami attacks, is the practice of using a series of many small actions to produce a much larger action or result that would be difficult or unlawf ...
. * The 2004 novel ''The Bug'', by
Ellen Ullman Ellen Ullman is an American computer programmer and author. She has written books, articles, and essays that analyze the human side of the world of computer programming. She has owned a consulting firm and worked as technology commentator for ...
, is about a programmer's attempt to find an elusive bug in a database application. * The 2008 Canadian film '' Control Alt Delete'' is about a computer programmer at the end of 1999 struggling to fix bugs at his company related to the year 2000 problem.


See also

* Anti-pattern * Bug bounty program *
Glitch removal Glitch removal is the elimination of glitchesunnecessary signal transitions without functionalityfrom electronic circuits. Power dissipation of a gate occurs in two ways: static power dissipation and dynamic power dissipation. Glitch power comes un ...
* Hardware bug *
ISO/IEC 9126 ISO/IEC 9126 ''Software engineering — Product quality'' was an international standard for the evaluation of software quality. It has been replaced by ISO/IEC 25010:2011. The fundamental objective of the ISO/IEC 9126 standard is to address s ...
, which classifies a bug as either a ''defect'' or a ''nonconformity'' *
Orthogonal Defect Classification Orthogonal Defect Classification (ODC) turns semantic information in the software defect stream into a measurement on the process. The ideas were developed in the late '80s and early '90s by Ram Chillarege at IBM Research. This has led to the develo ...
*
Racetrack problem A racetrack problem is a specific instance of a type of race condition. A racetrack problem is a flaw in a system or process whereby the output and/or result of the process is unexpectedly and critically dependent on the sequence or timing of other ...
*
RISKS Digest The RISKS Digest or Forum On Risks to the Public in Computers and Related Systems is an online periodical published since 1985 by the Committee on Computers and Public Policy of the Association for Computing Machinery. The editor is Peter G. Neuman ...
*
Software defect indicator A Software Defect Indicator is a pattern that can be found in source code that is strongly correlated with a software defect, an error or omission in the source code of a computer program that may cause it to malfunction. When inspecting the source ...
*
Software regression A software regression is a type of software bug where a feature that has worked before stops working. This may happen after changes are applied to the software's source code, including the addition of new features and bug fixes. They may also be in ...
*
Software rot Software rot (bit rot, code rot, software erosion, software decay, or software entropy) is either a slow deterioration of software quality over time or its diminishing responsiveness that will eventually lead to software becoming faulty, unusabl ...
*
Automatic bug fixing Automatic bug-fixing is the automatic repair of software bugs without the intervention of a human programmer. It is also commonly referred to as ''automatic patch generation'', ''automatic bug repair'', or ''automatic program repair''. The typical ...


References


External links

*
Common Weakness Enumeration
– an expert webpage focus on bugs, at NIST.gov
BUG type of Jim Gray
– another Bug type * *

– an email from 1981 about Adm. Hopper's bug *
Toward Understanding Compiler Bugs in GCC and LLVM
. A 2016 study of bugs in compilers {{Authority control