|
Page 2 of 3 How to report bugs effectively by Simon Tatham, professional and free-software programmer
Introduction
Anybody
who has written software for public use will probably have received at
least one bad bug report. Reports that say nothing (”It doesn’t
work!”); reports that make no sense; reports that don’t give enough
information; reports that give wrong information. Reports of problems
that turn out to be user error; reports of problems that turn out to be
the fault of somebody else’s program; reports of problems that turn out
to be network failures.
There’s a reason why technical support
is seen as a horrible job to be in, and that reason is bad bug reports.
However, not all bug reports are unpleasant: I maintain free software,
when I’m not earning my living, and sometimes I receive wonderfully
clear, helpful, informative bug reports.
In this essay I’ll try
to state clearly what makes a good bug report. Ideally I would like
everybody in the world to read this essay before reporting any bugs to
anybody. Certainly I would like everybody who reports bugs to me to
have read it.
In a nutshell, the aim of a bug report is to
enable the programmer to see the program failing in front of them. You
can either show them in person, or give them careful and detailed
instructions on how to make it fail. If they can make it fail, they
will try to gather extra information until they know the cause. If they
can’t make it fail, they will have to ask you to gather that
information for them.
In bug reports, try to make very clear
what are actual facts (”I was at the computer and this happened”) and
what are speculations (”I think the problem might be this”). Leave out
speculations if you want to, but don’t leave out facts.
When you
report a bug, you are doing so because you want the bug fixed. There is
no point in swearing at the programmer or being deliberately unhelpful:
it may be their fault and your problem, and you might be right to be
angry with them, but the bug will get fixed faster if you help them by
supplying all the information they need. Remember also that if the
program is free, then the author is providing it out of kindness, so if
too many people are rude to them then they may stop feeling kind.
"It doesn't work."
Give
the programmer some credit for basic intelligence: if the program
really didn’t work at all, they would probably have noticed. Since they
haven’t noticed, it must be working for them. Therefore, either you are
doing something differently from them, or your environment is different
from theirs. They need information; providing this information is the
purpose of a bug report. More information is almost always better than
less.
Many programs, particularly free ones, publish their list
of known bugs. If you can find a list of known bugs, it’s worth reading
it to see if the bug you’ve just found is already known or not. If it’s
already known, it probably isn’t worth reporting again, but if you
think you have more information than the report in the bug list, you
might want to contact the programmer anyway. They might be able to fix
the bug more easily if you can give them information they didn’t
already have.
This essay is full of guidelines. None of them is
an absolute rule. Particular programmers have particular ways they like
bugs to be reported. If the program comes with its own set of
bug-reporting guidelines, read them. If the guidelines that come with
the program contradict the guidelines in this essay, follow the ones
that come with the program!
If you are not reporting a bug but
just asking for help using the program, you should state where you have
already looked for the answer to your question. (”I looked in chapter 4
and section 5.2 but couldn’t find anything that told me if this is
possible.”) This will let the programmer know where people will expect
to find the answer, so they can make the documentation easier to use.
"Show me."
One
of the very best ways you can report a bug is by showing it to the
programmer. Stand them in front of your computer, fire up their
software, and demonstrate the thing that goes wrong. Let them watch you
start the machine, watch you run the software, watch how you interact
with the software, and watch what the software does in response to your
inputs.
They know that software like the back of their hand.
They know which parts they trust, and they know which parts are likely
to have faults. They know intuitively what to watch for. By the time
the software does something obviously wrong, they may well have already
noticed something subtly wrong earlier which might give them a clue.
They can observe everything the computer does during the test run, and
they can pick out the important bits for themselves.
This may
not be enough. They may decide they need more information, and ask you
to show them the same thing again. They may ask you to talk them
through the procedure, so that they can reproduce the bug for
themselves as many times as they want. They might try varying the
procedure a few times, to see whether the problem occurs in only one
case or in a family of related cases. If you’re unlucky, they may need
to sit down for a couple of hours with a set of development tools and
really start investigating. But the most important thing is to have the
programmer looking at the computer when it goes wrong. Once they can
see the problem happening, they can usually take it from there and
start trying to fix it.
"Show me how to show myself."
This
is the era of the Internet. This is the era of worldwide communication.
This is the era in which I can send my software to somebody in Russia
at the touch of a button, and he can send me comments about it just as
easily. But if he has a problem with my program, he can’t have me
standing in front of it while it fails. “Show me” is good when you can,
but often you can’t.
If you have to report a bug to a programmer
who can’t be present in person, the aim of the exercise is to enable
them to reproduce the problem. You want the programmer to run their own
copy of the program, do the same things to it, and make it fail in the
same way. When they can see the problem happening in front of their
eyes, then they can deal with it.
So tell them exactly what you
did. If it’s a graphical program, tell them which buttons you pressed
and what order you pressed them in. If it’s a program you run by typing
a command, show them precisely what command you typed. Wherever
possible, you should provide a verbatim transcript of the session,
showing what commands you typed and what the computer output in
response.
Give the programmer all the input you can think of. If
the program reads from a file, you will probably need to send a copy of
the file. If the program talks to another computer over a network, you
probably can’t send a copy of that computer, but you can at least say
what kind of computer it is, and (if you can) what software is running
on it.
"Works for me. So what goes wrong?"
If you
give the programmer a long list of inputs and actions, and they fire up
their own copy of the program and nothing goes wrong, then you haven’t
given them enough information. Possibly the fault doesn’t show up on
every computer; your system and theirs may differ in some way. Possibly
you have misunderstood what the program is supposed to do, and you are
both looking at exactly the same display but you think it’s wrong and
they know it’s right.
So also describe what happened. Tell them
exactly what you saw. Tell them why you think what you saw is wrong;
better still, tell them exactly what you expected to see. If you say
“and then it went wrong”, you have left out some very important
information.
If you saw error messages then tell the programmer,
carefully and precisely, what they were. They are important! At this
stage, the programmer is not trying to fix the problem: they’re just
trying to find it. They need to know what has gone wrong, and those
error messages are the computer’s best effort to tell you that. Write
the errors down if you have no other easy way to remember them, but
it’s not worth reporting that the program generated an error unless you
can also report what the error message was.
In particular, if
the error message has numbers in it, do let the programmer have those
numbers. Just because you can’t see any meaning in them doesn’t mean
there isn’t any. Numbers contain all kinds of information that can be
read by programmers, and they are likely to contain vital clues.
Numbers in error messages are there because the computer is too
confused to report the error in words, but is doing the best it can to
get the important information to you somehow.
At this stage, the
programmer is effectively doing detective work. They don’t know what’s
happened, and they can’t get close enough to watch it happening for
themselves, so they are searching for clues that might give it away.
Error messages, incomprehensible strings of numbers, and even
unexplained delays are all just as important as fingerprints at the
scene of a crime. Keep them!
If you are using Unix, the program
may have produced a core dump. Core dumps are a particularly good
source of clues, so don’t throw them away. On the other hand, most
programmers don’t like to receive huge core files by e-mail without
warning, so ask before mailing one to anybody. Also, be aware that the
core file contains a record of the complete state of the program: any
“secrets” involved (maybe the program was handling a personal message,
or dealing with confidential data) may be contained in the core file.
|