1@c $FreeBSD$
2
3@c This is the usage section for send-pr.  It is called as 
4@c chapter (Invoking send-pr) by send-pr.texi, and also as
5@c section (Submitting Problem Reports) by gnats.texi (chapter/section
6@c identifiers are adjusted accordingly)
7
8@c FIXME!  This still seems jumbled...
9
10You can invoke @code{send-pr} from a shell prompt, or from within
11@sc{gnu} Emacs using @w{@samp{M-x send-pr}}.
12
13@menu
14* using send-pr::             Creating new Problem Reports
15* send-pr in Emacs::          Using send-pr from within Emacs
16* send-pr from the shell::    Invoking send-pr from the shell
17* Submitting via e-mail::     Submitting a Problem Report via direct e-mail
18* Helpful hints::
19@end menu
20
21@node using send-pr
22@section Creating new Problem Reports
23
24@c FIXME - this is a long node
25Invoking @code{send-pr} presents a PR @dfn{template} with a number of
26fields already filled in.  Complete the template as thoroughly as
27possible to make a useful bug report.  Submit only one bug with each PR.
28
29@cindex template
30A template consists of three sections:
31
32@table @dfn
33@item Comments
34The top several lines of a blank template consist of a series of
35comments that provide some basic instructions for completing the Problem
36Report, as well as a list of valid entries for the @samp{>Category:}
37field.  These comments are all preceded by the string @samp{SEND-PR:}
38and are erased automatically when the PR is submitted.  The
39instructional comments within @samp{<} and @samp{>} are also removed.
40(Only these comments are removed; lines you provide that happen to have
41those characters in them, such as examples of shell-level redirection,
42are not affected.)
43
44@item Mail Header
45@code{send-pr} creates a standard mail header.  @code{send-pr} completes
46all fields except the @samp{Subject:} line with default values.
47(@xref{Fields,,Problem Report format}.)
48
49@item @sc{gnats} fields
50These are the informational fields that @sc{gnats} uses to route your
51Problem Report to the responsible party for further action.  They should
52be filled out as completely as possible.  (@xref{Fields,,Problem Report
53format}.  Also see @ref{Helpful hints,,Helpful hints}.)
54@end table
55
56@ifset SENDPR
57@noindent
58For examples of a Problem Report template and complete Problem Report,
59see @ref{An Example}.
60@end ifset
61
62The default template contains your preconfigured @samp{>Submitter-Id:}.
63@code{send-pr} attempts to determine values for the @samp{>Originator:}
64and @samp{>Organization:} fields (@pxref{Fields,,Problem Report
65format}).  @code{send-pr} will set the @samp{>Originator:} field to
66the value of the @code{NAME} environment variable if it has been set;
67similarly, @samp{>Organization:} will be set to the value of @code{ORGANIZATION}.
68@code{send-pr} also attempts to find out some information
69about your system and architecture, and places this information in the
70@samp{>Environment:} field if it finds any.
71
72You may submit problem reports to different Support Sites from the
73default site by specifying the alternate site when you invoke
74@code{send-pr}.  @xref{send-pr from the shell}.
75Each @code{site} has its own list of categories for
76which it accepts Problem Reports.
77@c FIXME!  This should go in..
78@c For a list of sites to whom @code{send-pr} is configured to send
79@c Problem Reports, type @w{@samp{send-pr -S}}.
80@ifset SENDPR
81(@xref{default site,,Setting a default @var{site}}.)
82@end ifset
83
84@code{send-pr} also provides the mail header section of the template
85with default values in the @samp{To:}, @samp{From:}, and
86@samp{Reply-To:} fields.  The @samp{Subject:} field is empty.
87
88The template begins with a comment section:
89
90@cindex template comment section
91@cindex comment section in the PR template
92@smallexample
93@group
94SEND-PR: -*- send-pr  -*-
95SEND-PR: Lines starting with `SEND-PR' will be removed
96SEND-PR: automatically as well as all comments (the text 
97SEND-PR: below enclosed in `<' and `>').
98SEND-PR: 
99SEND-PR: Please consult the document `Reporting Problems 
100SEND-PR: Using send-pr' if you are not sure how to fill out
101SEND-PR: a problem report.
102SEND-PR:
103SEND-PR: Choose from the following categories:
104@end group
105@end smallexample
106
107@noindent
108and also contains a list of valid @code{>Category:} values for the
109Support Site to whom you are submitting this Problem Report.  One (and
110only one) of these values should be placed in the @code{>Category:}
111field.
112@ifset SENDPR
113A complete sample bug report, from template to completed PR, is shown in
114@ref{An Example}.  For a complete list of valid categories, type
115@w{@samp{send-pr -L}} at your prompt.  @xref{Valid Categories,,Valid
116Categories}, for a sample list of categories, .
117@end ifset
118
119@c FIXME.. this sounds awkward
120The mail header is just below the comment section.  Fill out the
121@samp{Subject:} field, if it is not already completed using the value of
122@samp{>Synopsis:}.  The other mail header fields contain default values.
123
124@cindex mail header section
125@smallexample
126@group
127To: @var{support-site}
128Subject: @emph{complete this field}
129From: @var{your-login}@@@var{your-site}
130Reply-To: @var{your-login}@@@var{your-site}
131X-send-pr-version: send-pr @value{VERSION}
132@end group
133@end smallexample
134
135@noindent
136where @var{support-site} is an alias on your local machine for the
137Support Site you wish to submit this PR to.
138
139The rest of the template contains @sc{gnats} fields.  Each field is
140either automatically completed with valid information (such as your
141@samp{>Submitter-Id:}) or contains a one-line instruction specifying the
142information that field requires in order to be correct.  For example,
143the @samp{>Confidential:} field expects a value of @samp{yes} or
144@samp{no}, and the answer must fit on one line; similarly, the
145@samp{>Synopsis:} field expects a short synopsis of the problem, which
146must also fit on one line.  Fill out the fields as completely as
147possible.  @xref{Helpful hints,,Helpful hints}, for suggestions as to
148what kinds of information to include.
149
150In this example, words in @emph{italics} are filled in with
151pre-configured information:
152
153@cindex @code{send-pr} fields
154@smallexample
155@group
156>Submitter-Id: @emph{your submitter-id}
157>Originator:   @emph{your name here}
158>Organization:  
159    @emph{your organization}
160>Confidential:<[ yes | no ] (one line)>
161>Synopsis:    <synopsis of the problem (one line)>
162>Severity:    <[non-critical | serious | critical](one line)>
163>Priority:    <[ low | medium | high ] (one line)>
164>Category:    <name of the product (one line)>
165>Class:       <[sw-bug | doc-bug | change-request | support]>
166>Release:     <release number (one line)>
167>Environment:
168         <machine, os, target, libraries (multiple lines)>
169
170>Description:
171       <precise description of the problem (multiple lines)>
172>How-To-Repeat:
173       <code/input/activities to reproduce (multiple lines)>
174>Fix:
175       <how to correct or work around the problem, if known 
176        (multiple lines)>
177@end group
178@end smallexample
179
180@cindex @code{Submitter-Id} field
181@cindex @code{>Submitter-Id:}
182When you finish editing the Problem Report, @code{send-pr} mails it to
183the address named in the @samp{To:} field in the mail header.
184@code{send-pr} checks that the complete form contains a valid
185@samp{>Category:}.
186
187@ifset SENDPR
188Your copy of @code{send-pr} should have already been customized on
189installation to reflect your @samp{>Submitter-Id:}.  (@xref{Installing
190send-pr, , Installing @code{send-pr} on your system}.)  If you don't
191know your @samp{>Submitter-Id:}, you can request it using
192@w{@samp{send-pr --request-id}}.  If your organization is not affiliated
193with the site you send Problem Reports to, a good generic
194@samp{>Submitter-Id:} to use is @samp{net}. @emph{NOTE:} If you are using
195send-pr to send problem reports to the FreeBSD Project, this version of
196send-pr already has a customer ID in it and you do not need to request a
197new one.
198@end ifset
199
200@cindex bad Problem Reports
201@cindex errors
202@cindex invalid Problem Reports
203If your PR has an invalid value in one of the @sc{Enumerated} fields
204(@pxref{Fields,,Problem Report format}), @code{send-pr} places the PR in
205a temporary file named @samp{/tmp/pbad@var{nnnn}} on your machine.
206@var{nnnn} is the process identification number given to your current
207@code{send-pr} session.  If you are running @code{send-pr} from the
208shell, you are prompted as to whether or not you wish to try editing the
209same Problem Report again.  If you are running @code{send-pr} from
210Emacs, the Problem Report is placed in the buffer
211@w{@samp{*send-pr-error*}}; you can edit this file and then submit it
212with
213
214@smallexample
215M-x gnats-submit-pr
216@end smallexample
217
218@cindex subsequent mail
219@cindex other mail
220@cindex appending PRs
221@cindex saving related mail
222@cindex related mail
223Any further mail concerning this Problem Report should be carbon-copied
224to the @sc{gnats} mailing address as well, with the category and
225identification number in the @samp{Subject:} line of the message.
226
227@smallexample
228Subject: Re: PR @var{category}/@var{gnats-id}: @var{original message subject}
229@end smallexample
230
231@noindent
232Messages which arrive with @samp{Subject:} lines of this form are
233automatically appended to the Problem Report in the @samp{>Audit-Trail:}
234field in the order received.
235
236@c ---------------------------------------------------------------
237@node send-pr in Emacs 
238@section Using @code{send-pr} from within Emacs
239@cindex using @code{send-pr} from within Emacs
240@cindex @code{send-pr} within Emacs
241@cindex invoking @code{send-pr} from Emacs
242@cindex interactive interface
243
244You can use an interactive @code{send-pr} interface from within @sc{gnu}
245Emacs to fill out your Problem Report.  We recommend that you
246familiarize yourself with Emacs before using this feature
247(@pxref{Introduction,,Introduction,emacs,GNU Emacs}).
248
249Call @code{send-pr} with @w{@samp{M-x send-pr}}.@footnote{If typing
250@w{@samp{M-x send-pr}} doesn't work, see your system administrator for
251help loading @code{send-pr} into Emacs.}  @code{send-pr} responds with a
252Problem Report template preconfigured for the Support Site from which
253you received @code{send-pr}.  (If you use @code{send-pr} locally, the
254default Support Site is probably your local site.)
255
256You may also submit problem reports to different Support Sites from the
257default site.  To use this feature, invoke @code{send-pr} with
258
259@smallexample
260C-u M-x send-pr
261@end smallexample
262
263@code{send-pr} prompts you for the name of a @var{site}.  @var{site} is
264an alias on your local machine which points to an alternate Support
265Site.
266
267@cindex Emacs
268@code{send-pr} displays the template and prompts you in the minibuffer
269with the line:
270@smallexample
271>Category: other
272@end smallexample
273
274@noindent
275Delete the default value @samp{other} @emph{in the minibuffer} and
276replace it with the keyword corresponding to your problem (the list of
277valid categories is in the topmost section of the PR template).  For
278example, if the problem you wish to report has to do with the @sc{gnu} C
279compiler, and your support organization accepts bugs submitted for this
280program under the category @samp{gcc}, delete @samp{other} and then type
281@w{@samp{gcc[@key{RET}]}}.  @code{send-pr} replaces the line
282
283@smallexample
284>Category:       <name of the product (one line)>
285@end smallexample
286
287@noindent
288in the template with
289
290@smallexample
291>Category:       gcc
292@end smallexample
293
294@noindent
295and moves on to another field.  
296
297@cindex completion in Emacs
298@cindex name completion in Emacs
299@w{@code{send-pr}} provides name completion in the minibuffer.  For
300instance, you can also type @w{@samp{gc[@key{TAB}]}}, and @code{send-pr}
301attempts to complete the entry for you.  Typing @w{@samp{g[@key{TAB}]}}
302may not have the same effect if several possible entries begin with
303@samp{g}.  In that case @code{send-pr} cannot complete the entry because
304it cannot determine whether you mean @samp{gcc} or, for example,
305@samp{gdb}, if both of those are possible categories.
306@w{@code{send-pr}} continues to prompt you for a valid entry until you
307enter one.
308
309@w{@code{send-pr}} prompts you interactively to enter each field for
310which there is a range of specific choices.  If you attempt to enter a
311value which is not in the range of acceptable entries, @code{send-pr}
312responds with @w{@samp{[No match]}} and allows you to change the entry
313until it contains an acceptable value.  This avoids unusable information
314(at least in these fields) and also avoids typographical errors which
315could cause problems later.
316
317@code{send-pr} prompts you for the following fields:
318
319@c FIXME - should these go before the discussion on completion?
320@example
321@group
322>Category:
323>Confidential: (@emph{default}:  no)
324>Severity:     (@emph{default}:  serious)
325>Priority:     (@emph{default}:  medium)
326>Class:        (@emph{default}:  sw-bug)
327>Release:
328>Synopsis:     (@emph{this value is copied to @code{Subject:}})
329@end group
330@end example
331
332@noindent
333After you complete these fields, @w{@code{send-pr}} places the cursor in
334the @samp{>Description:} field and displays the message
335
336@smallexample
337To send the problem report use: C-c C-c
338@end smallexample
339
340@noindent
341in the minibuffer.  At this point, edit the file in the main buffer to
342reflect your specific problem, putting relevant information in the
343proper fields.
344@ifset SENDPR
345@xref{An Example}, for a sample Problem Report.
346@end ifset
347
348@w{@samp{send-pr}} provides a few key bindings to make moving
349around in a template buffer more simple:
350
351@table @code
352@item C-c C-f
353@itemx M-x change-field
354Changes the field under the cursor.  @code{edit-pr} prompts you for a
355new value.
356
357@item M-C-b
358@itemx M-x gnats-backward-field
359Moves the cursor to the beginning of the value of the current field.
360
361@item M-C-f
362@itemx M-x gnats-forward-field
363Moves the cursor to the end of the value of the current field.
364
365@item M-p
366@itemx M-x gnats-previous-field
367Moves the cursor back one field to the beginning of the value of the
368previous field.
369
370@item M-n
371@itemx M-x gnats-next-field
372Moves the cursor forward one field to the beginning of the value of the
373next field.
374@end table
375
376@code{send-pr} takes over again when you type @samp{C-c C-c} to send the
377message.  @code{send-pr} reports any errors in a separate buffer, which
378remains in existence until you send the PR properly (or, of course,
379until you explicitly kill the buffer).
380
381For detailed instructions on using Emacs, see
382@ref{Introduction,,,emacs,GNU Emacs}.
383
384@node send-pr from the shell
385@section Invoking @code{send-pr} from the shell
386@cindex command line options
387@cindex invoking @code{send-pr} from the shell
388@cindex shell invocation
389
390@c FIXME!  Add [ -S ] right after [ -L ]...
391@smallexample
392send-pr [ @var{site} ]
393        [ -f @var{problem-report} | --file @var{problem-report} ]
394        [ -t @var{mail-address} | --to @var{mail-address} ]
395        [ --request-id ]
396        [ -L | --list ] [ -P | --print ]
397        [ -V | --version] [ -h | --help ]
398@end smallexample
399
400@var{site} is an alias on your local machine which points to an address
401used by a Support Site.  If this argument is not present, the default
402@var{site} is usually the site which you received @code{send-pr} from,
403or your local site if you use @sc{gnats} locally.
404@ifset SENDPR
405(@xref{default site,,Setting a default @var{site}}.)
406@end ifset
407
408Invoking @code{send-pr} with no options calls the editor named in your
409environment variable @code{EDITOR} on a default PR template.  If the
410environment variable @code{PR_FORM} is set, its value is used as a file
411name which contains a valid template.  If @code{PR_FORM} points to a
412missing or unreadable file, or if the file is empty, @code{send-pr}
413generates an error message and opens the editor on a default template.
414
415@table @code
416@item -f @var{problem-report}
417@itemx --file @var{problem-report}
418Specifies a file, @var{problem-report}, where a completed Problem Report
419already exists.  @code{send-pr} sends the contents of the file without
420invoking an editor.  If @var{problem-report} is @samp{-},
421@w{@code{send-pr}} reads from standard input.
422
423@item -t @var{mail-address}
424@itemx --to @var{mail-address}
425Sends the PR to @var{mail-address}. The default is preset when
426@code{send-pr} is configured.  @emph{This option is not recommended};
427instead, use the argument @var{site} on the command line.
428
429@item -c @var{mail-address}
430@itemx --cc @var{mail-address}
431Places @var{mail-address} in the @code{Cc:} header field of the message
432to be sent.
433
434@item --request-id
435Sends a request for a @code{>Submitter-Id:} to the Support Site.
436
437@cindex listing valid categories
438@item -L
439@itemx --list
440Prints the list of valid @code{>Category:} values on standard output.
441No mail is sent.
442
443@item -s @var{severity}
444@itemx --severity @var{severity}
445@cindex @code{send-pr} fields
446Sets the initial value of the @code{>Severity:} field to @var{severity}.
447
448@ignore
449@item -S
450@itemx --sites
451Displays a list of valid @var{site} values on standard output.  No mail
452is sent.
453@end ignore
454
455@item -P
456@itemx --print
457Displays the PR template.  If the variable @code{PR_FORM} is set in your
458environment, the file it specifies is printed.  If @code{PR_FORM} is not
459set, @code{send-pr} prints the standard blank form.  If the file
460specified by @code{PR_FORM} doesn't exist, @code{send-pr} displays an
461error message.  No mail is sent.
462
463@item -V
464@itemx --version
465Displays the @code{send-pr} version number and a usage summary.  No mail
466is sent.
467
468@item -h
469@itemx --help
470Displays a usage summary for @code{send-pr}.  No mail is sent.
471@end table
472
473@c -------------------------------------------------------------------------
474@node Submitting via e-mail
475@section Submitting a Problem Report via direct e-mail
476@cindex Direct e-mail
477@cindex Submitting a PR via e-mail
478In addition to using @code{send-pr}, there is another way to submit a problem
479report.  You can simply send an e-mail message to the support site.
480
481To do this, look at the address in the @samp{To:} field of the @code{send-pr}
482template.  When you send unformatted e-mail to this address, @sc{gnats}
483processes the message as a new problem report, filling in as many fields from 
484defaults as it can:
485
486@table @code
487@item Synopsis
488The @samp{>Synopsis} field is filled in by the @samp{Subject:} header.
489
490@item Submitter ID
491@sc{gnats} will try to derive the @samp{>Submitter} field from the address
492in the @samp{From:} header.
493
494@item Description
495All of the text in the body of the e-mail message is put into the 
496@samp{>Description} field.  Each line of the text is indented by one space,
497indicating that it is "quoted text" from the sender.
498@end table
499
500Other fields, such as category, version, severity, etc. are set to default
501values (if the @sc{gnats} administrator has set them).
502
503@c --------------------------------------------------------------------------
504@node Helpful hints
505@section Helpful hints
506@cindex helpful hints
507@cindex Using and Porting @sc{gnu} CC
508@cindex effective problem reporting
509@cindex kinds of helpful information
510@cindex information to submit
511@cindex Report all the facts!
512
513There is no orthodox standard for submitting effective bug reports,
514though you might do well to consult the section on submitting bugs for
515@sc{gnu} @code{gcc} in @ref{Bugs, , Reporting Bugs, gcc, Using and
516Porting GNU CC}, by Richard Stallman.  This section contains
517instructions on what kinds of information to include and what kinds of
518mistakes to avoid.
519
520In general, common sense (assuming such an animal exists) dictates the
521kind of information that would be most helpful in tracking down and
522resolving problems in software.  
523@itemize @bullet
524@item 
525Include anything @emph{you} would want to know if you were looking at
526the report from the other end.  There's no need to include every minute
527detail about your environment, although anything that might be different
528from someone else's environment should be included (your path, for
529instance).
530
531@item 
532Narratives are often useful, given a certain degree of restraint.  If a
533person responsible for a bug can see that A was executed, and then B and
534then C, knowing that sequence of events might trigger the realization of
535an intermediate step that was missing, or an extra step that might have
536changed the environment enough to cause a visible problem.  Again,
537restraint is always in order (``I set the build running, went to get a
538cup of coffee (Columbian, cream but no sugar), talked to Sheila on the
539phone, and then THIS happened@dots{}'') but be sure to include anything
540relevant.
541
542@item 
543Richard Stallman writes, ``The fundamental principle of reporting bugs
544usefully is this: @strong{report all the facts}.  If you are not sure
545whether to state a fact or leave it out, state it!''  This holds true
546across all problem reporting systems, for computer software or social
547injustice or motorcycle maintenance.  It is especially important in the
548software field due to the major differences seemingly insignificant
549changes can make (a changed variable, a missing semicolon, etc.).
550
551@item
552Submit only @emph{one} problem with each Problem Report.  If you have
553multiple problems, use multiple PRs.  This aids in tracking each problem
554and also in analyzing the problems associated with a given program.
555
556@item
557It never hurts to do a little research to find out if the bug you've
558found has already been reported.  Most software releases contain lists
559of known bugs in the Release Notes which come with the software; see
560your system administrator if you don't have a copy of these.
561
562@item
563The more closely a PR adheres to the standard format, the less
564interaction is required by a database administrator to route the
565information to the proper place.  Keep in mind that anything that
566requires human interaction also requires time that might be better spent
567in actually fixing the problem.  It is therefore in everyone's best
568interest that the information contained in a PR be as correct as
569possible (in both format and content) at the time of submission.
570@end itemize
571