1 | @rem = '--*-Perl-*--
|
---|
2 | @echo off
|
---|
3 | if "%OS%" == "Windows_NT" goto WinNT
|
---|
4 | perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
5 | goto endofperl
|
---|
6 | :WinNT
|
---|
7 | perl -x -S %0 %*
|
---|
8 | if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
|
---|
9 | if %errorlevel% == 9009 echo You do not have Perl in your PATH.
|
---|
10 | if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
|
---|
11 | goto endofperl
|
---|
12 | @rem ';
|
---|
13 | #!perl
|
---|
14 | #line 15
|
---|
15 | eval 'exec c:\shaoqunWu\perl\bin\perl.exe -S $0 ${1+"$@"}'
|
---|
16 | if $running_under_some_shell;
|
---|
17 |
|
---|
18 | my $config_tag1 = 'v5.8.8 - Wed Aug 2 11:33:07 2006';
|
---|
19 |
|
---|
20 | my $patchlevel_date = 1138720330;
|
---|
21 | my $patch_tags = '';
|
---|
22 | my @patches = (
|
---|
23 | ''
|
---|
24 | );
|
---|
25 |
|
---|
26 | use Config;
|
---|
27 | use File::Spec; # keep perlbug Perl 5.005 compatible
|
---|
28 | use Getopt::Std;
|
---|
29 | use strict;
|
---|
30 |
|
---|
31 | sub paraprint;
|
---|
32 |
|
---|
33 | BEGIN {
|
---|
34 | eval "use Mail::Send;";
|
---|
35 | $::HaveSend = ($@ eq "");
|
---|
36 | eval "use Mail::Util;";
|
---|
37 | $::HaveUtil = ($@ eq "");
|
---|
38 | # use secure tempfiles wherever possible
|
---|
39 | eval "require File::Temp;";
|
---|
40 | $::HaveTemp = ($@ eq "");
|
---|
41 | };
|
---|
42 |
|
---|
43 | my $Version = "1.35";
|
---|
44 |
|
---|
45 | # Changed in 1.06 to skip Mail::Send and Mail::Util if not available.
|
---|
46 | # Changed in 1.07 to see more sendmail execs, and added pipe output.
|
---|
47 | # Changed in 1.08 to use correct address for sendmail.
|
---|
48 | # Changed in 1.09 to close the REP file before calling it up in the editor.
|
---|
49 | # Also removed some old comments duplicated elsewhere.
|
---|
50 | # Changed in 1.10 to run under VMS without Mail::Send; also fixed
|
---|
51 | # temp filename generation.
|
---|
52 | # Changed in 1.11 to clean up some text and removed Mail::Send deactivator.
|
---|
53 | # Changed in 1.12 to check for editor errors, make save/send distinction
|
---|
54 | # clearer and add $ENV{REPLYTO}.
|
---|
55 | # Changed in 1.13 to hopefully make it more difficult to accidentally
|
---|
56 | # send mail
|
---|
57 | # Changed in 1.14 to make the prompts a little more clear on providing
|
---|
58 | # helpful information. Also let file read fail gracefully.
|
---|
59 | # Changed in 1.15 to add warnings to stop people using perlbug for non-bugs.
|
---|
60 | # Also report selected environment variables.
|
---|
61 | # Changed in 1.16 to include @INC, and allow user to re-edit if no changes.
|
---|
62 | # Changed in 1.17 Win32 support added. GSAR 97-04-12
|
---|
63 | # Changed in 1.18 add '-ok' option for reporting build success. CFR 97-06-18
|
---|
64 | # Changed in 1.19 '-ok' default not '-v'
|
---|
65 | # add local patch information
|
---|
66 | # warn on '-ok' if this is an old system; add '-okay'
|
---|
67 | # Changed in 1.20 Added patchlevel.h reading and version/config checks
|
---|
68 | # Changed in 1.21 Added '-nok' for reporting build failure DFD 98-05-05
|
---|
69 | # Changed in 1.22 Heavy reformatting & minor bugfixes HVDS 98-05-10
|
---|
70 | # Changed in 1.23 Restore -ok(ay): say 'success'; don't prompt
|
---|
71 | # Changed in 1.24 Added '-F<file>' to save report HVDS 98-07-01
|
---|
72 | # Changed in 1.25 Warn on failure to open save file. HVDS 98-07-12
|
---|
73 | # Changed in 1.26 Don't require -t STDIN for -ok. HVDS 98-07-15
|
---|
74 | # Changed in 1.27 Added Mac OS and File::Spec support CNANDOR 99-07-27
|
---|
75 | # Changed in 1.28 Additional questions for Perlbugtron RFOLEY 20.03.2000
|
---|
76 | # Changed in 1.29 Perlbug(tron): auto(-ok), short prompts RFOLEY 05-05-2000
|
---|
77 | # Changed in 1.30 Added warnings on failure to open files MSTEVENS 13-07-2000
|
---|
78 | # Changed in 1.31 Add checks on close().Fix my $var unless. TJENNESS 26-07-2000
|
---|
79 | # Changed in 1.32 Use File::Spec->tmpdir TJENNESS 20-08-2000
|
---|
80 | # Changed in 1.33 Don't require -t STDOUT for -ok.
|
---|
81 | # Changed in 1.34 Added Message-Id RFOLEY 18-06-2002
|
---|
82 | # Changed in 1.35 Use File::Temp (patch from Solar Designer) NWCLARK 28-02-2004
|
---|
83 |
|
---|
84 | # TODO: - Allow the user to re-name the file on mail failure, and
|
---|
85 | # make sure failure (transmission-wise) of Mail::Send is
|
---|
86 | # accounted for.
|
---|
87 | # - Test -b option
|
---|
88 |
|
---|
89 | my( $file, $usefile, $cc, $address, $perlbug, $testaddress, $filename, $messageid, $domain,
|
---|
90 | $subject, $from, $verbose, $ed, $outfile, $Is_MacOS, $category, $severity,
|
---|
91 | $fh, $me, $Is_MSWin32, $Is_Linux, $Is_VMS, $msg, $body, $andcc, %REP, $ok,
|
---|
92 | $Is_OpenBSD);
|
---|
93 |
|
---|
94 | my $perl_version = $^V ? sprintf("v%vd", $^V) : $];
|
---|
95 |
|
---|
96 | my $config_tag2 = "$perl_version - $Config{cf_time}";
|
---|
97 |
|
---|
98 | Init();
|
---|
99 |
|
---|
100 | if ($::opt_h) { Help(); exit; }
|
---|
101 | if ($::opt_d) { Dump(*STDOUT); exit; }
|
---|
102 | if (!-t STDIN && !($ok and not $::opt_n)) {
|
---|
103 | paraprint <<EOF;
|
---|
104 | Please use perlbug interactively. If you want to
|
---|
105 | include a file, you can use the -f switch.
|
---|
106 | EOF
|
---|
107 | die "\n";
|
---|
108 | }
|
---|
109 |
|
---|
110 | Query();
|
---|
111 | Edit() unless $usefile || ($ok and not $::opt_n);
|
---|
112 | NowWhat();
|
---|
113 | Send();
|
---|
114 |
|
---|
115 | exit;
|
---|
116 |
|
---|
117 | sub ask_for_alternatives { # (category|severity)
|
---|
118 | my $name = shift;
|
---|
119 | my %alts = (
|
---|
120 | 'category' => {
|
---|
121 | 'default' => 'core',
|
---|
122 | 'ok' => 'install',
|
---|
123 | 'opts' => [qw(core docs install library utilities)], # patch, notabug
|
---|
124 | },
|
---|
125 | 'severity' => {
|
---|
126 | 'default' => 'low',
|
---|
127 | 'ok' => 'none',
|
---|
128 | 'opts' => [qw(critical high medium low wishlist none)], # zero
|
---|
129 | },
|
---|
130 | );
|
---|
131 | die "Invalid alternative($name) requested\n" unless grep(/^$name$/, keys %alts);
|
---|
132 | my $alt = "";
|
---|
133 | if ($ok) {
|
---|
134 | $alt = $alts{$name}{'ok'};
|
---|
135 | } else {
|
---|
136 | my @alts = @{$alts{$name}{'opts'}};
|
---|
137 | paraprint <<EOF;
|
---|
138 | Please pick a \u$name from the following:
|
---|
139 |
|
---|
140 | @alts
|
---|
141 |
|
---|
142 | EOF
|
---|
143 | my $err = 0;
|
---|
144 | do {
|
---|
145 | if ($err++ > 5) {
|
---|
146 | die "Invalid $name: aborting.\n";
|
---|
147 | }
|
---|
148 | print "Please enter a \u$name [$alts{$name}{'default'}]: ";
|
---|
149 | $alt = <>;
|
---|
150 | chomp $alt;
|
---|
151 | if ($alt =~ /^\s*$/) {
|
---|
152 | $alt = $alts{$name}{'default'};
|
---|
153 | }
|
---|
154 | } while !((($alt) = grep(/^$alt/i, @alts)));
|
---|
155 | }
|
---|
156 | lc $alt;
|
---|
157 | }
|
---|
158 |
|
---|
159 | sub Init {
|
---|
160 | # -------- Setup --------
|
---|
161 |
|
---|
162 | $Is_MSWin32 = $^O eq 'MSWin32';
|
---|
163 | $Is_VMS = $^O eq 'VMS';
|
---|
164 | $Is_Linux = lc($^O) eq 'linux';
|
---|
165 | $Is_OpenBSD = lc($^O) eq 'openbsd';
|
---|
166 | $Is_MacOS = $^O eq 'MacOS';
|
---|
167 |
|
---|
168 | @ARGV = split m/\s+/,
|
---|
169 | MacPerl::Ask('Provide command-line args here (-h for help):')
|
---|
170 | if $Is_MacOS && $MacPerl::Version =~ /App/;
|
---|
171 |
|
---|
172 | if (!getopts("Adhva:s:b:f:F:r:e:SCc:to:n:")) { Help(); exit; };
|
---|
173 |
|
---|
174 | # This comment is needed to notify metaconfig that we are
|
---|
175 | # using the $perladmin, $cf_by, and $cf_time definitions.
|
---|
176 |
|
---|
177 | # -------- Configuration ---------
|
---|
178 |
|
---|
179 | # perlbug address
|
---|
180 | $perlbug = '[email protected]';
|
---|
181 |
|
---|
182 | # Test address
|
---|
183 | $testaddress = '[email protected]';
|
---|
184 |
|
---|
185 | # Target address
|
---|
186 | $address = $::opt_a || ($::opt_t ? $testaddress : $perlbug);
|
---|
187 |
|
---|
188 | # Users address, used in message and in Reply-To header
|
---|
189 | $from = $::opt_r || "";
|
---|
190 |
|
---|
191 | # Include verbose configuration information
|
---|
192 | $verbose = $::opt_v || 0;
|
---|
193 |
|
---|
194 | # Subject of bug-report message
|
---|
195 | $subject = $::opt_s || "";
|
---|
196 |
|
---|
197 | # Send a file
|
---|
198 | $usefile = ($::opt_f || 0);
|
---|
199 |
|
---|
200 | # File to send as report
|
---|
201 | $file = $::opt_f || "";
|
---|
202 |
|
---|
203 | # File to output to
|
---|
204 | $outfile = $::opt_F || "";
|
---|
205 |
|
---|
206 | # Body of report
|
---|
207 | $body = $::opt_b || "";
|
---|
208 |
|
---|
209 | # Editor
|
---|
210 | $ed = $::opt_e || $ENV{VISUAL} || $ENV{EDITOR} || $ENV{EDIT}
|
---|
211 | || ($Is_VMS && "edit/tpu")
|
---|
212 | || ($Is_MSWin32 && "notepad")
|
---|
213 | || ($Is_MacOS && '')
|
---|
214 | || "vi";
|
---|
215 |
|
---|
216 | # Not OK - provide build failure template by finessing OK report
|
---|
217 | if ($::opt_n) {
|
---|
218 | if (substr($::opt_n, 0, 2) eq 'ok' ) {
|
---|
219 | $::opt_o = substr($::opt_n, 1);
|
---|
220 | } else {
|
---|
221 | Help();
|
---|
222 | exit();
|
---|
223 | }
|
---|
224 | }
|
---|
225 |
|
---|
226 | # OK - send "OK" report for build on this system
|
---|
227 | $ok = 0;
|
---|
228 | if ($::opt_o) {
|
---|
229 | if ($::opt_o eq 'k' or $::opt_o eq 'kay') {
|
---|
230 | my $age = time - $patchlevel_date;
|
---|
231 | if ($::opt_o eq 'k' and $age > 60 * 24 * 60 * 60 ) {
|
---|
232 | my $date = localtime $patchlevel_date;
|
---|
233 | print <<"EOF";
|
---|
234 | "perlbug -ok" and "perlbug -nok" do not report on Perl versions which
|
---|
235 | are more than 60 days old. This Perl version was constructed on
|
---|
236 | $date. If you really want to report this, use
|
---|
237 | "perlbug -okay" or "perlbug -nokay".
|
---|
238 | EOF
|
---|
239 | exit();
|
---|
240 | }
|
---|
241 | # force these options
|
---|
242 | unless ($::opt_n) {
|
---|
243 | $::opt_S = 1; # don't prompt for send
|
---|
244 | $::opt_b = 1; # we have a body
|
---|
245 | $body = "Perl reported to build OK on this system.\n";
|
---|
246 | }
|
---|
247 | $::opt_C = 1; # don't send a copy to the local admin
|
---|
248 | $::opt_s = 1; # we have a subject line
|
---|
249 | $subject = ($::opt_n ? 'Not ' : '')
|
---|
250 | . "OK: perl $perl_version ${patch_tags}on"
|
---|
251 | ." $::Config{'archname'} $::Config{'osvers'} $subject";
|
---|
252 | $ok = 1;
|
---|
253 | } else {
|
---|
254 | Help();
|
---|
255 | exit();
|
---|
256 | }
|
---|
257 | }
|
---|
258 |
|
---|
259 | # Possible administrator addresses, in order of confidence
|
---|
260 | # (Note that cf_email is not mentioned to metaconfig, since
|
---|
261 | # we don't really want it. We'll just take it if we have to.)
|
---|
262 | #
|
---|
263 | # This has to be after the $ok stuff above because of the way
|
---|
264 | # that $::opt_C is forced.
|
---|
265 | $cc = $::opt_C ? "" : (
|
---|
266 | $::opt_c || $::Config{'perladmin'}
|
---|
267 | || $::Config{'cf_email'} || $::Config{'cf_by'}
|
---|
268 | );
|
---|
269 |
|
---|
270 | if ($::HaveUtil) {
|
---|
271 | $domain = Mail::Util::maildomain();
|
---|
272 | } elsif ($Is_MSWin32) {
|
---|
273 | $domain = $ENV{'USERDOMAIN'};
|
---|
274 | } else {
|
---|
275 | require Sys::Hostname;
|
---|
276 | $domain = Sys::Hostname::hostname();
|
---|
277 | }
|
---|
278 |
|
---|
279 | # Message-Id - rjsf
|
---|
280 | $messageid = "<$::Config{'version'}_${$}_".time."\@$domain>";
|
---|
281 |
|
---|
282 | # My username
|
---|
283 | $me = $Is_MSWin32 ? $ENV{'USERNAME'}
|
---|
284 | : $^O eq 'os2' ? $ENV{'USER'} || $ENV{'LOGNAME'}
|
---|
285 | : $Is_MacOS ? $ENV{'USER'}
|
---|
286 | : eval { getpwuid($<) }; # May be missing
|
---|
287 |
|
---|
288 | $from = $::Config{'cf_email'}
|
---|
289 | if !$from && $::Config{'cf_email'} && $::Config{'cf_by'} && $me &&
|
---|
290 | ($me eq $::Config{'cf_by'});
|
---|
291 | } # sub Init
|
---|
292 |
|
---|
293 | sub Query {
|
---|
294 | # Explain what perlbug is
|
---|
295 | unless ($ok) {
|
---|
296 | paraprint <<EOF;
|
---|
297 | This program provides an easy way to create a message reporting a bug
|
---|
298 | in perl, and e-mail it to $address. It is *NOT* intended for
|
---|
299 | sending test messages or simply verifying that perl works, *NOR* is it
|
---|
300 | intended for reporting bugs in third-party perl modules. It is *ONLY*
|
---|
301 | a means of reporting verifiable problems with the core perl distribution,
|
---|
302 | and any solutions to such problems, to the people who maintain perl.
|
---|
303 |
|
---|
304 | If you're just looking for help with perl, try posting to the Usenet
|
---|
305 | newsgroup comp.lang.perl.misc. If you're looking for help with using
|
---|
306 | perl with CGI, try posting to comp.infosystems.www.programming.cgi.
|
---|
307 | EOF
|
---|
308 | }
|
---|
309 |
|
---|
310 | # Prompt for subject of message, if needed
|
---|
311 |
|
---|
312 | if (TrivialSubject($subject)) {
|
---|
313 | $subject = '';
|
---|
314 | }
|
---|
315 |
|
---|
316 | unless ($subject) {
|
---|
317 | paraprint <<EOF;
|
---|
318 | First of all, please provide a subject for the
|
---|
319 | message. It should be a concise description of
|
---|
320 | the bug or problem. "perl bug" or "perl problem"
|
---|
321 | is not a concise description.
|
---|
322 | EOF
|
---|
323 |
|
---|
324 | my $err = 0;
|
---|
325 | do {
|
---|
326 | print "Subject: ";
|
---|
327 | $subject = <>;
|
---|
328 | chomp $subject;
|
---|
329 | if ($err++ == 5) {
|
---|
330 | die "Aborting.\n";
|
---|
331 | }
|
---|
332 | } while (TrivialSubject($subject));
|
---|
333 | }
|
---|
334 |
|
---|
335 | # Prompt for return address, if needed
|
---|
336 | unless ($from) {
|
---|
337 | # Try and guess return address
|
---|
338 | my $guess;
|
---|
339 |
|
---|
340 | $guess = $ENV{'REPLY-TO'} || $ENV{'REPLYTO'} || '';
|
---|
341 | if ($Is_MacOS) {
|
---|
342 | require Mac::InternetConfig;
|
---|
343 | $guess = $Mac::InternetConfig::InternetConfig{
|
---|
344 | Mac::InternetConfig::kICEmail()
|
---|
345 | };
|
---|
346 | }
|
---|
347 |
|
---|
348 | unless ($guess) {
|
---|
349 | # move $domain to where we can use it elsewhere
|
---|
350 | if ($domain) {
|
---|
351 | if ($Is_VMS && !$::Config{'d_socket'}) {
|
---|
352 | $guess = "$domain\:\:$me";
|
---|
353 | } else {
|
---|
354 | $guess = "$me\@$domain" if $domain;
|
---|
355 | }
|
---|
356 | }
|
---|
357 | }
|
---|
358 |
|
---|
359 | if ($guess) {
|
---|
360 | unless ($ok) {
|
---|
361 | paraprint <<EOF;
|
---|
362 | Your e-mail address will be useful if you need to be contacted. If the
|
---|
363 | default shown is not your full internet e-mail address, please correct it.
|
---|
364 | EOF
|
---|
365 | }
|
---|
366 | } else {
|
---|
367 | paraprint <<EOF;
|
---|
368 | So that you may be contacted if necessary, please enter
|
---|
369 | your full internet e-mail address here.
|
---|
370 | EOF
|
---|
371 | }
|
---|
372 |
|
---|
373 | if ($ok && $guess) {
|
---|
374 | # use it
|
---|
375 | $from = $guess;
|
---|
376 | } else {
|
---|
377 | # verify it
|
---|
378 | print "Your address [$guess]: ";
|
---|
379 | $from = <>;
|
---|
380 | chomp $from;
|
---|
381 | $from = $guess if $from eq '';
|
---|
382 | }
|
---|
383 | }
|
---|
384 |
|
---|
385 | if ($from eq $cc or $me eq $cc) {
|
---|
386 | # Try not to copy ourselves
|
---|
387 | $cc = "yourself";
|
---|
388 | }
|
---|
389 |
|
---|
390 | # Prompt for administrator address, unless an override was given
|
---|
391 | if( !$::opt_C and !$::opt_c ) {
|
---|
392 | paraprint <<EOF;
|
---|
393 | A copy of this report can be sent to your local
|
---|
394 | perl administrator. If the address is wrong, please
|
---|
395 | correct it, or enter 'none' or 'yourself' to not send
|
---|
396 | a copy.
|
---|
397 | EOF
|
---|
398 | print "Local perl administrator [$cc]: ";
|
---|
399 | my $entry = scalar <>;
|
---|
400 | chomp $entry;
|
---|
401 |
|
---|
402 | if ($entry ne "") {
|
---|
403 | $cc = $entry;
|
---|
404 | $cc = '' if $me eq $cc;
|
---|
405 | }
|
---|
406 | }
|
---|
407 |
|
---|
408 | $cc = '' if $cc =~ /^(none|yourself|me|myself|ourselves)$/i;
|
---|
409 | $andcc = " and $cc" if $cc;
|
---|
410 |
|
---|
411 | # Prompt for editor, if no override is given
|
---|
412 | editor:
|
---|
413 | unless ($::opt_e || $::opt_f || $::opt_b) {
|
---|
414 | paraprint <<EOF;
|
---|
415 | Now you need to supply the bug report. Try to make
|
---|
416 | the report concise but descriptive. Include any
|
---|
417 | relevant detail. If you are reporting something
|
---|
418 | that does not work as you think it should, please
|
---|
419 | try to include example of both the actual
|
---|
420 | result, and what you expected.
|
---|
421 |
|
---|
422 | Some information about your local
|
---|
423 | perl configuration will automatically be included
|
---|
424 | at the end of the report. If you are using any
|
---|
425 | unusual version of perl, please try and confirm
|
---|
426 | exactly which versions are relevant.
|
---|
427 |
|
---|
428 | You will probably want to use an editor to enter
|
---|
429 | the report. If "$ed" is the editor you want
|
---|
430 | to use, then just press Enter, otherwise type in
|
---|
431 | the name of the editor you would like to use.
|
---|
432 |
|
---|
433 | If you would like to use a prepared file, type
|
---|
434 | "file", and you will be asked for the filename.
|
---|
435 | EOF
|
---|
436 | print "Editor [$ed]: ";
|
---|
437 | my $entry =scalar <>;
|
---|
438 | chomp $entry;
|
---|
439 |
|
---|
440 | $usefile = 0;
|
---|
441 | if ($entry eq "file") {
|
---|
442 | $usefile = 1;
|
---|
443 | } elsif ($entry ne "") {
|
---|
444 | $ed = $entry;
|
---|
445 | }
|
---|
446 | }
|
---|
447 |
|
---|
448 | # Prompt for category of bug
|
---|
449 | $category ||= ask_for_alternatives('category');
|
---|
450 |
|
---|
451 | # Prompt for severity of bug
|
---|
452 | $severity ||= ask_for_alternatives('severity');
|
---|
453 |
|
---|
454 | # Generate scratch file to edit report in
|
---|
455 | $filename = filename();
|
---|
456 |
|
---|
457 | # Prompt for file to read report from, if needed
|
---|
458 | if ($usefile and !$file) {
|
---|
459 | filename:
|
---|
460 | paraprint <<EOF;
|
---|
461 | What is the name of the file that contains your report?
|
---|
462 | EOF
|
---|
463 | print "Filename: ";
|
---|
464 | my $entry = scalar <>;
|
---|
465 | chomp $entry;
|
---|
466 |
|
---|
467 | if ($entry eq "") {
|
---|
468 | paraprint <<EOF;
|
---|
469 | No filename? I'll let you go back and choose an editor again.
|
---|
470 | EOF
|
---|
471 | goto editor;
|
---|
472 | }
|
---|
473 |
|
---|
474 | unless (-f $entry and -r $entry) {
|
---|
475 | paraprint <<EOF;
|
---|
476 | I'm sorry, but I can't read from `$entry'. Maybe you mistyped the name of
|
---|
477 | the file? If you don't want to send a file, just enter a blank line and you
|
---|
478 | can get back to the editor selection.
|
---|
479 | EOF
|
---|
480 | goto filename;
|
---|
481 | }
|
---|
482 | $file = $entry;
|
---|
483 | }
|
---|
484 |
|
---|
485 | # Generate report
|
---|
486 | open(REP,">$filename") or die "Unable to create report file `$filename': $!\n";
|
---|
487 | my $reptype = !$ok ? "bug" : $::opt_n ? "build failure" : "success";
|
---|
488 |
|
---|
489 | print REP <<EOF;
|
---|
490 | This is a $reptype report for perl from $from,
|
---|
491 | generated with the help of perlbug $Version running under perl $perl_version.
|
---|
492 |
|
---|
493 | EOF
|
---|
494 |
|
---|
495 | if ($body) {
|
---|
496 | print REP $body;
|
---|
497 | } elsif ($usefile) {
|
---|
498 | open(F, "<$file")
|
---|
499 | or die "Unable to read report file from `$file': $!\n";
|
---|
500 | while (<F>) {
|
---|
501 | print REP $_
|
---|
502 | }
|
---|
503 | close(F) or die "Error closing `$file': $!";
|
---|
504 | } else {
|
---|
505 | print REP <<EOF;
|
---|
506 |
|
---|
507 | -----------------------------------------------------------------
|
---|
508 | [Please enter your report here]
|
---|
509 |
|
---|
510 |
|
---|
511 |
|
---|
512 | [Please do not change anything below this line]
|
---|
513 | -----------------------------------------------------------------
|
---|
514 | EOF
|
---|
515 | }
|
---|
516 | Dump(*REP);
|
---|
517 | close(REP) or die "Error closing report file: $!";
|
---|
518 |
|
---|
519 | # read in the report template once so that
|
---|
520 | # we can track whether the user does any editing.
|
---|
521 | # yes, *all* whitespace is ignored.
|
---|
522 | open(REP, "<$filename") or die "Unable to open report file `$filename': $!\n";
|
---|
523 | while (<REP>) {
|
---|
524 | s/\s+//g;
|
---|
525 | $REP{$_}++;
|
---|
526 | }
|
---|
527 | close(REP) or die "Error closing report file `$filename': $!";
|
---|
528 | } # sub Query
|
---|
529 |
|
---|
530 | sub Dump {
|
---|
531 | local(*OUT) = @_;
|
---|
532 |
|
---|
533 | print OUT <<EFF;
|
---|
534 | ---
|
---|
535 | Flags:
|
---|
536 | category=$category
|
---|
537 | severity=$severity
|
---|
538 | EFF
|
---|
539 | if ($::opt_A) {
|
---|
540 | print OUT <<EFF;
|
---|
541 | ack=no
|
---|
542 | EFF
|
---|
543 | }
|
---|
544 | print OUT <<EFF;
|
---|
545 | ---
|
---|
546 | EFF
|
---|
547 | print OUT "This perlbug was built using Perl $config_tag1\n",
|
---|
548 | "It is being executed now by Perl $config_tag2.\n\n"
|
---|
549 | if $config_tag2 ne $config_tag1;
|
---|
550 |
|
---|
551 | print OUT <<EOF;
|
---|
552 | Site configuration information for perl $perl_version:
|
---|
553 |
|
---|
554 | EOF
|
---|
555 | if ($::Config{cf_by} and $::Config{cf_time}) {
|
---|
556 | print OUT "Configured by $::Config{cf_by} at $::Config{cf_time}.\n\n";
|
---|
557 | }
|
---|
558 | print OUT Config::myconfig;
|
---|
559 |
|
---|
560 | if (@patches) {
|
---|
561 | print OUT join "\n ", "Locally applied patches:", @patches;
|
---|
562 | print OUT "\n";
|
---|
563 | };
|
---|
564 |
|
---|
565 | print OUT <<EOF;
|
---|
566 |
|
---|
567 | ---
|
---|
568 | \@INC for perl $perl_version:
|
---|
569 | EOF
|
---|
570 | for my $i (@INC) {
|
---|
571 | print OUT " $i\n";
|
---|
572 | }
|
---|
573 |
|
---|
574 | print OUT <<EOF;
|
---|
575 |
|
---|
576 | ---
|
---|
577 | Environment for perl $perl_version:
|
---|
578 | EOF
|
---|
579 | my @env =
|
---|
580 | qw(PATH LD_LIBRARY_PATH LANG PERL_BADLANG SHELL HOME LOGDIR LANGUAGE);
|
---|
581 | push @env, $Config{ldlibpthname} if $Config{ldlibpthname} ne '';
|
---|
582 | push @env, grep /^(?:PERL|LC_|LANG|CYGWIN)/, keys %ENV;
|
---|
583 | my %env;
|
---|
584 | @env{@env} = @env;
|
---|
585 | for my $env (sort keys %env) {
|
---|
586 | print OUT " $env",
|
---|
587 | exists $ENV{$env} ? "=$ENV{$env}" : ' (unset)',
|
---|
588 | "\n";
|
---|
589 | }
|
---|
590 | if ($verbose) {
|
---|
591 | print OUT "\nComplete configuration data for perl $perl_version:\n\n";
|
---|
592 | my $value;
|
---|
593 | foreach (sort keys %::Config) {
|
---|
594 | $value = $::Config{$_};
|
---|
595 | $value =~ s/'/\\'/g;
|
---|
596 | print OUT "$_='$value'\n";
|
---|
597 | }
|
---|
598 | }
|
---|
599 | } # sub Dump
|
---|
600 |
|
---|
601 | sub Edit {
|
---|
602 | # Edit the report
|
---|
603 | if ($usefile || $body) {
|
---|
604 | paraprint <<EOF;
|
---|
605 | Please make sure that the name of the editor you want to use is correct.
|
---|
606 | EOF
|
---|
607 | print "Editor [$ed]: ";
|
---|
608 | my $entry =scalar <>;
|
---|
609 | chomp $entry;
|
---|
610 | $ed = $entry unless $entry eq '';
|
---|
611 | }
|
---|
612 |
|
---|
613 | tryagain:
|
---|
614 | my $sts;
|
---|
615 | $sts = system("$ed $filename") unless $Is_MacOS;
|
---|
616 | if ($Is_MacOS) {
|
---|
617 | require ExtUtils::MakeMaker;
|
---|
618 | ExtUtils::MM_MacOS::launch_file($filename);
|
---|
619 | paraprint <<EOF;
|
---|
620 | Press Enter when done.
|
---|
621 | EOF
|
---|
622 | scalar <>;
|
---|
623 | }
|
---|
624 | if ($sts) {
|
---|
625 | paraprint <<EOF;
|
---|
626 | The editor you chose (`$ed') could apparently not be run!
|
---|
627 | Did you mistype the name of your editor? If so, please
|
---|
628 | correct it here, otherwise just press Enter.
|
---|
629 | EOF
|
---|
630 | print "Editor [$ed]: ";
|
---|
631 | my $entry =scalar <>;
|
---|
632 | chomp $entry;
|
---|
633 |
|
---|
634 | if ($entry ne "") {
|
---|
635 | $ed = $entry;
|
---|
636 | goto tryagain;
|
---|
637 | } else {
|
---|
638 | paraprint <<EOF;
|
---|
639 | You may want to save your report to a file, so you can edit and mail it
|
---|
640 | yourself.
|
---|
641 | EOF
|
---|
642 | }
|
---|
643 | }
|
---|
644 |
|
---|
645 | return if ($ok and not $::opt_n) || $body;
|
---|
646 | # Check that we have a report that has some, eh, report in it.
|
---|
647 | my $unseen = 0;
|
---|
648 |
|
---|
649 | open(REP, "<$filename") or die "Couldn't open `$filename': $!\n";
|
---|
650 | # a strange way to check whether any significant editing
|
---|
651 | # have been done: check whether any new non-empty lines
|
---|
652 | # have been added. Yes, the below code ignores *any* space
|
---|
653 | # in *any* line.
|
---|
654 | while (<REP>) {
|
---|
655 | s/\s+//g;
|
---|
656 | $unseen++ if $_ ne '' and not exists $REP{$_};
|
---|
657 | }
|
---|
658 |
|
---|
659 | while ($unseen == 0) {
|
---|
660 | paraprint <<EOF;
|
---|
661 | I am sorry but it looks like you did not report anything.
|
---|
662 | EOF
|
---|
663 | print "Action (Retry Edit/Cancel) ";
|
---|
664 | my ($action) = scalar(<>);
|
---|
665 | if ($action =~ /^[re]/i) { # <R>etry <E>dit
|
---|
666 | goto tryagain;
|
---|
667 | } elsif ($action =~ /^[cq]/i) { # <C>ancel, <Q>uit
|
---|
668 | Cancel();
|
---|
669 | }
|
---|
670 | }
|
---|
671 | } # sub Edit
|
---|
672 |
|
---|
673 | sub Cancel {
|
---|
674 | 1 while unlink($filename); # remove all versions under VMS
|
---|
675 | print "\nCancelling.\n";
|
---|
676 | exit(0);
|
---|
677 | }
|
---|
678 |
|
---|
679 | sub NowWhat {
|
---|
680 | # Report is done, prompt for further action
|
---|
681 | if( !$::opt_S ) {
|
---|
682 | while(1) {
|
---|
683 | paraprint <<EOF;
|
---|
684 | Now that you have completed your report, would you like to send
|
---|
685 | the message to $address$andcc, display the message on
|
---|
686 | the screen, re-edit it, display/change the subject,
|
---|
687 | or cancel without sending anything?
|
---|
688 | You may also save the message as a file to mail at another time.
|
---|
689 | EOF
|
---|
690 | retry:
|
---|
691 | print "Action (Send/Display/Edit/Subject/Save to File): ";
|
---|
692 | my $action = scalar <>;
|
---|
693 | chomp $action;
|
---|
694 |
|
---|
695 | if ($action =~ /^(f|sa)/i) { # <F>ile/<Sa>ve
|
---|
696 | my $file_save = $outfile || "perlbug.rep";
|
---|
697 | print "\n\nName of file to save message in [$file_save]: ";
|
---|
698 | my $file = scalar <>;
|
---|
699 | chomp $file;
|
---|
700 | $file = $file_save if $file eq "";
|
---|
701 |
|
---|
702 | unless (open(FILE, ">$file")) {
|
---|
703 | print "\nError opening $file: $!\n\n";
|
---|
704 | goto retry;
|
---|
705 | }
|
---|
706 | open(REP, "<$filename") or die "Couldn't open file `$filename': $!\n";
|
---|
707 | print FILE "To: $address\nSubject: $subject\n";
|
---|
708 | print FILE "Cc: $cc\n" if $cc;
|
---|
709 | print FILE "Reply-To: $from\n" if $from;
|
---|
710 | print FILE "Message-Id: $messageid\n" if $messageid;
|
---|
711 | print FILE "\n";
|
---|
712 | while (<REP>) { print FILE }
|
---|
713 | close(REP) or die "Error closing report file `$filename': $!";
|
---|
714 | close(FILE) or die "Error closing $file: $!";
|
---|
715 |
|
---|
716 | print "\nMessage saved in `$file'.\n";
|
---|
717 | exit;
|
---|
718 | } elsif ($action =~ /^(d|l|sh)/i ) { # <D>isplay, <L>ist, <Sh>ow
|
---|
719 | # Display the message
|
---|
720 | open(REP, "<$filename") or die "Couldn't open file `$filename': $!\n";
|
---|
721 | while (<REP>) { print $_ }
|
---|
722 | close(REP) or die "Error closing report file `$filename': $!";
|
---|
723 | } elsif ($action =~ /^su/i) { # <Su>bject
|
---|
724 | print "Subject: $subject\n";
|
---|
725 | print "If the above subject is fine, just press Enter.\n";
|
---|
726 | print "If not, type in the new subject.\n";
|
---|
727 | print "Subject: ";
|
---|
728 | my $reply = scalar <STDIN>;
|
---|
729 | chomp $reply;
|
---|
730 | if ($reply ne '') {
|
---|
731 | unless (TrivialSubject($reply)) {
|
---|
732 | $subject = $reply;
|
---|
733 | print "Subject: $subject\n";
|
---|
734 | }
|
---|
735 | }
|
---|
736 | } elsif ($action =~ /^se/i) { # <S>end
|
---|
737 | # Send the message
|
---|
738 | print "Are you certain you want to send this message?\n"
|
---|
739 | . 'Please type "yes" if you are: ';
|
---|
740 | my $reply = scalar <STDIN>;
|
---|
741 | chomp $reply;
|
---|
742 | if ($reply eq "yes") {
|
---|
743 | last;
|
---|
744 | } else {
|
---|
745 | paraprint <<EOF;
|
---|
746 | That wasn't a clear "yes", so I won't send your message. If you are sure
|
---|
747 | your message should be sent, type in "yes" (without the quotes) at the
|
---|
748 | confirmation prompt.
|
---|
749 | EOF
|
---|
750 | }
|
---|
751 | } elsif ($action =~ /^[er]/i) { # <E>dit, <R>e-edit
|
---|
752 | # edit the message
|
---|
753 | Edit();
|
---|
754 | } elsif ($action =~ /^[qc]/i) { # <C>ancel, <Q>uit
|
---|
755 | Cancel();
|
---|
756 | } elsif ($action =~ /^s/i) {
|
---|
757 | paraprint <<EOF;
|
---|
758 | I'm sorry, but I didn't understand that. Please type "send" or "save".
|
---|
759 | EOF
|
---|
760 | }
|
---|
761 | }
|
---|
762 | }
|
---|
763 | } # sub NowWhat
|
---|
764 |
|
---|
765 | sub TrivialSubject {
|
---|
766 | my $subject = shift;
|
---|
767 | if ($subject =~
|
---|
768 | /^(y(es)?|no?|help|perl( (bug|problem))?|bug|problem)$/i ||
|
---|
769 | length($subject) < 4 ||
|
---|
770 | $subject !~ /\s/) {
|
---|
771 | print "\nThat doesn't look like a good subject. Please be more verbose.\n\n";
|
---|
772 | return 1;
|
---|
773 | } else {
|
---|
774 | return 0;
|
---|
775 | }
|
---|
776 | }
|
---|
777 |
|
---|
778 | sub Send {
|
---|
779 | # Message has been accepted for transmission -- Send the message
|
---|
780 | if ($outfile) {
|
---|
781 | open SENDMAIL, ">$outfile" or die "Couldn't open '$outfile': $!\n";
|
---|
782 | goto sendout;
|
---|
783 | }
|
---|
784 |
|
---|
785 | # on linux certain mail implementations won't accept the subject
|
---|
786 | # as "~s subject" and thus the Subject header will be corrupted
|
---|
787 | # so don't use Mail::Send to be safe
|
---|
788 | if ($::HaveSend && !$Is_Linux && !$Is_OpenBSD) {
|
---|
789 | $msg = new Mail::Send Subject => $subject, To => $address;
|
---|
790 | $msg->cc($cc) if $cc;
|
---|
791 | $msg->add("Reply-To",$from) if $from;
|
---|
792 |
|
---|
793 | $fh = $msg->open;
|
---|
794 | open(REP, "<$filename") or die "Couldn't open `$filename': $!\n";
|
---|
795 | while (<REP>) { print $fh $_ }
|
---|
796 | close(REP) or die "Error closing $filename: $!";
|
---|
797 | $fh->close;
|
---|
798 |
|
---|
799 | print "\nMessage sent.\n";
|
---|
800 | } elsif ($Is_VMS) {
|
---|
801 | if ( ($address =~ /@/ and $address !~ /^\w+%"/) or
|
---|
802 | ($cc =~ /@/ and $cc !~ /^\w+%"/) ) {
|
---|
803 | my $prefix;
|
---|
804 | foreach (qw[ IN MX SMTP UCX PONY WINS ], '') {
|
---|
805 | $prefix = "$_%", last if $ENV{"MAIL\$PROTOCOL_$_"};
|
---|
806 | }
|
---|
807 | $address = qq[${prefix}"$address"] unless $address =~ /^\w+%"/;
|
---|
808 | $cc = qq[${prefix}"$cc"] unless !$cc || $cc =~ /^\w+%"/;
|
---|
809 | }
|
---|
810 | $subject =~ s/"/""/g; $address =~ s/"/""/g; $cc =~ s/"/""/g;
|
---|
811 | my $sts = system(qq[mail/Subject="$subject" $filename. "$address","$cc"]);
|
---|
812 | if ($sts) {
|
---|
813 | die <<EOF;
|
---|
814 | Can't spawn off mail
|
---|
815 | (leaving bug report in $filename): $sts
|
---|
816 | EOF
|
---|
817 | }
|
---|
818 | } else {
|
---|
819 | my $sendmail = "";
|
---|
820 | for (qw(/usr/lib/sendmail /usr/sbin/sendmail /usr/ucblib/sendmail)) {
|
---|
821 | $sendmail = $_, last if -e $_;
|
---|
822 | }
|
---|
823 | if ($^O eq 'os2' and $sendmail eq "") {
|
---|
824 | my $path = $ENV{PATH};
|
---|
825 | $path =~ s:\\:/: ;
|
---|
826 | my @path = split /$Config{'path_sep'}/, $path;
|
---|
827 | for (@path) {
|
---|
828 | $sendmail = "$_/sendmail", last if -e "$_/sendmail";
|
---|
829 | $sendmail = "$_/sendmail.exe", last if -e "$_/sendmail.exe";
|
---|
830 | }
|
---|
831 | }
|
---|
832 |
|
---|
833 | paraprint(<<"EOF"), die "\n" if $sendmail eq "";
|
---|
834 | I am terribly sorry, but I cannot find sendmail, or a close equivalent, and
|
---|
835 | the perl package Mail::Send has not been installed, so I can't send your bug
|
---|
836 | report. We apologize for the inconvenience.
|
---|
837 |
|
---|
838 | So you may attempt to find some way of sending your message, it has
|
---|
839 | been left in the file `$filename'.
|
---|
840 | EOF
|
---|
841 | open(SENDMAIL, "|$sendmail -t -oi") || die "'|$sendmail -t -oi' failed: $!";
|
---|
842 | sendout:
|
---|
843 | print SENDMAIL "To: $address\n";
|
---|
844 | print SENDMAIL "Subject: $subject\n";
|
---|
845 | print SENDMAIL "Cc: $cc\n" if $cc;
|
---|
846 | print SENDMAIL "Reply-To: $from\n" if $from;
|
---|
847 | print SENDMAIL "Message-Id: $messageid\n" if $messageid;
|
---|
848 | print SENDMAIL "\n\n";
|
---|
849 | open(REP, "<$filename") or die "Couldn't open `$filename': $!\n";
|
---|
850 | while (<REP>) { print SENDMAIL $_ }
|
---|
851 | close(REP) or die "Error closing $filename: $!";
|
---|
852 |
|
---|
853 | if (close(SENDMAIL)) {
|
---|
854 | printf "\nMessage %s.\n", $outfile ? "saved" : "sent";
|
---|
855 | } else {
|
---|
856 | warn "\nSendmail returned status '", $? >> 8, "'\n";
|
---|
857 | }
|
---|
858 | }
|
---|
859 | 1 while unlink($filename); # remove all versions under VMS
|
---|
860 | } # sub Send
|
---|
861 |
|
---|
862 | sub Help {
|
---|
863 | print <<EOF;
|
---|
864 |
|
---|
865 | A program to help generate bug reports about perl5, and mail them.
|
---|
866 | It is designed to be used interactively. Normally no arguments will
|
---|
867 | be needed.
|
---|
868 |
|
---|
869 | Usage:
|
---|
870 | $0 [-v] [-a address] [-s subject] [-b body | -f inpufile ] [ -F outputfile ]
|
---|
871 | [-r returnaddress] [-e editor] [-c adminaddress | -C] [-S] [-t] [-h]
|
---|
872 | $0 [-v] [-r returnaddress] [-A] [-ok | -okay | -nok | -nokay]
|
---|
873 |
|
---|
874 | Simplest usage: run "$0", and follow the prompts.
|
---|
875 |
|
---|
876 | Options:
|
---|
877 |
|
---|
878 | -v Include Verbose configuration data in the report
|
---|
879 | -f File containing the body of the report. Use this to
|
---|
880 | quickly send a prepared message.
|
---|
881 | -F File to output the resulting mail message to, instead of mailing.
|
---|
882 | -S Send without asking for confirmation.
|
---|
883 | -a Address to send the report to. Defaults to `$address'.
|
---|
884 | -c Address to send copy of report to. Defaults to `$cc'.
|
---|
885 | -C Don't send copy to administrator.
|
---|
886 | -s Subject to include with the message. You will be prompted
|
---|
887 | if you don't supply one on the command line.
|
---|
888 | -b Body of the report. If not included on the command line, or
|
---|
889 | in a file with -f, you will get a chance to edit the message.
|
---|
890 | -r Your return address. The program will ask you to confirm
|
---|
891 | this if you don't give it here.
|
---|
892 | -e Editor to use.
|
---|
893 | -t Test mode. The target address defaults to `$testaddress'.
|
---|
894 | -d Data mode. This prints out your configuration data, without mailing
|
---|
895 | anything. You can use this with -v to get more complete data.
|
---|
896 | -A Don't send a bug received acknowledgement to the return address.
|
---|
897 | -ok Report successful build on this system to perl porters
|
---|
898 | (use alone or with -v). Only use -ok if *everything* was ok:
|
---|
899 | if there were *any* problems at all, use -nok.
|
---|
900 | -okay As -ok but allow report from old builds.
|
---|
901 | -nok Report unsuccessful build on this system to perl porters
|
---|
902 | (use alone or with -v). You must describe what went wrong
|
---|
903 | in the body of the report which you will be asked to edit.
|
---|
904 | -nokay As -nok but allow report from old builds.
|
---|
905 | -h Print this help message.
|
---|
906 |
|
---|
907 | EOF
|
---|
908 | }
|
---|
909 |
|
---|
910 | sub filename {
|
---|
911 | if ($::HaveTemp) {
|
---|
912 | # Good. Use a secure temp file
|
---|
913 | my ($fh, $filename) = File::Temp::tempfile(UNLINK => 1);
|
---|
914 | close($fh);
|
---|
915 | return $filename;
|
---|
916 | } else {
|
---|
917 | # Bah. Fall back to doing things less securely.
|
---|
918 | my $dir = File::Spec->tmpdir();
|
---|
919 | $filename = "bugrep0$$";
|
---|
920 | $filename++ while -e File::Spec->catfile($dir, $filename);
|
---|
921 | $filename = File::Spec->catfile($dir, $filename);
|
---|
922 | }
|
---|
923 | }
|
---|
924 |
|
---|
925 | sub paraprint {
|
---|
926 | my @paragraphs = split /\n{2,}/, "@_";
|
---|
927 | print "\n\n";
|
---|
928 | for (@paragraphs) { # implicit local $_
|
---|
929 | s/(\S)\s*\n/$1 /g;
|
---|
930 | write;
|
---|
931 | print "\n";
|
---|
932 | }
|
---|
933 | }
|
---|
934 |
|
---|
935 | format STDOUT =
|
---|
936 | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~
|
---|
937 | $_
|
---|
938 | .
|
---|
939 |
|
---|
940 | __END__
|
---|
941 |
|
---|
942 | =head1 NAME
|
---|
943 |
|
---|
944 | perlbug - how to submit bug reports on Perl
|
---|
945 |
|
---|
946 | =head1 SYNOPSIS
|
---|
947 |
|
---|
948 | B<perlbug> S<[ B<-v> ]> S<[ B<-a> I<address> ]> S<[ B<-s> I<subject> ]>
|
---|
949 | S<[ B<-b> I<body> | B<-f> I<inputfile> ]> S<[ B<-F> I<outputfile> ]>
|
---|
950 | S<[ B<-r> I<returnaddress> ]>
|
---|
951 | S<[ B<-e> I<editor> ]> S<[ B<-c> I<adminaddress> | B<-C> ]>
|
---|
952 | S<[ B<-S> ]> S<[ B<-t> ]> S<[ B<-d> ]> S<[ B<-A> ]> S<[ B<-h> ]>
|
---|
953 |
|
---|
954 | B<perlbug> S<[ B<-v> ]> S<[ B<-r> I<returnaddress> ]>
|
---|
955 | S<[ B<-A> ]> S<[ B<-ok> | B<-okay> | B<-nok> | B<-nokay> ]>
|
---|
956 |
|
---|
957 | =head1 DESCRIPTION
|
---|
958 |
|
---|
959 | A program to help generate bug reports about perl or the modules that
|
---|
960 | come with it, and mail them.
|
---|
961 |
|
---|
962 | If you have found a bug with a non-standard port (one that was not part
|
---|
963 | of the I<standard distribution>), a binary distribution, or a
|
---|
964 | non-standard module (such as Tk, CGI, etc), then please see the
|
---|
965 | documentation that came with that distribution to determine the correct
|
---|
966 | place to report bugs.
|
---|
967 |
|
---|
968 | C<perlbug> is designed to be used interactively. Normally no arguments
|
---|
969 | will be needed. Simply run it, and follow the prompts.
|
---|
970 |
|
---|
971 | If you are unable to run B<perlbug> (most likely because you don't have
|
---|
972 | a working setup to send mail that perlbug recognizes), you may have to
|
---|
973 | compose your own report, and email it to B<[email protected]>. You might
|
---|
974 | find the B<-d> option useful to get summary information in that case.
|
---|
975 |
|
---|
976 | In any case, when reporting a bug, please make sure you have run through
|
---|
977 | this checklist:
|
---|
978 |
|
---|
979 | =over 4
|
---|
980 |
|
---|
981 | =item What version of Perl you are running?
|
---|
982 |
|
---|
983 | Type C<perl -v> at the command line to find out.
|
---|
984 |
|
---|
985 | =item Are you running the latest released version of perl?
|
---|
986 |
|
---|
987 | Look at http://www.perl.com/ to find out. If it is not the latest
|
---|
988 | released version, get that one and see whether your bug has been
|
---|
989 | fixed. Note that bug reports about old versions of Perl, especially
|
---|
990 | those prior to the 5.0 release, are likely to fall upon deaf ears.
|
---|
991 | You are on your own if you continue to use perl1 .. perl4.
|
---|
992 |
|
---|
993 | =item Are you sure what you have is a bug?
|
---|
994 |
|
---|
995 | A significant number of the bug reports we get turn out to be documented
|
---|
996 | features in Perl. Make sure the behavior you are witnessing doesn't fall
|
---|
997 | under that category, by glancing through the documentation that comes
|
---|
998 | with Perl (we'll admit this is no mean task, given the sheer volume of
|
---|
999 | it all, but at least have a look at the sections that I<seem> relevant).
|
---|
1000 |
|
---|
1001 | Be aware of the familiar traps that perl programmers of various hues
|
---|
1002 | fall into. See L<perltrap>.
|
---|
1003 |
|
---|
1004 | Check in L<perldiag> to see what any Perl error message(s) mean.
|
---|
1005 | If message isn't in perldiag, it probably isn't generated by Perl.
|
---|
1006 | Consult your operating system documentation instead.
|
---|
1007 |
|
---|
1008 | If you are on a non-UNIX platform check also L<perlport>, as some
|
---|
1009 | features may be unimplemented or work differently.
|
---|
1010 |
|
---|
1011 | Try to study the problem under the Perl debugger, if necessary.
|
---|
1012 | See L<perldebug>.
|
---|
1013 |
|
---|
1014 | =item Do you have a proper test case?
|
---|
1015 |
|
---|
1016 | The easier it is to reproduce your bug, the more likely it will be
|
---|
1017 | fixed, because if no one can duplicate the problem, no one can fix it.
|
---|
1018 | A good test case has most of these attributes: fewest possible number
|
---|
1019 | of lines; few dependencies on external commands, modules, or
|
---|
1020 | libraries; runs on most platforms unimpeded; and is self-documenting.
|
---|
1021 |
|
---|
1022 | A good test case is almost always a good candidate to be on the perl
|
---|
1023 | test suite. If you have the time, consider making your test case so
|
---|
1024 | that it will readily fit into the standard test suite.
|
---|
1025 |
|
---|
1026 | Remember also to include the B<exact> error messages, if any.
|
---|
1027 | "Perl complained something" is not an exact error message.
|
---|
1028 |
|
---|
1029 | If you get a core dump (or equivalent), you may use a debugger
|
---|
1030 | (B<dbx>, B<gdb>, etc) to produce a stack trace to include in the bug
|
---|
1031 | report. NOTE: unless your Perl has been compiled with debug info
|
---|
1032 | (often B<-g>), the stack trace is likely to be somewhat hard to use
|
---|
1033 | because it will most probably contain only the function names and not
|
---|
1034 | their arguments. If possible, recompile your Perl with debug info and
|
---|
1035 | reproduce the dump and the stack trace.
|
---|
1036 |
|
---|
1037 | =item Can you describe the bug in plain English?
|
---|
1038 |
|
---|
1039 | The easier it is to understand a reproducible bug, the more likely it
|
---|
1040 | will be fixed. Anything you can provide by way of insight into the
|
---|
1041 | problem helps a great deal. In other words, try to analyze the
|
---|
1042 | problem (to the extent you can) and report your discoveries.
|
---|
1043 |
|
---|
1044 | =item Can you fix the bug yourself?
|
---|
1045 |
|
---|
1046 | A bug report which I<includes a patch to fix it> will almost
|
---|
1047 | definitely be fixed. Use the C<diff> program to generate your patches
|
---|
1048 | (C<diff> is being maintained by the GNU folks as part of the B<diffutils>
|
---|
1049 | package, so you should be able to get it from any of the GNU software
|
---|
1050 | repositories). If you do submit a patch, the cool-dude counter at
|
---|
1051 | [email protected] will register you as a savior of the world. Your
|
---|
1052 | patch may be returned with requests for changes, or requests for more
|
---|
1053 | detailed explanations about your fix.
|
---|
1054 |
|
---|
1055 | Here are some clues for creating quality patches: Use the B<-c> or
|
---|
1056 | B<-u> switches to the diff program (to create a so-called context or
|
---|
1057 | unified diff). Make sure the patch is not reversed (the first
|
---|
1058 | argument to diff is typically the original file, the second argument
|
---|
1059 | your changed file). Make sure you test your patch by applying it with
|
---|
1060 | the C<patch> program before you send it on its way. Try to follow the
|
---|
1061 | same style as the code you are trying to patch. Make sure your patch
|
---|
1062 | really does work (C<make test>, if the thing you're patching supports
|
---|
1063 | it).
|
---|
1064 |
|
---|
1065 | =item Can you use C<perlbug> to submit the report?
|
---|
1066 |
|
---|
1067 | B<perlbug> will, amongst other things, ensure your report includes
|
---|
1068 | crucial information about your version of perl. If C<perlbug> is unable
|
---|
1069 | to mail your report after you have typed it in, you may have to compose
|
---|
1070 | the message yourself, add the output produced by C<perlbug -d> and email
|
---|
1071 | it to B<[email protected]>. If, for some reason, you cannot run
|
---|
1072 | C<perlbug> at all on your system, be sure to include the entire output
|
---|
1073 | produced by running C<perl -V> (note the uppercase V).
|
---|
1074 |
|
---|
1075 | Whether you use C<perlbug> or send the email manually, please make
|
---|
1076 | your Subject line informative. "a bug" not informative. Neither is
|
---|
1077 | "perl crashes" nor "HELP!!!". These don't help.
|
---|
1078 | A compact description of what's wrong is fine.
|
---|
1079 |
|
---|
1080 | =back
|
---|
1081 |
|
---|
1082 | Having done your bit, please be prepared to wait, to be told the bug
|
---|
1083 | is in your code, or even to get no reply at all. The Perl maintainers
|
---|
1084 | are busy folks, so if your problem is a small one or if it is difficult
|
---|
1085 | to understand or already known, they may not respond with a personal reply.
|
---|
1086 | If it is important to you that your bug be fixed, do monitor the
|
---|
1087 | C<Changes> file in any development releases since the time you submitted
|
---|
1088 | the bug, and encourage the maintainers with kind words (but never any
|
---|
1089 | flames!). Feel free to resend your bug report if the next released
|
---|
1090 | version of perl comes out and your bug is still present.
|
---|
1091 |
|
---|
1092 | =head1 OPTIONS
|
---|
1093 |
|
---|
1094 | =over 8
|
---|
1095 |
|
---|
1096 | =item B<-a>
|
---|
1097 |
|
---|
1098 | Address to send the report to. Defaults to B<[email protected]>.
|
---|
1099 |
|
---|
1100 | =item B<-A>
|
---|
1101 |
|
---|
1102 | Don't send a bug received acknowledgement to the reply address.
|
---|
1103 | Generally it is only a sensible to use this option if you are a
|
---|
1104 | perl maintainer actively watching perl porters for your message to
|
---|
1105 | arrive.
|
---|
1106 |
|
---|
1107 | =item B<-b>
|
---|
1108 |
|
---|
1109 | Body of the report. If not included on the command line, or
|
---|
1110 | in a file with B<-f>, you will get a chance to edit the message.
|
---|
1111 |
|
---|
1112 | =item B<-C>
|
---|
1113 |
|
---|
1114 | Don't send copy to administrator.
|
---|
1115 |
|
---|
1116 | =item B<-c>
|
---|
1117 |
|
---|
1118 | Address to send copy of report to. Defaults to the address of the
|
---|
1119 | local perl administrator (recorded when perl was built).
|
---|
1120 |
|
---|
1121 | =item B<-d>
|
---|
1122 |
|
---|
1123 | Data mode (the default if you redirect or pipe output). This prints out
|
---|
1124 | your configuration data, without mailing anything. You can use this
|
---|
1125 | with B<-v> to get more complete data.
|
---|
1126 |
|
---|
1127 | =item B<-e>
|
---|
1128 |
|
---|
1129 | Editor to use.
|
---|
1130 |
|
---|
1131 | =item B<-f>
|
---|
1132 |
|
---|
1133 | File containing the body of the report. Use this to quickly send a
|
---|
1134 | prepared message.
|
---|
1135 |
|
---|
1136 | =item B<-F>
|
---|
1137 |
|
---|
1138 | File to output the results to instead of sending as an email. Useful
|
---|
1139 | particularly when running perlbug on a machine with no direct internet
|
---|
1140 | connection.
|
---|
1141 |
|
---|
1142 | =item B<-h>
|
---|
1143 |
|
---|
1144 | Prints a brief summary of the options.
|
---|
1145 |
|
---|
1146 | =item B<-ok>
|
---|
1147 |
|
---|
1148 | Report successful build on this system to perl porters. Forces B<-S>
|
---|
1149 | and B<-C>. Forces and supplies values for B<-s> and B<-b>. Only
|
---|
1150 | prompts for a return address if it cannot guess it (for use with
|
---|
1151 | B<make>). Honors return address specified with B<-r>. You can use this
|
---|
1152 | with B<-v> to get more complete data. Only makes a report if this
|
---|
1153 | system is less than 60 days old.
|
---|
1154 |
|
---|
1155 | =item B<-okay>
|
---|
1156 |
|
---|
1157 | As B<-ok> except it will report on older systems.
|
---|
1158 |
|
---|
1159 | =item B<-nok>
|
---|
1160 |
|
---|
1161 | Report unsuccessful build on this system. Forces B<-C>. Forces and
|
---|
1162 | supplies a value for B<-s>, then requires you to edit the report
|
---|
1163 | and say what went wrong. Alternatively, a prepared report may be
|
---|
1164 | supplied using B<-f>. Only prompts for a return address if it
|
---|
1165 | cannot guess it (for use with B<make>). Honors return address
|
---|
1166 | specified with B<-r>. You can use this with B<-v> to get more
|
---|
1167 | complete data. Only makes a report if this system is less than 60
|
---|
1168 | days old.
|
---|
1169 |
|
---|
1170 | =item B<-nokay>
|
---|
1171 |
|
---|
1172 | As B<-nok> except it will report on older systems.
|
---|
1173 |
|
---|
1174 | =item B<-r>
|
---|
1175 |
|
---|
1176 | Your return address. The program will ask you to confirm its default
|
---|
1177 | if you don't use this option.
|
---|
1178 |
|
---|
1179 | =item B<-S>
|
---|
1180 |
|
---|
1181 | Send without asking for confirmation.
|
---|
1182 |
|
---|
1183 | =item B<-s>
|
---|
1184 |
|
---|
1185 | Subject to include with the message. You will be prompted if you don't
|
---|
1186 | supply one on the command line.
|
---|
1187 |
|
---|
1188 | =item B<-t>
|
---|
1189 |
|
---|
1190 | Test mode. The target address defaults to B<[email protected]>.
|
---|
1191 |
|
---|
1192 | =item B<-v>
|
---|
1193 |
|
---|
1194 | Include verbose configuration data in the report.
|
---|
1195 |
|
---|
1196 | =back
|
---|
1197 |
|
---|
1198 | =head1 AUTHORS
|
---|
1199 |
|
---|
1200 | Kenneth Albanowski (E<lt>[email protected]<gt>), subsequently I<doc>tored
|
---|
1201 | by Gurusamy Sarathy (E<lt>[email protected]<gt>), Tom Christiansen
|
---|
1202 | (E<lt>[email protected]<gt>), Nathan Torkington (E<lt>[email protected]<gt>),
|
---|
1203 | Charles F. Randall (E<lt>[email protected]<gt>), Mike Guy
|
---|
1204 | (E<lt>[email protected]<gt>), Dominic Dunlop (E<lt>[email protected]<gt>),
|
---|
1205 | Hugo van der Sanden (E<lt>[email protected]<gt>),
|
---|
1206 | Jarkko Hietaniemi (E<lt>[email protected]<gt>), Chris Nandor
|
---|
1207 | (E<lt>[email protected]<gt>), Jon Orwant (E<lt>[email protected]<gt>,
|
---|
1208 | and Richard Foley (E<lt>[email protected]<gt>).
|
---|
1209 |
|
---|
1210 | =head1 SEE ALSO
|
---|
1211 |
|
---|
1212 | perl(1), perldebug(1), perldiag(1), perlport(1), perltrap(1),
|
---|
1213 | diff(1), patch(1), dbx(1), gdb(1)
|
---|
1214 |
|
---|
1215 | =head1 BUGS
|
---|
1216 |
|
---|
1217 | None known (guess what must have been used to report them?)
|
---|
1218 |
|
---|
1219 | =cut
|
---|
1220 |
|
---|
1221 |
|
---|
1222 | __END__
|
---|
1223 | :endofperl
|
---|